Skip to content

Commit

Permalink
auto include in update fixed #2821
Browse files Browse the repository at this point in the history
  • Loading branch information
moyooo committed May 31, 2011
1 parent 56d3fa2 commit 4c038cd
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 42 deletions.
File renamed without changes.
8 changes: 4 additions & 4 deletions inc/includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
}


include_once (GLPI_ROOT . "/inc/autoload.php");
include_once (GLPI_ROOT . "/inc/autoload.function.php");

// Init Timer to compute time of display
$TIMER_DEBUG=new Timer;
$TIMER_DEBUG->start();

// Security of PHP_SELF
$_SERVER['PHP_SELF']=cleanParametersURL($_SERVER['PHP_SELF']);


include_once (GLPI_ROOT . "/inc/common.function.php");

// Security of PHP_SELF
$_SERVER['PHP_SELF']=cleanParametersURL($_SERVER['PHP_SELF']);

/// TODO try to remove them if possible
include_once (GLPI_ROOT . "/inc/plugin.function.php");
include_once (GLPI_ROOT . "/inc/db.function.php");
Expand Down
5 changes: 2 additions & 3 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@

include_once (GLPI_ROOT . "/config/define.php");
include_once (GLPI_ROOT . "/config/based_config.php");
include_once (GLPI_ROOT . "/inc/timer.class.php");
include_once (GLPI_ROOT . "/inc/autoload.function.php");
include_once (GLPI_ROOT . "/inc/common.function.php");
include_once (GLPI_ROOT . "/inc/db.function.php");
include_once (GLPI_ROOT . "/inc/dropdown.class.php");
include_once (GLPI_ROOT . "/inc/display.function.php");

Config::detectRootDoc();

//Print a correct Html header for application
function header_html($etape) {
Expand Down
10 changes: 5 additions & 5 deletions install/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@
}

include_once (GLPI_ROOT . "/config/define.php");
include_once (GLPI_ROOT . "/inc/timer.class.php");
include_once (GLPI_ROOT . "/inc/autoload.function.php");
include_once (GLPI_ROOT . "/inc/dbmysql.class.php");
include_once (GLPI_ROOT . "/inc/common.function.php");
include_once (GLPI_ROOT . "/inc/db.function.php");
include_once (GLPI_ROOT . "/inc/display.function.php");
include_once (GLPI_ROOT . "/inc/commonglpi.class.php");
include_once (GLPI_ROOT . "/inc/commondbtm.class.php");
include_once (GLPI_ROOT . "/inc/plugin.class.php");
include_once (GLPI_ROOT . "/config/based_config.php");
include_once (GLPI_CONFIG_DIR . "/config_db.php");
include_once (GLPI_ROOT . "/inc/migration.class.php");
include_once (GLPI_ROOT . "/inc/setup.function.php");
Config::detectRootDoc();

