migrate /downloads to mysqli
Signed-off-by: Christopher Guindon <chris.guindon@eclipse-foundation.org>
diff --git a/clean_download_logs.php b/clean_download_logs.php
index e0dd639..5ffc7db 100755
--- a/clean_download_logs.php
+++ b/clean_download_logs.php
@@ -17,79 +17,79 @@
header("Content-type: text/plain");
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_rw.class.php";
require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection.class.php";
-
+
$app = new App();
-
-
+
+
$dbc_RW = new DBConnectionRW();
$dbh_RW = $dbc_RW->connect();
$dbc_RO = new DBConnection();
$dbh_RO = $dbc_RO->connect();
-
+
# Get the current downloads table
$SQL = "SELECT key_value FROM SYS_variables WHERE key_name = 'download_table'";
- $rs = mysql_query($SQL, $dbh_RW);
- $myrow = mysql_fetch_assoc($rs);
+ $rs = mysqli_query($dbh_RW, $SQL);
+ $myrow = mysqli_fetch_assoc($rs);
$download_table = "downloads" . $myrow['key_value'];
echo "Using " . $download_table . "\n";
# HAS TO BE ASCENDING@
$SQL = "SELECT * FROM download_file_index ORDER BY file_id ";
echo $SQL . "\n";
- $rs = mysql_query($SQL, $dbh_RW);
-
- while($myrow = mysql_fetch_assoc($rs)) {
+ $rs = mysqli_query($dbh_RW, $SQL);
+
+ while($myrow = mysqli_fetch_assoc($rs)) {
echo $myrow['file_id'] . " " . $myrow['file_name'];
-
+
# Find duplicate files
$SQL = "SELECT file_id from download_file_index where file_id > " . $myrow['file_id'] . " AND file_name = " . $app->returnQuotedString($myrow['file_name']);
- $rs2 = mysql_query($SQL, $dbh_RW) or die(mysql_error());
+ $rs2 = mysqli_query($dbh_RW, $SQL) or die(mysqli_error($dbh_RW));
$str_dupes = "";
- while($myrow2 = mysql_fetch_assoc($rs2)) {
+ while($myrow2 = mysqli_fetch_assoc($rs2)) {
if($str_dupes != "") {
$str_dupes .= ",";
}
$str_dupes .= $myrow2['file_id'];
}
-
+
if($str_dupes != "") {
echo "--> Dupes: " . $str_dupes . "\n\n";
# move downloads for the dupes
$SQL = "UPDATE downloads SET file_id = " . $myrow['file_id'] . " WHERE file_id IN ($str_dupes)";
echo $SQL . "\n";
- mysql_query($SQL, $dbh_RW);
+ mysqli_query($dbh_RW, $SQL);
$SQL = "UPDATE " . $download_table . " SET file_id = " . $myrow['file_id'] . " WHERE file_id IN ($str_dupes)";
echo $SQL . "\n";
- mysql_query($SQL, $dbh_RW);
+ mysqli_query($dbh_RW, $SQL);
$SQL = "DELETE FROM download_file_index where file_id IN ($str_dupes)";
echo $SQL . "\n";
- mysql_query($SQL, $dbh_RW);
+ mysqli_query($dbh_RW, $SQL);
}
-
+
$download_count = 0;
$SQL = "SELECT COUNT(*) AS RecordCount FROM downloads WHERE file_id = " . $myrow['file_id'];
- $rs2 = mysql_query($SQL, $dbh_RO) or die(mysql_error());
- $myrow2 = mysql_fetch_assoc($rs2);
+ $rs2 = mysqli_query($dbh_RO, $SQL) or die(mysqli_error($dbh_RO));
+ $myrow2 = mysqli_fetch_assoc($rs2);
$download_count += $myrow2['RecordCount'];
- echo " Download count main table: " . $download_count;
+ echo " Download count main table: " . $download_count;
$SQL = "SELECT COUNT(*) AS RecordCount FROM " . $download_table . " WHERE file_id = " . $myrow['file_id'];
- $rs2 = mysql_query($SQL, $dbh_RW) or die(mysql_error());
- $myrow2 = mysql_fetch_assoc($rs2);
+ $rs2 = mysqli_query($dbh_RW, $SQL) or die(mysqli_error($dbh_RW));
+ $myrow2 = mysqli_fetch_assoc($rs2);
$download_count += $myrow2['RecordCount'];
echo " Download count table $download_table : " . $myrow2['RecordCount'];
-
+
echo " TOTAL: " . $download_count . "\n";
$SQL = "UPDATE download_file_index SET download_count = " . $download_count . " WHERE file_id = " . $myrow['file_id'];
- mysql_query($SQL, $dbh_RW);
-
-
-
+ mysqli_query($dbh_RW, $SQL);
+
+
+
if($download_count == 0) {
$SQL = "DELETE FROM download_file_index WHERE file_id = " . $myrow['file_id'];
echo "----->" . $SQL . "\n";
- $rs3 = mysql_query($SQL, $dbh_RW);
+ $rs3 = mysqli_query($dbh_RW, $SQL);
}
}
diff --git a/content/en_download.php b/content/en_download.php
index 16ba432..15f02db 100644
--- a/content/en_download.php
+++ b/content/en_download.php
@@ -45,8 +45,8 @@
# Bug 544049 - Support GeoLite2
# For now, we'll show the first mirror as "preferred" even if we don't know the country.
-# if ($_country_code != "xx" && $myrow = mysql_fetch_assoc($rs)) {
-if ($myrow = mysql_fetch_assoc($rs)) {
+# if ($_country_code != "xx" && $myrow = mysqli_fetch_assoc($rs)) {
+if ($myrow = mysqli_fetch_assoc($rs)) {
// Preferred mirror
$download_link['url'] .= "&mirror_id=" . $myrow['mirror_id'];
$download_link['text'] = '' . $myrow['country_desc'] .' - ' . $myrow['organization'] .' (' . $myrow['protocol'] . ')';
@@ -66,7 +66,7 @@
$mirrors_internal = array();
$mirrors = array();
-while ($myrow = mysql_fetch_assoc($rs)) {
+while ($myrow = mysqli_fetch_assoc($rs)) {
$mirror_link = array();
$internal_mirror_flag = FALSE;
if (!is_numeric(array_search($myrow['mirror_id'], $mirror_id_list))) {
diff --git a/content/en_mir_list_plain.php b/content/en_mir_list_plain.php
index 80c3c19..fca69dd 100755
--- a/content/en_mir_list_plain.php
+++ b/content/en_mir_list_plain.php
@@ -12,7 +12,7 @@
*******************************************************************************/
-while ($myrow = mysql_fetch_assoc($rs)) {
+while ($myrow = mysqli_fetch_assoc($rs)) {
echo $myrow['base_path'] . $_file . "\n";
}
?>
diff --git a/content/en_mir_list_xml.php b/content/en_mir_list_xml.php
index f5ba3ac..55af941 100755
--- a/content/en_mir_list_xml.php
+++ b/content/en_mir_list_xml.php
@@ -1,7 +1,7 @@
<?php
#*****************************************************************************
#
- # en_mir_list.php
+ # en_mir_list.php
#
# Author: Denis Roy
# Date: 2004-11-20
@@ -10,7 +10,7 @@
#
# HISTORY:
# - 2004-11-25: removed the <mirrors> and </mirrors> markers because platform
- # team did not want well-formed xml
+ # team did not want well-formed xml
#
#****************************************************************************
@@ -22,12 +22,12 @@
echo "<mirrors>";
?>
<?php
- while ($myrow = mysql_fetch_assoc($rs)) {
+ while ($myrow = mysqli_fetch_assoc($rs)) {
$path = $myrow['base_path'] . $_file;
?>
<mirror url="<?= $path ?>" label="[<?= $myrow['country_desc'] ?>] <?= str_replace("&", "&", $myrow['organization']) ?> (<?= $myrow['protocol'] ?>)" />
<?php
}
-
+
echo "</mirrors>";
?>
diff --git a/content/en_mir_request.php b/content/en_mir_request.php
index 0e874b5..6511e53 100644
--- a/content/en_mir_request.php
+++ b/content/en_mir_request.php
@@ -114,7 +114,7 @@
<option value="XX">Please select a country</option>
EOHTML;
- while ($myrow = mysql_fetch_assoc($rs_country)) {
+ while ($myrow = mysqli_fetch_assoc($rs_country)) {
$html .= "<option value='" . $myrow["ccode"] . "'>" . $myrow["en_description"] . "</option>";
}
$html .= <<<EOHTML
diff --git a/download.php b/download.php
index c15379e..9a137d3 100755
--- a/download.php
+++ b/download.php
@@ -234,8 +234,8 @@
if($_file_id > 0) {
if($Friend->getIsCommitter()) {
$sql = "SELECT file_name FROM download_file_index WHERE file_id = " . $app->sqlSanitize($_file_id);
- $rs = mysql_query($sql, $dbh);
- if($myrow = mysql_fetch_assoc($rs)) {
+ $rs = mysqli_query($dbh, $sql);
+ if($myrow = mysqli_fetch_assoc($rs)) {
$file_name = $app->getDownloadBasePath() . $myrow['file_name'];
if(file_exists($file_name)) {
@@ -292,9 +292,9 @@
echo $sql . "<br />";
}
# Get the file_id from the slave, but if the file_id is 0, then re-check the master just in case
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
- if($myrow = mysql_fetch_assoc($rs)) {
+ if($myrow = mysqli_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$filetime = $myrow['timestamp_disk'];
$md5sum = $myrow['md5sum'];
@@ -307,15 +307,15 @@
echo "This is a new file. Checking the Master DB.<br />";
}
# Lock tables for write
- $rs = mysql_query("LOCK TABLES download_file_index WRITE, downloads READ, $log_download_table READ, mirrors READ, mirror_protocols READ, mirror_drops READ, drops READ, SYS_countries READ, SYS_continents READ, SYS_countries READ, mirror_trends READ, SYS_variables READ", $dbh_RW);
- $rs = mysql_query($sql, $dbh_RW);
- if($myrow = mysql_fetch_assoc($rs)) {
+ $rs = mysqli_query($dbh_RW, "LOCK TABLES download_file_index WRITE, downloads READ, $log_download_table READ, mirrors READ, mirror_protocols READ, mirror_drops READ, drops READ, SYS_countries READ, SYS_continents READ, SYS_countries READ, mirror_trends READ, SYS_variables READ");
+ $rs = mysqli_query($dbh_RW, $sql);
+ if($myrow = mysqli_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$filetime = $myrow['timestamp_disk'];
$md5sum = $myrow['md5sum'];
$sha1sum = $myrow['sha1sum'];
$sha512sum = $myrow['sha512sum'];
- mysql_query("UNLOCK TABLES", $dbh_RW);
+ mysqli_query($dbh_RW, "UNLOCK TABLES");
}
}
@@ -384,8 +384,8 @@
}
$sql = "SELECT key_value FROM SYS_variables WHERE key_name = 'download_table' LIMIT 1";
- $rs = mysql_query($sql, $dbh);
- if($myrow = mysql_fetch_assoc($rs)) {
+ $rs = mysqli_query($dbh, $sql);
+ if($myrow = mysqli_fetch_assoc($rs)) {
$key_value = $myrow['key_value'];
}
if($_debug == 1) {
@@ -459,9 +459,9 @@
# Bypass the whole mirror SQL if we can't pick a mirror for this file
$rs;
if(!$no_mirror && $_mirror_id != 1) { #mirror_id 1 is download
- $rs = mysql_query($mirrorListSQL, $dbh);
- $myrow = mysql_fetch_assoc($rs);
- mysql_data_seek ($rs, 0);
+ $rs = mysqli_query($dbh, $mirrorListSQL);
+ $myrow = mysqli_fetch_assoc($rs);
+ mysqli_data_seek($rs, 0);
$_url = $myrow['base_path']. $_file;
if($_redirect == 1) {
$_mirror_id = $myrow['mirror_id'];
@@ -484,7 +484,7 @@
$random = rand(1, 100);
# download from eclipse.org
- if($random <= $our_download_percentage || $no_mirror || mysql_num_rows($rs) == 0) {
+ if($random <= $our_download_percentage || $no_mirror || mysqli_num_rows($rs) == 0) {
$_mirror_id = 1;
$_url = $app->getPubDownloadServerUrl() . $_file;
}
@@ -506,8 +506,8 @@
# Throttle the amount of downloads we count (and redirect to) to prevent ballot stuffers
$sql = "SELECT file_id, COUNT(1) AS cnt FROM $log_download_table WHERE remote_addr = '$ip' AND download_date > DATE_SUB(NOW(), INTERVAL 1 MINUTE) GROUP BY file_id, remote_addr HAVING cnt > " . MAX_DOWNLOADS_PER_MINUTE;
- $rs = mysql_query($sql, $dbh);
- if($myrow = mysql_fetch_assoc($rs)) {
+ $rs = mysqli_query($dbh, $sql);
+ if($myrow = mysqli_fetch_assoc($rs)) {
include("content/en_too_many_downloads.php");
}
else {
@@ -539,19 +539,19 @@
$sql = "INSERT DELAYED INTO $log_download_table (file_id, download_date, remote_host, remote_addr, mirror_id, ccode)
VALUES ( $file_id, NOW(), '$client_hostname', '$ip', $_mirror_id, '$_country_code') ";
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
$string = "";
if($filetime_update) {
$string = ", timestamp_disk = $filetime";
}
$sql = "UPDATE LOW_PRIORITY download_file_index SET download_count = download_count + 1 " . $string . " WHERE file_id = " . $file_id;
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
}
}
if($_debug == 1) {
- echo $sql . mysql_error() . "<br />";
+ echo $sql . mysqli_error($dbh_RW) . "<br />";
}
}
else {
@@ -680,10 +680,10 @@
if($_debug == 1) {
echo $sql . "<br />";
}
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
$sql = "UPDATE LOW_PRIORITY download_file_index SET download_count = download_count + 1 WHERE file_id = " . $in_file_id;
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
}
}
@@ -694,9 +694,9 @@
if($in_file != "") {
$sql = "INSERT INTO download_file_index (file_id, file_name, download_count, timestamp_disk, size_disk_bytes)
VALUES (NULL, '" . $app->sqlSanitize($in_file, $dbh_RW) . "', 0, $filetime, $filesize)";
- $rs = mysql_query($sql, $dbh_RW);
- $inserted_id = mysql_insert_id($dbh_RW);
- mysql_query("UNLOCK TABLES", $dbh_RW);
+ $rs = mysqli_query($dbh_RW, $sql);
+ $inserted_id = mysqli_insert_id($dbh_RW);
+ mysqli_query($dbh_RW, "UNLOCK TABLES");
return $inserted_id;
}
else {
diff --git a/mir_request.php b/mir_request.php
index 804dcd1..a852e23 100755
--- a/mir_request.php
+++ b/mir_request.php
@@ -99,8 +99,8 @@
" . $App->returnQuotedString("wait") . ",
" . $App->returnQuotedString($_POST['contact']) . ")
";
- mysql_query($sql, $dbh);
- $mirror_id = mysql_insert_id();
+ mysqli_query($dbh, $sql);
+ $mirror_id = mysqli_insert_id($dbh);
// add protocols.
if ($_POST["http_browserlink"] != "") {
@@ -114,7 +114,7 @@
" . $App->returnQuotedString("https") . ",
" . $App->returnQuotedString($_POST['http_browserlink']) . ")
";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
$drop_list = $_POST["drop_id"];
foreach (split(",", $drop_list) as $drop) {
@@ -127,7 +127,7 @@
" . $mirror_id . ",
" . $App->returnQuotedString("EclipseFull") . ",
" . $App->returnQuotedString("https") . ")";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
}
// Place cookie on browser to avoid having multiple submissions
@@ -162,7 +162,7 @@
ORDER BY DRP.sort_order
";
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
$sql = "SELECT
ccode,
@@ -171,7 +171,7 @@
ORDER BY en_description
";
- $rs_country = mysql_query($sql, $dbh);
+ $rs_country = mysqli_query($dbh, $sql);
}
// Place your html content in a file called content/en_pagename.php
diff --git a/mir_trend.php b/mir_trend.php
index a41c372..21a16fa 100644
--- a/mir_trend.php
+++ b/mir_trend.php
@@ -45,8 +45,8 @@
$valid_file = false;
$sql = "SELECT file_name, IF(size_disk_bytes BETWEEN 2000000 AND 5000000, 1, 0) AS ideal_size, IF(size_disk_bytes BETWEEN 250000 AND 10000000, 1, 0) AS almost_ideal_size, size_disk_bytes
FROM download_file_index WHERE timestamp_disk > 0 order by ideal_size*RAND() desc, almost_ideal_size*RAND() desc, size_disk_bytes asc limit 100";
- $rs_idx = mysql_query($sql, $dbh);
- while($myrow_idx = mysql_fetch_assoc($rs_idx)) {
+ $rs_idx = mysqli_query($dbh, $sql);
+ while($myrow_idx = mysqli_fetch_assoc($rs_idx)) {
$drop_list['EclipseFull']['filename'] = $myrow_idx['file_name'];
$drop_list['EclipseFull']['size_disk_bytes'] = $myrow_idx['size_disk_bytes'];
@@ -68,14 +68,14 @@
# Go through mirrors
- $sql = "SELECT DISTINCT MIR.mirror_id, MRP.base_path, DRP.our_path
+ $sql = "SELECT DISTINCT MIR.mirror_id, MRP.base_path, DRP.our_path
FROM mirrors AS MIR INNER JOIN mirror_protocols AS MRP on MRP.mirror_id = MIR.mirror_id
- INNER JOIN (SELECT mirror_id, protocol, drop_id from mirror_drops group by mirror_id, protocol) MRD ON MRD.mirror_id = MIR.mirror_id
+ INNER JOIN (SELECT mirror_id, protocol, drop_id from mirror_drops group by mirror_id, protocol) MRD ON MRD.mirror_id = MIR.mirror_id
INNER JOIN drops AS DRP ON DRP.drop_id = MRD.drop_id AND MRD.drop_id = 'EclipseFull'
WHERE MIR.is_internal <> 1 AND MIR.is_advertise = 1 AND MRP.protocol = 'http' AND MIR.create_status IN('active', 'wait') ORDER BY mirror_id";
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
- while($myrow = mysql_fetch_assoc($rs)) {
+ while($myrow = mysqli_fetch_assoc($rs)) {
$mirror_url = $myrow['base_path'] . $drop_list['EclipseFull']['filename'];
if(php_sapi_name() != "cli") {
@@ -93,11 +93,11 @@
$download_speed = 0;
$curl_info['http_code'] = "999";
}
- $sql = "INSERT INTO mirror_trends (trend_id, mirror_id, sample_date, http_status_code, download_speed_kbps, fetched_url, fetched_size_bytes)
+ $sql = "INSERT INTO mirror_trends (trend_id, mirror_id, sample_date, http_status_code, download_speed_kbps, fetched_url, fetched_size_bytes)
VALUES (NULL, " . $myrow['mirror_id'] . ", NOW(), " . $curl_info['http_code'] . ", " . $curl_info['speed_download'] / 1024 . ", '$mirror_url', " . $curl_info['size_download'] . ")";
}
else {
- $sql = "INSERT INTO mirror_trends (trend_id, mirror_id, sample_date, http_status_code, download_speed_kbps)
+ $sql = "INSERT INTO mirror_trends (trend_id, mirror_id, sample_date, http_status_code, download_speed_kbps)
VALUES (NULL, " . $myrow['mirror_id'] . ", NOW(), " . $curl_info . ", 0)";
$total_errors++;
}
@@ -108,31 +108,31 @@
# Examine all the trends for this mirror
# mark as dropped if they have 0% success overall
$sql = "SELECT SUM(IF(http_status_code BETWEEN 200 AND 299, 1, 0)) / COUNT(trend_id) * 100 AS success_rate, COUNT(trend_id) AS trend_count FROM mirror_trends where mirror_id = " . $myrow['mirror_id'];
- $rs_trd = mysql_query($sql, $dbh);
- if($myrow_trd = mysql_fetch_assoc($rs_trd)) {
+ $rs_trd = mysqli_query($dbh, $sql);
+ if($myrow_trd = mysqli_fetch_assoc($rs_trd)) {
echo "Overall success rate for this mirror: " . $myrow_trd['success_rate'] . "\n";
if($myrow_trd['success_rate'] == 0 && $myrow_trd['trend_count'] > 0) {
echo "Dropping mirror " . $myrow['mirror_id'] . "\n";
- mysql_query("UPDATE mirrors SET create_status = 'dropped' WHERE mirror_id = " . $myrow['mirror_id'], $dbh);
+ mysqli_query($dbh, "UPDATE mirrors SET create_status = 'dropped' WHERE mirror_id = " . $myrow['mirror_id']);
}
}
# mark as wait if they have 0% success in the last 12 hours
# or mark back to active if 100%
# HAVING clause to prevent bug 474570
- $sql = "SELECT /*mir_trend:123 */ SUM(IF(http_status_code BETWEEN 200 AND 299, 1, 0)) / COUNT(trend_id) * 100 AS success_rate
+ $sql = "SELECT /*mir_trend:123 */ SUM(IF(http_status_code BETWEEN 200 AND 299, 1, 0)) / COUNT(trend_id) * 100 AS success_rate
FROM mirror_trends where mirror_id = " . $myrow['mirror_id']
. " AND sample_date > date_sub(now(), interval 12 hour) HAVING success_rate IS NOT NULL";
- $rs_trd = mysql_query($sql, $dbh);
- if($myrow_trd = mysql_fetch_assoc($rs_trd)) {
+ $rs_trd = mysqli_query($dbh, $sql);
+ if($myrow_trd = mysqli_fetch_assoc($rs_trd)) {
echo "Last 12h success rate for this mirror: " . $myrow_trd['success_rate'] . "\n";
if($myrow_trd['success_rate'] == 0) {
echo "Supending (wait) mirror " . $myrow['mirror_id'] . "\n";
- mysql_query("UPDATE mirrors SET create_status = 'wait' WHERE mirror_id = " . $myrow['mirror_id'], $dbh);
+ mysqli_query($dbh, "UPDATE mirrors SET create_status = 'wait' WHERE mirror_id = " . $myrow['mirror_id']);
}
elseif ($myrow_trd['success_rate'] == 100) {
echo "Unsupending (active) mirror " . $myrow['mirror_id'] . " if needed.\n";
- mysql_query("UPDATE mirrors SET create_status = 'active' WHERE mirror_id = " . $myrow['mirror_id'] . " AND create_status = 'wait'", $dbh);
+ mysqli_query($dbh, "UPDATE mirrors SET create_status = 'active' WHERE mirror_id = " . $myrow['mirror_id'] . " AND create_status = 'wait'");
}
}
}
@@ -144,12 +144,12 @@
if($error_rate < 75) {
echo "Adding trends to the database\n";
foreach ($sql_array as $sql) {
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
# maintenance
$sql = "DELETE FROM mirror_trends where sample_date < DATE_SUB(NOW(), INTERVAL 1 MONTH)";
- mysql_query($sql, $dbh);
+ mysqli_query($dbh, $sql);
}
}
diff --git a/sums.php b/sums.php
index f929413..d739298 100755
--- a/sums.php
+++ b/sums.php
@@ -79,9 +79,9 @@
echo $sql . "<br />";
}
# Get the file_id from the slave, but if the file_id is 0, then re-check the master just in case
- $rs = mysql_query($sql, $dbh);
+ $rs = mysqli_query($dbh, $sql);
- if($myrow = mysql_fetch_assoc($rs)) {
+ if($myrow = mysqli_fetch_assoc($rs)) {
$file_id = $myrow['file_id'];
$filetime = $myrow['timestamp_disk'];
$md5sum = $myrow['md5sum'];
@@ -99,7 +99,7 @@
# lock table so no one else thinks the sums are out of whack for this file
$sql = "LOCK TABLES download_file_index WRITE";
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
$md5sum = md5_file($file_absolute_path);
$sha1sum = sha1_file($file_absolute_path);
@@ -111,7 +111,7 @@
$str = "timestamp_disk = '$filetime_disk', ";
}
$sql = "UPDATE download_file_index SET $str md5sum = '$md5sum', sha1sum = '$sha1sum', sha512sum = '$sha512sum' WHERE file_id = " . $file_id;
- mysql_query($sql, $dbh_RW);
+ mysqli_query($dbh_RW, $sql);
if($_debug == 1) {
echo $sql . "<br />";
@@ -120,7 +120,7 @@
else {
echo "Unable to calculate sums for this file (3122).";
}
- mysql_query("UNLOCK TABLES", $dbh_RW);
+ mysqli_query($dbh_RW, "UNLOCK TABLES");
}
@@ -135,7 +135,7 @@
if($_type == "sha512") {
echo $sha512sum . " " . $filename_fileonly;
}
- }
+ }
elseif ( $update_ts === false ) {
#file is on archive so generate from there, but only the sum type being requested.
$hash = "(3119) Couldn't compute hash value for";