summaryrefslogtreecommitdiff
path: root/net/rtg/files/patch-etc-95.php
diff options
context:
space:
mode:
authorRaphael Kubo da Costa <rakuco@FreeBSD.org>2014-06-22 19:03:47 +0000
committerRaphael Kubo da Costa <rakuco@FreeBSD.org>2014-06-22 19:03:47 +0000
commitf3c5f1b571104d1f3028db44cb477ca72dca042f (patch)
tree2a35b1d94bf6aea6e98780fd2a6983ddc82d38d0 /net/rtg/files/patch-etc-95.php
parentUpdate to 1.5.0. (diff)
- Update to use PHP mysqli extensions (as mysql extension is deprecated
these days) - Fix runtime dependencies to pull in perl's DBI and DBD::mysql modules for target maker. - Add some options to pull in dependencies for mysql server and php web modules if needed. PR: 191276 Submitted by: Daniel Austin <freebsd-ports@dan.me.uk> (maintainer)
Notes
Notes: svn path=/head/; revision=358821
Diffstat (limited to 'net/rtg/files/patch-etc-95.php')
-rw-r--r--net/rtg/files/patch-etc-95.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/net/rtg/files/patch-etc-95.php b/net/rtg/files/patch-etc-95.php
new file mode 100644
index 000000000000..e6213745d75b
--- /dev/null
+++ b/net/rtg/files/patch-etc-95.php
@@ -0,0 +1,72 @@
+--- etc/95.php.orig 2014-06-22 15:27:55.587467922 +0100
++++ etc/95.php 2014-06-22 15:28:47.947474934 +0100
+@@ -4,10 +4,8 @@
+ print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
+
+ /* Connect to RTG MySQL Database */
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+ die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
+
+ if ($PHP_SELF == "") {
+ $PHP_SELF = "95.php";
+@@ -50,8 +48,8 @@
+ $max = $avg = $nintyfifth = 0;
+ $rate = array();
+
+- $selectResult=mysql_query($statement, $dbc);
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ $selectResult=mysqli_query($dbc, $statement);
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ $counter = $selectRow->counter;
+ $sample_secs = $selectRow->unixtime;
+ $total += $counter;
+@@ -89,9 +87,8 @@
+ <?php
+ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
+ if (($bt || $smonth)) {
+- $dbc=@mysql_connect ($host, $user, $pass) or
+- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
+- mysql_select_db($db,$dbc);
++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or
++ die ("MySQL Connection Failed, Check Configuration.");
+ /* Format into GNU date syntax */
+ if ($bt == "") {
+ $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
+@@ -104,11 +101,11 @@
+ $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
+
+ $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- if (mysql_num_rows($selectResult) <= 0)
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ if (mysqli_num_rows($selectResult) <= 0)
+ print "<BR>No Such Customer Found.<BR>\n";
+ else {
+- while ($selectRow=mysql_fetch_object($selectResult)){
++ while ($selectRow=mysqli_fetch_object($selectResult)){
+ $ids[$selectRow->id] = $selectRow->name;
+ $rids[$selectRow->id] = $selectRow->rid;
+ $desc[$selectRow->id] = $selectRow->description;
+@@ -127,8 +124,8 @@
+ foreach($ids as $iid=>$name) {
+
+ $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- $selectRow=mysql_fetch_object($selectResult);
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ $selectRow=mysqli_fetch_object($selectResult);
+ $router = $selectRow->name;
+
+ if ($yellow) $yellow = 0;
+@@ -201,7 +198,7 @@
+ echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
+ }
+
+- if ($dbc) mysql_close($dbc);
++ if ($dbc) mysqli_close($dbc);
+ echo "</FORM>\n";
+ ?>
+ <BR>