// Old itemtype for compatibility
define("GENERAL_TYPE", 0);
Expand Down Expand Up @@ -456,10 +454,12 @@ function showLocationUpdateForm() {
echo "<h4>".$LANG['update'][137]." : </h4>";
display_new_locations();
echo "<p>".$LANG['update'][136]."</p>";
echo "<div align='center'>";
echo "<form action='".$CFG_GLPI["root_doc"]."/install/update.php' method='post'>";
echo "<input type='submit' class='submit' name='validate_location' value='".
$LANG['buttons'][2]."'>";
echo "<input type='hidden' name='from_update' value='from_update'>";
echo "</div>";
echo "</form>";

} else if (isset($_POST["validate_location"])) {
Expand Down
4 changes: 2 additions & 2 deletions install/update_042_05.php
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ interface enum('IDE','SATA','SCSI','USB') NOT NULL default 'IDE',

}
/// Update to 0.5 : date difference used for update
function date_diff($from, $to) {
function date_diff050($from, $to) {
$from=strtotime($from);
$to=strtotime($to);
if ($from > $to) {
Expand Down Expand Up @@ -1198,7 +1198,7 @@ function updateWarrantyInfos($table,$type){
else $achat_date=$data['achat_date'];
$duration=0;
if ($data['date_fin_garantie']!="0000-00-00"&&!empty($data['date_fin_garantie']))
$duration=round(date_diff($achat_date,$data['date_fin_garantie']),2);
$duration=round(date_diff050($achat_date,$data['date_fin_garantie']),2);
$query_insert="INSERT INTO glpi_infocoms (device_type,FK_device,buy_date,warranty_duration,comments) VALUES ('$type','$IDitem','".$achat_date."','$duration','')";
$result_insert=$DB->query($query_insert) or die("0.5 insert for update warranty ".$LANG['update'][90].$DB->error());
}
Expand Down
6 changes: 3 additions & 3 deletions install/update_051_06.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ function update051to06(){

$DB->query($query) or die("0.6 add table dropdown_cartridge_type ".$LANG['update'][90].$DB->error());

$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".$LANG['cartridges'][11]."');";
$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".addslashes($LANG['cartridges'][11])."');";
$DB->query($query) or die("0.6 add entries to dropdown_cartridge_type ".$LANG['update'][90].$DB->error());
$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".$LANG['cartridges'][10]."');";
$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".addslashes($LANG['cartridges'][10])."');";
$DB->query($query) or die("0.6 add entries to dropdown_cartridge_type ".$LANG['update'][90].$DB->error());
$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".$LANG['cartridges'][37]."');";
$query="INSERT INTO glpi_dropdown_cartridge_type (name) VALUES ('".addslashes($LANG['cartridges'][37])."');";
$DB->query($query) or die("0.6 add entries to dropdown_cartridge_type ".$LANG['update'][90].$DB->error());
}

Expand Down
2 changes: 0 additions & 2 deletions install/update_065_068.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ function update065to068(){

if(!TableExists("glpi_mailing")) {

include_once(GLPI_ROOT.'/inc/notification.class.php');

$query="CREATE TABLE `glpi_mailing` (
`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`type` varchar(255) default NULL,
Expand Down
2 changes: 0 additions & 2 deletions install/update_0681_07.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,6 @@ function update0681to07() {
NETWORKING_TYPE => 'glpi_networking',
PHONE_TYPE => 'glpi_phones');

// include (GLPI_ROOT . "/inc/tracking.function.php");

foreach ($tco_tbl as $type => $table) {
if (!FieldExists($table, "ticket_tco")) {
$query = "ALTER TABLE `$table`
Expand Down
3 changes: 0 additions & 3 deletions install/update_068_0681.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,6 @@ function update068to0681(){


if (countElementsInTable("glpi_ocs_link")){
include_once (GLPI_ROOT . "/inc/commondbtm.class.php");
include_once (GLPI_ROOT . "/inc/ocsng.function.php");
include_once (GLPI_ROOT . "/inc/ocsng.class.php");
$CFG_GLPI["ocs_mode"]=1;
$DBocs=new DBocs(1);
// Get datas to update
Expand Down
12 changes: 8 additions & 4 deletions install/update_06_065.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,13 @@ function update06to065(){


if(TableExists("glpi_type_docs")){
$query="SELECT * from glpi_type_docs WHERE ext='odt' OR ext='ods' OR ext='odp' OR ext='otp' OR ext='ott' OR ext='ots' OR ext='odf' OR ext='odg' OR ext='otg' OR ext='odb' OR ext='oth' OR ext='odm' OR ext='odc' OR ext='odi'";
$query="SELECT * from glpi_type_docs
WHERE ext IN ('odt', 'ods', 'odp', 'otp', 'ott', 'ots', 'odf', 'odg', 'otg', 'odb',
'oth', 'odm', 'odc', 'odi')";
$result=$DB->query($query);
if ($DB->numrows($result)==0){
$query2="INSERT INTO `glpi_type_docs` ( `name` , `ext` , `icon` , `mime` , `upload` , `date_mod` ) VALUES ('Oasis Open Office Writer', 'odt', 'odt-dist.png', '', 'Y', '2006-01-21 17:41:13'),
$query2="INSERT INTO `glpi_type_docs` ( `name` , `ext` , `icon` , `mime` , `upload` , `date_mod` )
VALUES ('Oasis Open Office Writer', 'odt', 'odt-dist.png', '', 'Y', '2006-01-21 17:41:13'),
( 'Oasis Open Office Calc', 'ods', 'ods-dist.png', '', 'Y', '2006-01-21 17:41:31'),
('Oasis Open Office Impress', 'odp', 'odp-dist.png', '', 'Y', '2006-01-21 17:42:54'),
('Oasis Open Office Impress Template', 'otp', 'odp-dist.png', '', 'Y', '2006-01-21 17:43:58'),
Expand All @@ -478,8 +481,9 @@ function update06to065(){
('Oasis Open Office Base', 'odb', 'odb-dist.png', '', 'Y', '2006-01-21 18:03:34'),
('Oasis Open Office HTML', 'oth', 'oth-dist.png', '', 'Y', '2006-01-21 18:05:27'),
('Oasis Open Office Writer Master', 'odm', 'odm-dist.png', '', 'Y', '2006-01-21 18:06:34'),
('Oasis Open Office Chart', 'odc', NULL, '', 'Y', '2006-01-21 18:07:48'),
('Oasis Open Office Image', 'odi', NULL, '', 'Y', '2006-01-21 18:08:18');";
('Oasis Open Office Chart', 'odc', '', '', 'Y', '2006-01-21 18:07:48'),
('Oasis Open Office Image', 'odi', '', '', 'Y', '2006-01-21 18:08:18');";

$DB->query($query2) or die("0.65 add new type docs ".$LANG['update'][90].$DB->error());
}
}
Expand Down
1 change: 0 additions & 1 deletion install/update_0713_072.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
// ----------------------------------------------------------------------

/// Update from 0.71.2 to 0.72
include_once (GLPI_ROOT . "/inc/setup.function.php");

function update0713to072() {
global $DB, $CFG_GLPI, $LANG;
Expand Down
8 changes: 0 additions & 8 deletions install/update_0782_080.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ function update0782to080($output='HTML') {
}

// Update calendar
include_once (GLPI_ROOT . "/inc/commondropdown.class.php");
include_once (GLPI_ROOT . "/inc/commondbchild.class.php");
include_once (GLPI_ROOT . "/inc/calendarsegment.class.php");
include_once (GLPI_ROOT . "/inc/calendar.class.php");
$calendar = new Calendar();
if ($calendar->getFromDB($default_calendar_id)) {
$query = "UPDATE `glpi_calendars`
Expand Down Expand Up @@ -575,7 +571,6 @@ function update0782to080($output='HTML') {
FROM `glpi_computers_softwareversions`";
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
include_once (GLPI_ROOT . "/inc/computer.class.php");

while ($data = $DB->fetch_assoc($result)) {
$comp = new Computer();
Expand Down Expand Up @@ -834,9 +829,6 @@ function update0782to080($output='HTML') {

$migration->displayMessage($LANG['update'][142] . ' - Multi user group for tickets');

include_once (GLPI_ROOT . "/inc/commonitilobject.class.php");
include_once (GLPI_ROOT . "/inc/ticket.class.php");

if (!TableExists('glpi_groups_tickets')) {
$query = "CREATE TABLE `glpi_groups_tickets` (
`id` int(11) NOT NULL AUTO_INCREMENT,
Expand Down
4 changes: 0 additions & 4 deletions install/update_080_083.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ function update080to083($output='HTML') {
$migration->migrationOneTable('glpi_tickettasks');

// migrate DATA
include_once (GLPI_ROOT . "/inc/commonitiltask.class.php");
include_once (GLPI_ROOT . "/inc/tickettask.class.php");
$task = new TicketTask();
foreach ($DB->request('glpi_ticketplannings') as $data) {
if ($task->getFromDB($data['tickettasks_id'])) {
Expand Down Expand Up @@ -319,8 +317,6 @@ function update080to083($output='HTML') {

if ($result=$DB->query($query)) {
if ($DB->numrows($result)==0) {
include_once (GLPI_ROOT . "/inc/notification.class.php");

$query = "INSERT INTO `glpi_notificationtemplates`
(`name`, `itemtype`, `date_mod`)
VALUES ('Problems', 'Problem', NOW())";
Expand Down
2 changes: 1 addition & 1 deletion install/update_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$CFG_GLPI['root_doc'] = '..';

include_once (GLPI_ROOT . "/config/define.php");

include_once (GLPI_ROOT . "/inc/autoload.function.php");
include_once (GLPI_ROOT . "/inc/dbmysql.class.php");
include_once (GLPI_ROOT . "/inc/common.function.php");
include_once (GLPI_ROOT . "/inc/display.function.php");
Expand Down

0 comments on commit 4c038cd

Please sign in to comment.