Use slave for download counts.
Signed-off-by: droy <denis.roy@eclipse.org>
diff --git a/clean_download_logs.php b/clean_download_logs.php
index 72fe523..b732b35 100755
--- a/clean_download_logs.php
+++ b/clean_download_logs.php
@@ -10,18 +10,21 @@
# Description: Clean download logs.
#
#*****************************************************************************
-
+
# Note: run this from wget
exit;
error_reporting(E_ALL); ini_set("display_errors", true);
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'";
@@ -66,7 +69,7 @@
$download_count = 0;
$SQL = "SELECT COUNT(*) AS RecordCount FROM downloads WHERE file_id = " . $myrow['file_id'];
- $rs2 = mysql_query($SQL, $dbh_RW);
+ $rs2 = mysql_query($SQL, $dbh_RO);
$myrow2 = mysql_fetch_assoc($rs2);
$download_count += $myrow2['RecordCount'];
echo " Download count main table: " . $download_count;