mysql_connect() deprecated
Change-Id: Iec4d6b145655f25234b48eed1b0050fa8f605326
diff --git a/classes/database_versioning/abstractschemachecker.class.php b/classes/database_versioning/abstractschemachecker.class.php
index 16f1811..fd751ec 100644
--- a/classes/database_versioning/abstractschemachecker.class.php
+++ b/classes/database_versioning/abstractschemachecker.class.php
@@ -165,7 +165,7 @@
}
$query .= ")";
- mysql_query($query,$dbh);
+ mysqli_query($dbh, $query);
}
@@ -198,7 +198,7 @@
if($v['Key'] == "MUL"){
$query .= " DROP INDEX ";
}
- mysql_query($query);
+ mysqli_query($query);
}
}
@@ -221,9 +221,9 @@
}
print $query."\n";
- mysql_query($query);
+ mysqli_query($query);
foreach($endqueries as $q){
- mysql_query($q);
+ mysqli_query($q);
}
}
@@ -274,7 +274,7 @@
private function getTableDescription($table_name,$dbh){
$query = "DESCRIBE $table_name";
print $query;
- $result = mysql_query($query,$dbh);
+ $result = mysqli_query($dbh, $query);
$ret = array();
while( $row = mysql_fetch_assoc($result) ) {
$ret[$row['Field']] = $row;
diff --git a/classes/database_versioning/check_databases.php b/classes/database_versioning/check_databases.php
index fa20cac..38c5754 100644
--- a/classes/database_versioning/check_databases.php
+++ b/classes/database_versioning/check_databases.php
@@ -20,7 +20,7 @@
function mysql_remember_query($sql,$dbh){
global $spent_quries;
$spent_quries[] = $sql;
- return mysql_query($sql,$dbh);
+ return mysqli_query($dbh, $sql);
}
function dirs($path){
@@ -47,7 +47,7 @@
}
$context = new context();
$context->components_directory = "tables/";
-$context->dbhs['refactor_test'] = @mysql_connect("localhost","root","","refactor_test");
+$context->dbhs['refactor_test'] = mysqli_connect("localhost","root","","refactor_test");
$check = new CheckAndModifyDatabaseSchema();
$worked = $check->check_and_modify( $context );
diff --git a/classes/export/dbmaintenance_15min.php b/classes/export/dbmaintenance_15min.php
index 1dc9cc3..6d25fc6 100644
--- a/classes/export/dbmaintenance_15min.php
+++ b/classes/export/dbmaintenance_15min.php
@@ -50,30 +50,30 @@
WHERE f.is_active = 1
GROUP BY f.file_id, l.language_id
HAVING translate_percent > 0";
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
while($myrow = mysql_fetch_assoc($rs)) {
- mysql_query("INSERT INTO file_progress (file_id, language_id, pct_complete)
+ mysqli_query($dbh, "INSERT INTO file_progress (file_id, language_id, pct_complete)
VALUES(" . $myrow['file_id'] . ", " . $myrow['language_id'] . ", " . $myrow['translate_percent'] . ")
- ON DUPLICATE KEY UPDATE pct_complete=" . $myrow['translate_percent'], $dbh);
+ ON DUPLICATE KEY UPDATE pct_complete=" . $myrow['translate_percent']);
}
- mysql_query("DELETE FROM file_progress WHERE pct_complete = 0", $dbh);
+ mysqli_query($dbh, "DELETE FROM file_progress WHERE pct_complete = 0");
}
# Update project/version/language progress
$sql = "SELECT * FROM project_progress WHERE is_stale";
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
while($myrow = mysql_fetch_assoc($rs)) {
- mysql_query("LOCK TABLES project_progress WRITE,
+ mysqli_query($dbh, "LOCK TABLES project_progress WRITE,
project_versions AS v READ,
files AS f READ,
strings AS s READ,
translations AS t READ,
languages AS l READ
- ", $dbh);
+ ");
$sql = "DELETE /* dbmaintenance_15min.php */ FROM project_progress where project_id = '" . addslashes($myrow['project_id']) . "'
AND version = '" . addslashes($myrow['version']) . "'
AND language_id = " . $myrow['language_id'];
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$sql = "INSERT /* dbmaintenance_15min.php */ INTO project_progress SET project_id = '" . addslashes($myrow['project_id']) . "',
version = '" . addslashes($myrow['version']) . "',
@@ -93,11 +93,11 @@
v.project_id = '" . addslashes($myrow['project_id']) . "'
AND v.version = '" . addslashes($myrow['version']) . "'
)";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
echo mysql_error();
# Let's lock and unlock in the loop to allow other queries to go through. There's no rush on completing these stats.
- mysql_query("UNLOCK TABLES", $dbh);
+ mysqli_query($dbh, "UNLOCK TABLES");
sleep(2);
}
?>
diff --git a/classes/export/generate1.php b/classes/export/generate1.php
index 1689c76..067f8d1 100755
--- a/classes/export/generate1.php
+++ b/classes/export/generate1.php
@@ -43,7 +43,7 @@
# Get all release trains
$dbc = new DBConnection();
$dbh = $dbc->connect();
-$result = mysql_query("SELECT * FROM release_trains ORDER BY train_version DESC");
+$result = mysqli_query("SELECT * FROM release_trains ORDER BY train_version DESC");
$train_result = array();
while ($train_row = mysql_fetch_assoc($result)) {
$train_result[$train_row['train_id']] = $train_row['train_version'];
@@ -136,11 +136,11 @@
exec("mkdir ${output_dir_for_train}plugins/");
$sql = "SELECT language_id, iso_code, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name, is_active, IF(language_id = 1,1,0) AS sorthack FROM languages ORDER BY sorthack, name ASC";
- $language_result = mysql_query($sql);
+ $language_result = mysqli_query($sql);
if($language_result === FALSE) {
# We may have lost the database connection with our shell-outs, reconnect
$dbh = $dbc->connect();
- $language_result = mysql_query($sql);
+ $language_result = mysqli_query($sql);
}
while (($language_row = mysql_fetch_assoc($language_result)) != null) {
$language_name = $language_row['name'];
@@ -155,14 +155,14 @@
# Determine which plug-ins need to be in this language pack
if (strcmp($language_iso, "en_AA") == 0) {
- $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+ $file_result = mysqli_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
FROM files AS f
INNER JOIN strings AS s ON f.file_id = s.file_id
INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version)
WHERE f.is_active
AND v.train_id = '" . $train_id . "'");
} else {
- $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+ $file_result = mysqli_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
FROM files AS f
INNER JOIN strings AS s ON f.file_id = s.file_id
INNER JOIN translations AS t ON (s.string_id = t.string_id AND t.is_active)
@@ -274,7 +274,7 @@
if (strcmp($language_iso, "en_AA") == 0) {
$sql = "SELECT string_id, name, value FROM strings WHERE file_id = " . $properties_file['file_id'] .
" AND is_active AND non_translatable = 0";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
/* Check for value starting with form tag (bug 270456) */
if (preg_match("/^(<form>)(.*)/i", $strings_row['value'], $matches)) {
@@ -309,7 +309,7 @@
AND strings.non_translatable = 0
AND translations.language_id = " . $language_id . "
AND translations.is_active";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
fwrite($outp, "\n" . $strings_row['key'] . "=");
# echo "${leader1S}${leaderS}${leaderS}${leaderS}" . $strings_row['key'] . "=";
@@ -568,7 +568,7 @@
WHERE project_id = \"$project_id\"
AND version = \"$project_version\"
AND language_id = $language_id";
- $project_pct_complete_result = mysql_query($sql);
+ $project_pct_complete_result = mysqli_query($sql);
$project_pct_complete = mysql_result($project_pct_complete_result, 0);
}
diff --git a/classes/export/generate_orion.php b/classes/export/generate_orion.php
index 74fe14e..b8ad682 100644
--- a/classes/export/generate_orion.php
+++ b/classes/export/generate_orion.php
@@ -17,7 +17,7 @@
# Get all release trains
$dbc = new DBConnection();
$dbh = $dbc->connect();
-$result = mysql_query("SELECT * FROM release_trains ORDER BY train_version DESC");
+$result = mysqli_query("SELECT * FROM release_trains ORDER BY train_version DESC");
$train_result = array();
while ($train_row = mysql_fetch_assoc($result)) {
$train_result[$train_row['train_id']] = $train_row['train_version'];
@@ -95,11 +95,11 @@
$site_xml = "";
$sql = "SELECT language_id, iso_code, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name, IF(locale <> '', CONCAT(name, locale), name) as name_no_space, is_active, IF(language_id = 1,1,0) AS sorthack FROM languages ORDER BY sorthack, name ASC";
- $language_result = mysql_query($sql);
+ $language_result = mysqli_query($sql);
if($language_result === FALSE) {
# We may have lost the database connection with our shell-outs, reconnect
$dbh = $dbc->connect();
- $language_result = mysql_query($sql);
+ $language_result = mysqli_query($sql);
}
while (($language_row = mysql_fetch_assoc($language_result)) != null) {
$language_name = $language_row['name'];
@@ -117,7 +117,7 @@
# Determine which plug-ins need to be in this language pack
if (strcmp($language_iso, "en_AA") == 0) {
- $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+ $file_result = mysqli_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
FROM files AS f
INNER JOIN strings AS s ON f.file_id = s.file_id
INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version)
@@ -125,7 +125,7 @@
AND f.project_id = 'eclipse.orion'
AND v.train_id = '" . $train_id . "'");
} else {
- $file_result = mysql_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
+ $file_result = mysqli_query("SELECT DISTINCT f.project_id, f.version, f.file_id, f.name
FROM files AS f
INNER JOIN strings AS s ON f.file_id = s.file_id
INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version)
@@ -144,7 +144,7 @@
WHERE project_id = \"$project_id\"
AND version = \"$version\"
AND language_id = $language_id";
- $project_pct_complete_result = mysql_query($sql);
+ $project_pct_complete_result = mysqli_query($sql);
if (mysql_num_rows($project_pct_complete_result) == 0) {
$project_pct_complete = 0;
} else {
@@ -209,7 +209,7 @@
if (strcmp($language_iso, "en_AA") == 0) {
$sql = "SELECT string_id, name AS 'key', value FROM strings WHERE file_id = " . $properties_file['file_id'] .
" AND is_active AND non_translatable = 0";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
if ($line_leader == null) {
fwrite($outp, "\n ");
@@ -241,7 +241,7 @@
AND strings.non_translatable = 0
AND translations.language_id = " . $language_id . "
AND translations.is_active";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
if ($line_leader == null) {
fwrite($outp, "\n ");
diff --git a/classes/export/import_from_csv.php b/classes/export/import_from_csv.php
index fde7ec6..492bc48 100644
--- a/classes/export/import_from_csv.php
+++ b/classes/export/import_from_csv.php
@@ -58,7 +58,7 @@
$csv_file = $argv[3];
$sql = "select language_id from languages where iso_code = '" . addslashes($language) ."'";
-$lrow = mysql_fetch_assoc(mysql_query($sql));
+$lrow = mysql_fetch_assoc(mysqli_query($sql));
if (!$lrow) {
echo "This language code is not supported by Babel. Please see the Babel documentation for more information";
exit;
@@ -72,7 +72,7 @@
SELECT s.string_id FROM files AS f INNER JOIN strings AS s ON f.file_id = s.file_id INNER JOIN release_train_projects as v ON (f.project_id = v.project_id AND f.version = v.version) WHERE f.is_active AND s.non_translatable <> 1 AND s.name = '$data[0]' AND s.value = BINARY '$data[1]' AND v.train_id = '$release_train_id'
SQL;
- $values = mysql_query($sql);
+ $values = mysqli_query($sql);
$value_row = mysql_fetch_assoc($values);
if (!$value_row) {
echo "Could not find the matching record for $data[0] with a value of $data[1]";
@@ -81,7 +81,7 @@
$string_id = $value_row['string_id'];
$sql = "select possibly_incorrect from translations where string_id = $string_id and language_id = $language_id";
- $tr_row = mysql_fetch_assoc(mysql_query($sql));
+ $tr_row = mysql_fetch_assoc(mysqli_query($sql));
if ($tr_row) {
if ($fuzzy == 1) {
if ($tr_row['possibly_incorrect'] == 1) {
@@ -95,10 +95,10 @@
// we are not fuzzy, for now let's assume it's ok to override non-fuzzy translations when yours aren't either.
}
$query = "UPDATE translations set is_active = 0 where string_id = " . $string_id . " and language_id = '" . $language_id . "'";
- mysql_query($query);
+ mysqli_query($query);
}
$query = "INSERT INTO translations(string_id, language_id, value, userid, created_on, possibly_incorrect) values('". addslashes($string_id) ."','". addslashes($language_id) ."','" . addslashes($data[2]) . "', '". addslashes($USER) ."', NOW(), $fuzzy)";
- mysql_query($query);
+ mysqli_query($query);
echo "Added translation \"$data[2]\" for entry '$data[0]'\n";
}
fclose($handle);
diff --git a/classes/export/import_js_translations.php b/classes/export/import_js_translations.php
index 9ea8d43..257e923 100644
--- a/classes/export/import_js_translations.php
+++ b/classes/export/import_js_translations.php
@@ -57,7 +57,7 @@
FROM files AS F, languages AS L WHERE F.is_active = 1
AND F.project_id = '" . $PROJECT_ID . "' AND F.version = '" . $VERSION . "'
AND F.name LIKE '%" . $file . "' AND L.iso_code = '" . $language . "'";
- $rs = mysql_query($SQL, $dbh);
+ $rs = mysqli_query($dbh, $SQL);
if($myrow = mysql_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$language_id = $myrow['language_id'];
@@ -91,7 +91,7 @@
and trv.language_id = $language_id
and trv.value = '" . addslashes(unescape($value)) . "')
WHERE s.is_active = 1 AND s.non_translatable <> 1 AND s.file_id = " . $file_id . " AND s.name = '" . $key . "'";
- $rs_string = mysql_query($SQL, $dbh);
+ $rs_string = mysqli_query($dbh, $SQL);
if ($rs_string) {
$myrow_string = mysql_fetch_assoc($rs_string);
if($myrow_string['string_id'] > 0 # There is an English string
@@ -111,13 +111,13 @@
}
# echo " Language: " . $language . " - Found string with ID: " . $myrow_string['string_id'] . " value: " . $myrow_string['value'] . " never translated to: " . $value . "\n";
$SQL = "UPDATE translations set is_active = 0 where string_id = " . $myrow_string['string_id'] . " and language_id = '" . $language_id . "'";
- mysql_query($SQL, $dbh);
+ mysqli_query($dbh, $SQL);
$SQL = "INSERT INTO translations (translation_id, string_id, language_id, version, value, possibly_incorrect, is_active, userid, created_on)
VALUES (
NULL, " . $myrow_string['string_id'] . ",
" . $language_id . ", 0, '" . addslashes(unescape($value)) . "', $insert_as_fuzzy, 1, " . $USER . ", NOW()
)";
- mysql_query($SQL, $dbh);
+ mysqli_query($dbh, $SQL);
# echo $SQL;
}
}
diff --git a/classes/export/import_translation_zip.php b/classes/export/import_translation_zip.php
index b70895a..7936661 100644
--- a/classes/export/import_translation_zip.php
+++ b/classes/export/import_translation_zip.php
@@ -83,7 +83,7 @@
FROM files AS F, languages AS L WHERE F.is_active = 1
AND F.project_id = '" . $PROJECT_ID . "' AND F.version = '" . $VERSION . "'
AND F.name LIKE '%" . $first_part_file . "%' AND F.name LIKE '%" . $second_part_file . "' AND L.iso_code = '" . $language . "'";
- $rs = mysql_query($SQL, $dbh);
+ $rs = mysqli_query($dbh, $SQL);
if($myrow = mysql_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$language_id = $myrow['language_id'];
@@ -94,7 +94,7 @@
FROM files AS F, languages AS L WHERE F.is_active = 1
AND F.project_id = '" . $PROJECT_ID . "' AND F.version = '" . $VERSION . "'
AND F.name LIKE '%" . $first_part_file . "%' AND F.name LIKE '%" . $last_part_file . "' AND L.iso_code = '" . $language . "'";
- $rs = mysql_query($SQL, $dbh);
+ $rs = mysqli_query($dbh, $SQL);
if($myrow = mysql_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$language_id = $myrow['language_id'];
@@ -153,7 +153,7 @@
and trv.language_id = $language_id
and trv.value = '" . addslashes(unescape($tags[1])) . "')
WHERE s.is_active = 1 AND s.non_translatable <> 1 AND s.file_id = " . $file_id . " AND s.name = '" . $tags[0] . "'";
- $rs_string = mysql_query($SQL, $dbh);
+ $rs_string = mysqli_query($dbh, $SQL);
$myrow_string = mysql_fetch_assoc($rs_string);
if($myrow_string['string_id'] > 0 # There is an English string
&& $tags[1] != "" # With a non-null English value
@@ -172,13 +172,13 @@
}
echo " Found string never translated to this value: " . $myrow_string['string_id'] . " value: " . $myrow_string['value'] . "\n";
$SQL = "UPDATE translations set is_active = 0 where string_id = " . $myrow_string['string_id'] . " and language_id = '" . $language_id . "'";
- mysql_query($SQL, $dbh);
+ mysqli_query($dbh, $SQL);
$SQL = "INSERT INTO translations (translation_id, string_id, language_id, version, value, possibly_incorrect, is_active, userid, created_on)
VALUES (
NULL, " . $myrow_string['string_id'] . ",
" . $language_id . ", 0, '" . addslashes(unescape($tags[1])) . "', $insert_as_fuzzy, 1, " . $USER . ", NOW()
)";
- mysql_query($SQL, $dbh);
+ mysqli_query($dbh, $SQL);
# echo $SQL;
}
}
diff --git a/classes/export/syncup.php b/classes/export/syncup.php
index 193c10d..fb070fa 100644
--- a/classes/export/syncup.php
+++ b/classes/export/syncup.php
@@ -51,7 +51,7 @@
$untranslated_value = rtrim($untranslated_value, "\n\r");
# BINARY the lookup value instead of the field to support an index.
# is_active is not used in consideration of case to reuse.
- $rs = mysql_query( "SELECT string_id FROM strings WHERE value = BINARY '" . addslashes($untranslated_value) . "' and non_translatable = 0 ");
+ $rs = mysqli_query( "SELECT string_id FROM strings WHERE value = BINARY '" . addslashes($untranslated_value) . "' and non_translatable = 0 ");
if ($rs === false) {
return NULL;
}
@@ -65,21 +65,21 @@
}
#if SQL result has many records, last created record will be used.
# s.is_active is not used in consideration of case to reuse.
- $rs2 = mysql_query( "SELECT t.created_on, t.value from strings As s inner join translations AS t on s.string_id = t.string_id where s.string_id IN ($string_ids) and t.language_id = '" . $language_id . "' and t.is_active order by created_on DESC");
+ $rs2 = mysqli_query( "SELECT t.created_on, t.value from strings As s inner join translations AS t on s.string_id = t.string_id where s.string_id IN ($string_ids) and t.language_id = '" . $language_id . "' and t.is_active order by created_on DESC");
if ($rs2 and (($translation_row = mysql_fetch_assoc($rs2)) != null)) {
return $translation_row['value'];
}
return null;
}
-$language_result = mysql_query( "SELECT language_id, iso_code, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name FROM languages WHERE languages.is_active AND languages.language_id<>1 ORDER BY name ASC" );
+$language_result = mysqli_query( "SELECT language_id, iso_code, IF(locale <> '', CONCAT(CONCAT(CONCAT(name, ' ('), locale), ')'), name) as name FROM languages WHERE languages.is_active AND languages.language_id<>1 ORDER BY name ASC" );
while( ($language_row = mysql_fetch_assoc($language_result)) != null ) {
$language_name = $language_row['name'];
$language_iso = $language_row['iso_code'];
$language_id = $language_row['language_id'];
echo "\nInvestigating $language_name ($language_iso) (language_id=$language_id)\n";
#In performance purpose, the SQL sorts a temporary table, TEMP.
- $untranslated_strings = mysql_query( "SELECT * FROM (SELECT string_id, value from strings where is_active and non_translatable = 0 and value <> '' and string_id not in(select string_id from translations where language_id=$language_id) ) AS TEMP order by value" );
+ $untranslated_strings = mysqli_query( "SELECT * FROM (SELECT string_id, value from strings where is_active and non_translatable = 0 and value <> '' and string_id not in(select string_id from translations where language_id=$language_id) ) AS TEMP order by value" );
$count = 0;
$prev_value = '';
while ( ($string_row = mysql_fetch_assoc($untranslated_strings)) != null) {
@@ -104,7 +104,7 @@
if ($translation !== null) {
$query = "INSERT INTO translations(string_id, language_id, value, userid, created_on) values('". addslashes($untranslated_id) ."','". addslashes($language_id) ."','" . addslashes($translation) . "', '". addslashes($User->userid) ."', NOW())";
echo "\tTranslating ", addslashes($untranslated_id), " with: ", addslashes($translation), "\n";
- mysql_query($query);
+ mysqli_query($query);
}
}
}
diff --git a/classes/file/file.class.php b/classes/file/file.class.php
index 910dffb..8d3deea 100755
--- a/classes/file/file.class.php
+++ b/classes/file/file.class.php
@@ -58,7 +58,7 @@
name = " . returnQuotedString(sqlSanitize($this->name, $dbh)) . ",
plugin_id = " . returnQuotedString(sqlSanitize($this->plugin_id, $dbh)) . ",
is_active = " . $this->is_active . $where;
- if(mysql_query($sql, $dbh)) {
+ if(mysqli_query($dbh, $sql)) {
if($this->file_id == 0) {
$this->file_id = mysql_insert_id($dbh);
$Event->key_value = $this->file_id;
@@ -89,7 +89,7 @@
AND project_id = " . returnQuotedString(sqlSanitize($_project_id, $dbh)) . "
AND version = '" . sqlSanitize($_version, $dbh) . "'";
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$myrow = mysql_fetch_assoc($result);
$rValue = $myrow['file_id'];
@@ -108,7 +108,7 @@
global $dbh;
$strings = array();
$sql = "SELECT * from strings WHERE is_active = 1 AND file_id = $this->file_id";
- $rs_strings = mysql_query($sql, $dbh);
+ $rs_strings = mysqli_query($dbh, $sql);
while ($myrow_strings = mysql_fetch_assoc($rs_strings)) {
$string = new String();
$string->string_id = $myrow_strings['string_id'];
@@ -202,7 +202,7 @@
global $dbh;
$strings = array();
$sql = "SELECT * from strings WHERE is_active = 1 AND file_id = $this->file_id";
- $rs_strings = mysql_query($sql, $dbh);
+ $rs_strings = mysqli_query($dbh, $sql);
while ($myrow_strings = mysql_fetch_assoc($rs_strings)) {
$string = new String();
$string->string_id = $myrow_strings['string_id'];
@@ -288,7 +288,7 @@
if (strcmp($language->iso, "en_AA") == 0) {
$sql = "SELECT string_id, name, value FROM strings WHERE file_id = " . $this->file_id .
" AND is_active AND non_translatable = 0";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
$result[$strings_row['name']] = $this->project_id . $strings_row['string_id'] . ":" . $strings_row['value'];
}
@@ -304,7 +304,7 @@
AND strings.non_translatable = 0
AND translations.language_id = " . $language->id . "
AND translations.is_active";
- $strings_result = mysql_query($sql);
+ $strings_result = mysqli_query($sql);
while (($strings_row = mysql_fetch_assoc($strings_result)) != null) {
$result[$strings_row['key']] = $strings_row['trans'];
}
diff --git a/classes/heal/fix_deactivated_translations.php b/classes/heal/fix_deactivated_translations.php
index 9d54790..e5a5a09 100644
--- a/classes/heal/fix_deactivated_translations.php
+++ b/classes/heal/fix_deactivated_translations.php
@@ -21,7 +21,7 @@
print "fetching translation to heal\n";
$query = "select translation_id,string_id,language_id,created_on,value from translations group by string_id,language_id order by created_on desc";
-$res = mysql_query($query);
+$res = mysqli_query($query);
print "starting to heal the translations\n";
@@ -31,38 +31,38 @@
$query = "select translation_id from translations where string_id = $string_id and language_id = $language_id and is_active = 1";
- $looking = mysql_query($query);
+ $looking = mysqli_query($query);
if(mysql_num_rows($looking) == 0){
// print "found 0 ".$row['translation_id']."\n";
}elseif(mysql_num_rows($looking) > 1){
// print "found == ".mysql_num_rows($looking)." -- translation_id ".$row['translation_id']." string_id --- ".$row['string_id']." -- date : ".$row['created_on']."\n".$row['value']."\n";
$query = "select max(version) as max from translations where string_id = $string_id and language_id = $language_id ";
- $max = mysql_fetch_assoc(mysql_query($query));
+ $max = mysql_fetch_assoc(mysqli_query($query));
$max = $max['max'];
$query = "update translations set is_active = 0 where string_id = $string_id and language_id = $language_id and version != $max";
- mysql_query($query);
+ mysqli_query($query);
$query = "update translations set is_active = 1 where string_id = $string_id and language_id = $language_id and version = $max";
- mysql_query($query);
+ mysqli_query($query);
}
}
print "deleting file_progress table data\n";
//drop all the old calced file progress
$query = "delete from file_progress";
-mysql_query($query);
+mysqli_query($query);
print "getting all the file ids and language ids\n";
//get all the files
$query = "select file_id from files";
-$res = mysql_query($query);
+$res = mysqli_query($query);
while($row = mysql_fetch_assoc($res)){
$file_ids[] = $row['file_id'];
}
//get all the langs
$query = "select language_id from languages";
-$res = mysql_query($query);
+$res = mysqli_query($query);
while($row = mysql_fetch_assoc($res)){
$lang_ids[] = $row['language_id'];
}
@@ -70,7 +70,7 @@
print "cleaning up the file progress of all 0 completed!\n";
//clean up all the pct_complete == 0
$query = "delete from file_progress where pct_complete = 0";
-mysql_query($query);
+mysqli_query($query);
print "Removing all files affected by bug 233305\n";
@@ -79,7 +79,7 @@
# find lowest version
$file_count = 0;
$query = "select min(file_id) as file_id, project_id, version, name from files where version='unspecified' group by project_id, version, name";
-$res = mysql_query($query);
+$res = mysqli_query($query);
while($row = mysql_fetch_assoc($res)){
$query = "select file_id from files
where project_id = '" . $row['project_id'] . "'
@@ -87,25 +87,25 @@
and name = '" . $row['name'] . "'
and file_id <> " . $row['file_id'];
- $res_f = mysql_query($query);
+ $res_f = mysqli_query($query);
while($row_f = mysql_fetch_assoc($res_f)){
# find strings
$file_count++;
$query = "delete from translations where string_id in (select string_id from strings where file_id = '" . $row_f['file_id'] . "')";
print $query . "... ";
- mysql_query($query);
+ mysqli_query($query);
print mysql_affected_rows() . " rows deleted\n";
# delete strings
$query = "delete from strings where file_id = '" . $row_f['file_id'] . "'";
print $query . "... ";
- mysql_query($query);
+ mysqli_query($query);
print mysql_affected_rows() . " rows deleted\n";
# delete strings
$query = "delete from files where file_id = '" . $row_f['file_id'] . "'";
print $query . "... ";
- mysql_query($query);
+ mysqli_query($query);
print mysql_affected_rows() . " rows deleted\n";
}
@@ -129,25 +129,25 @@
if( $found_active == 0){
// print "0 - $string_id - $language_id<br>\n";
$query = "select max(version) as max from translations where string_id = $string_id and language_id = $language_id ";
- $max = mysql_fetch_assoc(mysql_query($query));
+ $max = mysql_fetch_assoc(mysqli_query($query));
$max = $max['max'];
$query = "update translations set is_active = 1 where string_id = $string_id and language_id = $language_id and version = $max";
print $query."\n";
-// mysql_query($query);
+// mysqli_query($query);
print mysql_error();
}elseif($found_active > 1){
$query = "select max(version) as max from translations where string_id = $string_id and language_id = $language_id ";
- $max = mysql_fetch_assoc(mysql_query($query));
+ $max = mysql_fetch_assoc(mysqli_query($query));
$max = $max['max'];
$query = "update translations set is_active = 0 where string_id = $string_id and language_id = $language_id and version != $max";
print $query."\n";
-// mysql_query($query);
+// mysqli_query($query);
print mysql_error();
$query = "update translations set is_active = 1 where string_id = $string_id and language_id = $language_id and version = $max";
print $query."\n";
-// mysql_query($query);
+// mysqli_query($query);
print mysql_error();
}
diff --git a/classes/string/string.class.php b/classes/string/string.class.php
index 57461b2..8fccbd4 100755
--- a/classes/string/string.class.php
+++ b/classes/string/string.class.php
@@ -52,7 +52,7 @@
userid = " . returnQuotedString(sqlSanitize($this->userid, $dbh)) . ",
created_on = " . $created_on . ",
is_active = " . sqlSanitize($this->is_active, $dbh) . $where;
- if(mysql_query($sql, $dbh)) {
+ if(mysqli_query($dbh, $sql)) {
if($this->string_id == 0) {
$this->string_id = mysql_insert_id($dbh);
}
@@ -101,7 +101,7 @@
userid = " . returnQuotedString(sqlSanitize($this->userid, $dbh)) . ",
created_on = " . $created_on . ",
is_active = " . sqlSanitize($this->is_active, $dbh) . $where;
- if(mysql_query($sql, $dbh)) {
+ if(mysqli_query($dbh, $sql)) {
if($this->string_id == 0) {
$this->string_id = mysql_insert_id($dbh);
}
@@ -139,7 +139,7 @@
WHERE file_id = " . sqlSanitize($_file_id, $dbh) . "
AND name = BINARY " . returnQuotedString(sqlSanitize($_name, $dbh));
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$myrow = mysql_fetch_assoc($result);
$String = new String();
@@ -168,7 +168,7 @@
WHERE file_id = " . sqlSanitize($_file_id, $dbh) . "
AND name = BINARY " . $_name;
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$myrow = mysql_fetch_assoc($result);
$String = new String();
@@ -196,7 +196,7 @@
WHERE file_id = " . sqlSanitize($_file_id, $dbh) . "
AND string_id = " . $_string_id;
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$myrow = mysql_fetch_assoc($result);
$String = new String();
@@ -230,7 +230,7 @@
WHERE file_id = " . sqlSanitize($_file_id, $dbh) . "
AND is_active = 1";
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
while($myrow = mysql_fetch_assoc($result)) {
$String = new String();
$String->string_id = $myrow['string_id'];
@@ -260,7 +260,7 @@
$sql = "UPDATE strings
SET is_active = 0 WHERE string_id = " . sqlSanitize($_string_id, $dbh);
- $rValue = mysql_query($sql, $dbh);
+ $rValue = mysqli_query($dbh, $sql);
$Event = new EventLog("strings", "string_id", $_string_id, "DEACTIVATE");
$Event->add();
diff --git a/classes/system/dbconnection.class.php b/classes/system/dbconnection.class.php
index 801a455..d75fc8c 100755
--- a/classes/system/dbconnection.class.php
+++ b/classes/system/dbconnection.class.php
@@ -20,12 +20,13 @@
global $addon;
$db_params = $addon->callHook('db_params');
- $dbh = @mysql_connect($db_params['db_read_host'],$db_params['db_read_user'],$db_params['db_read_pass']);
+ $dbh = mysqli_connect($db_params['db_read_host'],$db_params['db_read_user'],$db_params['db_read_pass'],$db_params['db_read_name']);
if (!$dbh) {
errorLog("Failed attempt to connect to server - aborting.");
exitTo("/error.php?errNo=101301","error: 101301 - data server can not be found");
}
+ /*
$database = $db_params['db_read_name'];
if (isset($database)) {
if (!mysql_select_db($database)) {
@@ -33,7 +34,8 @@
exitTo("/error.php?errNo=101303","error: 101303 - unknown database name");
}
}
- # mysql_query("SET character_set_results=latin1", $dbh);
+ */
+ # mysqli_query($dbh, "SET character_set_results=latin1");
return $dbh;
}
diff --git a/classes/system/event_log.class.php b/classes/system/event_log.class.php
index fe93255..a3ebbf1 100755
--- a/classes/system/event_log.class.php
+++ b/classes/system/event_log.class.php
@@ -61,7 +61,7 @@
userid = " . sqlSanitize($User->userid, $dbh) . ",
created_on = NOW()";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
if(mysql_error() != "") {
echo "An unknown database error has occurred while logging information. Please contact the System Administrator.";
echo mysql_error();
diff --git a/classes/system/feature.class.php b/classes/system/feature.class.php
index 5eeb18c..b9b0ea8 100644
--- a/classes/system/feature.class.php
+++ b/classes/system/feature.class.php
@@ -54,7 +54,7 @@
WHERE project_id = \"". $project->id ."\"
AND version = \"". $project->version ."\"
AND language_id = " . $this->language->id;
- $project_pct_complete_result = mysql_query($sql);
+ $project_pct_complete_result = mysqli_query($sql);
if ($project_pct_complete_result and
(($project_pct_complete = mysql_fetch_assoc($project_pct_complete_result)) != null)) {
if (!isSet($pct)) {
@@ -292,10 +292,10 @@
AND s.non_translatable <> 1
AND v.train_id = '$train'
SQL;
- $result = mysql_query($sql);
+ $result = mysqli_query($sql);
$f = fopen("$this->output_dir/" . $this->filename() . ".csv", "w");
while (($row = mysql_fetch_assoc($result)) != null) {
- $value_row = mysql_fetch_assoc(mysql_query("SELECT value from translations where string_id = " . $row['string_id'] . " and language_id = " . $language));
+ $value_row = mysql_fetch_assoc(mysqli_query("SELECT value from translations where string_id = " . $row['string_id'] . " and language_id = " . $language));
$value = '';
if ($value_row != null) {
$value = $value_row['value'];
diff --git a/classes/system/fragment.class.php b/classes/system/fragment.class.php
index d7f2c63..db563a5 100644
--- a/classes/system/fragment.class.php
+++ b/classes/system/fragment.class.php
@@ -57,7 +57,7 @@
AND f.is_active
AND v.train_id = '" . $train->id . "'";
}
- $file_result = mysql_query($sql);
+ $file_result = mysqli_query($sql);
$plugins = array();
while (($file_row = mysql_fetch_assoc($file_result)) != null) {
$f = new File();
diff --git a/classes/system/language.class.php b/classes/system/language.class.php
index e1abde9..f184d2f 100644
--- a/classes/system/language.class.php
+++ b/classes/system/language.class.php
@@ -47,7 +47,7 @@
static function all() {
$langs = array();
- $language_result = mysql_query("SELECT * FROM languages WHERE languages.is_active ORDER BY name, locale");
+ $language_result = mysqli_query("SELECT * FROM languages WHERE languages.is_active ORDER BY name, locale");
while (($language_row = mysql_fetch_assoc($language_result)) != null) {
$langs[] = Language::fromRow($language_row);
}
diff --git a/classes/system/release_train.class.php b/classes/system/release_train.class.php
index bab1337..0648551 100644
--- a/classes/system/release_train.class.php
+++ b/classes/system/release_train.class.php
@@ -30,7 +30,7 @@
static function all() {
$trains = array();
- $train_result = mysql_query("SELECT DISTINCT train_id FROM release_train_projects");
+ $train_result = mysqli_query("SELECT DISTINCT train_id FROM release_train_projects");
while (($train_row = mysql_fetch_assoc($train_result)) != null) {
$trains[] = new ReleaseTrain($train_row['train_id']);
}
diff --git a/classes/system/scoreboard.class.php b/classes/system/scoreboard.class.php
index 38ffbb5..cf3a458 100644
--- a/classes/system/scoreboard.class.php
+++ b/classes/system/scoreboard.class.php
@@ -19,30 +19,30 @@
"WHERE itemid = 'LASGEN' " .
"AND quantity < (SELECT MAX(translation_id) as t FROM translations)";
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if(($result && mysql_num_rows($result) > 0) || $forceRefresh) {
# "lock" the scoreboard so that 2 clients don't update it simultaneously
- mysql_query("UPDATE scoreboard SET quantity = 9999999999 WHERE itemid = 'LASGEN'", $dbh);
+ mysqli_query($dbh, "UPDATE scoreboard SET quantity = 9999999999 WHERE itemid = 'LASGEN'");
# rebuilding the scoreboard takes time ... dump stuff to tmp
- mysql_query("CREATE TEMPORARY TABLE _tmp_scoreboard LIKE scoreboard", $dbh);
+ mysqli_query($dbh, "CREATE TEMPORARY TABLE _tmp_scoreboard LIKE scoreboard");
$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LANGPR', IF(ISNULL(b.locale),b.name,CONCAT(b.name, CONCAT(' (', CONCAT(b.locale, ')')))), count(a.string_id) as cnt from translations as a inner join languages as b on b.language_id = a.language_id where a.created_on > (NOW() - INTERVAL 1 YEAR) and a.value <> '' and a.is_active = 1 group by a.language_id order by cnt desc limit 20";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'TOPTR', CONCAT(first_name, IF(ISNULL(last_name),'',CONCAT(' ', last_name))), count(t.string_id) as cnt from translations as t inner join users as u on u.userid = t.userid where t.created_on > (NOW() - INTERVAL 1 YEAR) and t.value <> '' and t.is_active=1 group by first_name, last_name order by cnt desc limit 20";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LASGEN', 'Scoreboard Last Generated', MAX(translation_id) FROM translations";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LGNOW', 'Scoreboard Last Generated Date/Time', NOW()";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
- mysql_query("LOCK TABLES scoreboard WRITE", $dbh);
- mysql_query("DELETE FROM scoreboard", $dbh);
- mysql_query("INSERT INTO scoreboard SELECT * FROM _tmp_scoreboard", $dbh);
- mysql_query("UNLOCK TABLES", $dbh);
- mysql_query("DROP TABLE _tmp_scoreboard", $dbh);
+ mysqli_query($dbh, "LOCK TABLES scoreboard WRITE");
+ mysqli_query($dbh, "DELETE FROM scoreboard");
+ mysqli_query($dbh, "INSERT INTO scoreboard SELECT * FROM _tmp_scoreboard");
+ mysqli_query($dbh, "UNLOCK TABLES");
+ mysqli_query($dbh, "DROP TABLE _tmp_scoreboard");
}
}
}
diff --git a/classes/system/session.class.php b/classes/system/session.class.php
index f45fbd1..26a49f2 100644
--- a/classes/system/session.class.php
+++ b/classes/system/session.class.php
@@ -44,7 +44,7 @@
$sql = "SELECT id, userid, gid, subnet, updated_at FROM sessions WHERE gid = " . returnQuotedString($_gid);
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$rValue = true;
$myrow = mysql_fetch_assoc($result);
@@ -67,7 +67,7 @@
$sql = "UPDATE sessions SET updated_at = NOW() WHERE gid = " . returnQuotedString($_gid);
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
function destroy() {
@@ -75,7 +75,7 @@
if($cookie != "" && $this->load($cookie)) {
global $dbh;
$sql = "DELETE FROM sessions WHERE userid = " . $this->_userid;
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
setcookie(COOKIE_REMEMBER, "", -36000, "/");
session_destroy();
@@ -99,7 +99,7 @@
" . returnQuotedString($this->_gid) . ",
" . returnQuotedString($this->_subnet) . ",
NOW())";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$cookieTime = 0;
if($_remember) {
$cookieTime = time()+3600*24*365;
@@ -118,7 +118,7 @@
OR (userid = " . $this->_userid . "
AND subnet = " . returnQuotedString($this->getSubnet()) . "
AND gid <> " . returnQuotedString($this->_gid) . ")";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
function getSubnet() {
diff --git a/classes/system/user.class.php b/classes/system/user.class.php
index 79baa48..6692118 100755
--- a/classes/system/user.class.php
+++ b/classes/system/user.class.php
@@ -60,7 +60,7 @@
FROM
users
WHERE userid = $_userid";
- $result = mysql_query($sql, $dbh);
+ $result = mysqli_query($dbh, $sql);
if($result && mysql_num_rows($result) > 0) {
$rValue = true;
$myrow = mysql_fetch_assoc($result);