FreeBSD Bugzilla – Attachment 144029 Details for
Bug 191276
[maintainer-update] net/rtg: update to use mysqli and fix some dependancies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
20140622-rtg.diff
20140622-rtg.diff (text/plain), 12.95 KB, created by
Daniel Austin
on 2014-06-22 15:30:59 UTC
(
hide
)
Description:
20140622-rtg.diff
Filename:
MIME Type:
Creator:
Daniel Austin
Created:
2014-06-22 15:30:59 UTC
Size:
12.95 KB
patch
obsolete
>diff -ruN net/rtg.orig/Makefile net/rtg/Makefile >--- net/rtg.orig/Makefile 2014-06-15 10:17:57.000000000 +0100 >+++ net/rtg/Makefile 2014-06-22 15:41:11.958474628 +0100 >@@ -3,7 +3,7 @@ > > PORTNAME= rtg > PORTVERSION= 0.7.4 >-PORTREVISION= 10 >+PORTREVISION= 11 > CATEGORIES= net > MASTER_SITES= SF \ > ftp://ftpmirror.uk/freebsd-ports/rtg/ >@@ -14,6 +14,8 @@ > LICENSE= GPLv2 > > LIB_DEPENDS= libnetsnmp.so:${PORTSDIR}/net-mgmt/net-snmp >+RUN_DEPENDS= p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \ >+ p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql > > USE_RC_SUBR= rtgpoll > USE_MYSQL= yes >@@ -25,6 +27,21 @@ > CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME} \ > --with-mysql=${LOCALBASE} \ > --with-snmp=${LOCALBASE} >+OPTIONS_DEFINE= WEB MYSQL >+OPTIONS_DEFAULT=WEB >+MYSQL_DESC= Pull MySQL server in as a dependancy for local setups >+WEB_DESC= Include PHP-based web client interface pre-requisites >+ >+.include <bsd.port.options.mk> >+ >+.if ${PORT_OPTIONS:MMYSQL} >+USE_MYSQL= server >+.endif >+ >+.if ${PORT_OPTIONS:MWEB} >+WANT_PHP_WEB= yes >+USE_PHP= mysqli spl >+.endif > > .include <bsd.port.pre.mk> > >diff -ruN net/rtg.orig/files/patch-etc-95.php net/rtg/files/patch-etc-95.php >--- net/rtg.orig/files/patch-etc-95.php 1970-01-01 01:00:00.000000000 +0100 >+++ net/rtg/files/patch-etc-95.php 2014-06-22 15:29:05.797463617 +0100 >@@ -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> >diff -ruN net/rtg.orig/files/patch-etc-rtg.php net/rtg/files/patch-etc-rtg.php >--- net/rtg.orig/files/patch-etc-rtg.php 2014-01-22 17:40:44.000000000 +0000 >+++ net/rtg/files/patch-etc-rtg.php 2014-06-22 15:27:22.389470326 +0100 >@@ -1,6 +1,82 @@ >---- etc/rtg.php.orig 2010-07-04 03:49:22.836351752 +0100 >-+++ etc/rtg.php 2010-07-04 03:54:55.955519331 +0100 >-@@ -171,6 +171,9 @@ >+--- etc/rtg.php.orig 2003-09-24 21:42:03.000000000 +0100 >++++ etc/rtg.php 2014-06-22 15:25:22.471477252 +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 = "rtg.php"; >+@@ -37,17 +35,17 @@ >+ # Determine router, interface names as necessary >+ if ($rid && $iid) { >+ $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid[0]"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $selectRow=mysql_fetch_object($selectResult); >+- $interfaces = mysql_num_rows($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $selectRow=mysqli_fetch_object($selectResult); >++ $interfaces = mysqli_num_rows($selectResult); >+ $name = $selectRow->name; >+ $description = $selectRow->description; >+ $speed = ($selectRow->speed)/1000000; >+ $router = $selectRow->router; >+ } else if ($rid && !$iid) { >+ $selectQuery="SELECT name AS router from router where rid=$rid"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $selectRow=mysql_fetch_object($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $selectRow=mysqli_fetch_object($selectResult); >+ $router = $selectRow->router; >+ } >+ >+@@ -71,8 +69,8 @@ >+ if (!$rid && !$iid) { >+ echo "<SELECT NAME=\"rid\" SIZE=10>\n"; >+ $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- while ($selectRow=mysql_fetch_object($selectResult)){ >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ while ($selectRow=mysqli_fetch_object($selectResult)){ >+ echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n"; >+ } >+ echo "</SELECT>\n"; >+@@ -91,8 +89,8 @@ >+ >+ echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; >+ $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- while ($selectRow=mysql_fetch_object($selectResult)){ >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ while ($selectRow=mysqli_fetch_object($selectResult)){ >+ echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n"; >+ } >+ echo "</SELECT>\n"; >+@@ -152,8 +150,8 @@ >+ $range="$range AND id=$iid[0]"; >+ >+ $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $selectRow=mysql_fetch_object($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $selectRow=mysqli_fetch_object($selectResult); >+ echo "<TABLE BORDER=0>\n"; >+ echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n"; >+ echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n"; >+@@ -165,12 +163,15 @@ >+ echo "<P>\n"; >+ >+ #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range"; >+- #$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 Data Found on Interface for Given Range.<BR>\n"; > #} > #else { > $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8"; >@@ -10,7 +86,7 @@ > foreach ($iid as $value) { > $args="$args&iid=$value"; > } >-@@ -181,8 +184,11 @@ >+@@ -181,8 +182,11 @@ > if ($borderb) $args = "$args&borderb=$borderb"; > if ($aggr) $args = "$args&aggr=yes"; > if ($percentile) $args = "$args&percentile=$nth"; >@@ -23,7 +99,7 @@ > foreach ($iid as $value) { > $args="$args&iid=$value"; > } >-@@ -192,9 +198,13 @@ >+@@ -192,13 +196,17 @@ > if ($borderb) $args = "$args&borderb=$borderb"; > if ($aggr) $args = "$args&aggr=yes"; > if ($percentile) $args = "$args&percentile=$nth"; >@@ -39,3 +115,8 @@ > # } > } > >+-mysql_close($dbc); >++mysqli_close($dbc); >+ ?> >+ >+ <P> >diff -ruN net/rtg.orig/files/patch-etc-view.php net/rtg/files/patch-etc-view.php >--- net/rtg.orig/files/patch-etc-view.php 2014-01-22 17:40:44.000000000 +0000 >+++ net/rtg/files/patch-etc-view.php 2014-06-22 15:27:35.418468239 +0100 >@@ -1,6 +1,57 @@ >---- etc/view.php.orig 2010-07-04 03:55:12.757175355 +0100 >-+++ etc/view.php 2010-07-04 03:59:40.479683639 +0100 >-@@ -95,19 +95,22 @@ >+--- etc/view.php.orig 2003-09-26 16:58:34.000000000 +0100 >++++ etc/view.php 2014-06-22 15:24:14.720483023 +0100 >+@@ -11,10 +11,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); >+ >+ # Global variables off by default in newer versions of PHP >+ if (!$PHP_SELF) { >+@@ -26,17 +24,17 @@ >+ # Determine router, interface names as necessary >+ if ($rid && $iid) { >+ $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $selectRow=mysql_fetch_object($selectResult); >+- $interfaces = mysql_num_rows($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $selectRow=mysqli_fetch_object($selectResult); >++ $interfaces = mysqli_num_rows($selectResult); >+ $name = $selectRow->name; >+ $description = $selectRow->description; >+ $speed = ($selectRow->speed)/1000000; >+ $router = $selectRow->router; >+ } else if ($rid && !$iid) { >+ $selectQuery="SELECT name AS router from router where rid=$rid"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $selectRow=mysql_fetch_object($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $selectRow=mysqli_fetch_object($selectResult); >+ $router = $selectRow->router; >+ } >+ >+@@ -68,12 +66,12 @@ >+ if (!$rid) { >+ print "Monitored Devices: <P>\n"; >+ $selectQuery="SELECT rid, name FROM router"; >+- $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 Routers Found.<BR>\n"; >+ else { >+ print "<UL>\n"; >+- while ($selectRow=mysql_fetch_object($selectResult)){ >++ while ($selectRow=mysqli_fetch_object($selectResult)){ >+ print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">"; >+ print "$selectRow->name</A><BR>\n"; >+ } >+@@ -95,19 +93,22 @@ > > $bt = $et - (60*60*24); > print "<B>Day View:</B><BR>\n"; >@@ -26,7 +77,24 @@ > print "<BR><B>$router: $name ($description)</B>\n"; > print "<BR><BR>\n"; > } >-@@ -134,7 +137,10 @@ >+@@ -116,8 +117,8 @@ >+ >+ if ($rid && !$iid) { >+ $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid"; >+- $selectResult=mysql_query($selectQuery, $dbc); >+- $interfaces = mysql_num_rows($selectResult); >++ $selectResult=mysqli_query($dbc, $selectQuery); >++ $interfaces = mysqli_num_rows($selectResult); >+ if ($interfaces <= 0) >+ print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n"; >+ else { >+@@ -129,12 +130,15 @@ >+ print gmdate('D, d M Y H:i:s \G\M\T', time())."\n"; >+ print "</TABLE><HR>\n"; >+ print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n"; >+- while ($selectRow=mysql_fetch_object($selectResult)){ >++ while ($selectRow=mysqli_fetch_object($selectResult)){ >+ $ids[$selectRow->id] = $selectRow->name; > $desc[$selectRow->id] = $selectRow->description; > $iid = $selectRow->id; > print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n"; >@@ -38,3 +106,12 @@ > print "</A><BR>\n"; > print "<B>$selectRow->name ($selectRow->description)</B>\n"; > if ($even) { >+@@ -148,7 +152,7 @@ >+ print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n"; >+ } >+ >+- if ($dbc) mysql_close($dbc); >++ if ($dbc) mysqli_close($dbc); >+ echo "</FORM>\n"; >+ ?> >+ >--- 20140622-rtg.diff ends here ---
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 191276
:
144029
|
144037