Skip to content

Commit

Permalink
MoYo 1 - LANG['update'][90] 0 (still 6300 LANG entry to clean)
Browse files Browse the repository at this point in the history
  • Loading branch information
moyooo committed Dec 22, 2011
1 parent 43751d1 commit 94846f6
Show file tree
Hide file tree
Showing 16 changed files with 875 additions and 1,396 deletions.
2 changes: 1 addition & 1 deletion inc/dbmysql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function query($query) {
**/
function queryOrDie($query, $message='') {
$this->query($query)
or die(sprintf(__('%1$s - Error during the database query: %2$s'),
or die(sprintf(__('%1$s - Error during the database query: '.$query.' - Error is %2$s'),
$message, $this->error()));
}

Expand Down
19 changes: 6 additions & 13 deletions inc/migration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ function addField($table, $field, $type, $options=array()) {
$query = "UPDATE `$table`
SET `$field` = ".$params['update']." ".
$params['condition']."";
$DB->query($query)
or die($this->version." set $field in $table " . $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query, $this->version." set $field in $table");
}
return true;
}
Expand Down Expand Up @@ -388,8 +387,7 @@ function renameTable($oldtable, $newtable) {

if (!TableExists("$newtable") && TableExists("$oldtable")) {
$query = "RENAME TABLE `$oldtable` TO `$newtable`";
$DB->query($query)
or die($this->version." rename $oldtable " . $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query, $this->version." rename $oldtable");
}
}

Expand All @@ -407,15 +405,12 @@ function copyTable($oldtable, $newtable) {

if (!TableExists("$newtable") && TableExists("$oldtable")) {
$query = "CREATE TABLE `$newtable` LIKE `$oldtable`";
$DB->query($query)
or die($this->version." create $newtable " . $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query, $this->version." create $newtable");

$query = "INSERT INTO `$newtable`
(SELECT *
FROM `$oldtable`)";
$DB->query($query)
or die($this->version." copy from $oldtable to $newtable " . $LANG['update'][90] .
$DB->error());
$DB->queryOrDie($query, $this->version." copy from $oldtable to $newtable");
}
}

Expand Down Expand Up @@ -445,8 +440,7 @@ function insertInTable($table, $input) {
$query = "INSERT INTO `$table`
(" . implode(', ', $fields) . ")
VALUES (" .implode(', ', $values) . ")";
$DB->query($query)
or die($this->version." insert in $table " . $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query, $this->version." insert in $table");

return $DB->insert_id();
}
Expand All @@ -464,8 +458,7 @@ function migrationOneTable($table) {
if (isset($this->change[$table])) {
$query = "ALTER TABLE `$table` ".implode($this->change[$table], " ,\n")." ";
$this->displayMessage( sprintf(__('Change of the database layout - %s'), $table));
$DB->query($query)
or die($this->version." multiple alter in $table " . $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query, $this->version." multiple alter in $table");

unset($this->change[$table]);
}
Expand Down
16 changes: 8 additions & 8 deletions inc/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static function migrateItemType ($types=array(), $glpitables=array(), $plugtable
$query = "UPDATE `$table`
SET `itemtype` = '$name'
WHERE `itemtype` = '$num'";
$DB->query($query) or die("update itemtype of table $table for $name : ". $DB->error());
$DB->queryOrDie($query, "update itemtype of table $table for $name");
}
}

Expand Down Expand Up @@ -825,8 +825,8 @@ static function migrateItemType ($types=array(), $glpitables=array(), $plugtable
FROM `$itemtable`
WHERE `entities_id` = '$entID'
AND `is_recursive` = '0')";
$DB->query($query3) or die("0.80 update entities_id and is_recursive=0
in glpi_infocoms for $name ". $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query3, "0.80 update entities_id and is_recursive=0
in glpi_infocoms for $name");

// Recursive ones
$query3 = "UPDATE `glpi_infocoms`
Expand All @@ -837,17 +837,17 @@ static function migrateItemType ($types=array(), $glpitables=array(), $plugtable
FROM `$itemtable`
WHERE `entities_id` = '$entID'
AND `is_recursive` = '1')";
$DB->query($query3) or die("0.80 update entities_id and is_recursive=1
in glpi_infocoms for $name ". $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query3, "0.80 update entities_id and is_recursive=1
in glpi_infocoms for $name");
} else {
$query3 = "UPDATE `glpi_infocoms`
SET `entities_id` = '$entID'
WHERE `itemtype` = '$name'
AND `items_id` IN (SELECT `id`
FROM `$itemtable`
WHERE `entities_id` = '$entID')";
$DB->query($query3) or die("0.80 update entities_id in glpi_infocoms
for $name ". $LANG['update'][90] . $DB->error());
$DB->queryOrDie($query3, "0.80 update entities_id in glpi_infocoms
for $name");
}
} // each entity
} // each plugin type
Expand All @@ -858,7 +858,7 @@ static function migrateItemType ($types=array(), $glpitables=array(), $plugtable
$query = "UPDATE `$table`
SET `itemtype` = '$name'
WHERE `itemtype` = '$num'";
$DB->query($query) or die("update itemtype of table $table for $name : ". $DB->error());
$DB->queryOrDie($query, "update itemtype of table $table for $name");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@ function fill_db() {
// update default language
$query = "UPDATE `glpi_configs`
SET `language` = '".$_SESSION["glpilanguage"]."'";
$DB->query($query) or die("4203 ".$LANG['update'][90].$DB->error());
$DB->queryOrDie($query, "4203");

$query = "UPDATE `glpi_users`
SET `language` = NULL";
$DB->query($query) or die("4203 ".$LANG['update'][90].$DB->error());
$DB->queryOrDie($query, "4203");
}


Expand Down
6 changes: 3 additions & 3 deletions install/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function showLocationUpdateForm() {
PRIMARY KEY (`ID`),
UNIQUE KEY (`name`,`parentID`),
KEY(`parentID`)) TYPE=MyISAM";
$DB->query($query) or die("LOCATION ".$DB->error());
$DB->queryOrDie($query, "LOCATION");
}

if (!isset($_POST["validate_location"])) {
Expand Down Expand Up @@ -577,7 +577,7 @@ function updateDbUpTo031() {
FROM `glpi_configs`";
}

$result = $DB->query($query) or die("get current version".$DB->error());
$result = $DB->queryOrDie($query, "get current version");

$current_version = trim($DB->result($result,0,0));
$glpilanguage = trim($DB->result($result,0,1));
Expand Down Expand Up @@ -869,7 +869,7 @@ function updateTreeDropdown() {
// Get current version
$query = "SELECT `version`
FROM `$config_table`";
$result = $DB->query($query) or die("get current version".$DB->error());
$result = $DB->queryOrDie($query, "get current version");

$current_version = trim($DB->result($result, 0, 0));
$tab = updateDbUpTo031();
Expand Down
Loading

0 comments on commit 94846f6

Please sign in to comment.