Fixes for PHP7
This commit is contained in:
parent
079aca3816
commit
c793bfa679
11
cacti-mysqli.patch
Normal file
11
cacti-mysqli.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- cacti-0.8.8h/include/config.php.orig 2016-02-07 20:26:54.000000000 +0100
|
||||||
|
+++ cacti-0.8.8h/include/config.php 2017-01-18 15:51:15.979783797 +0100
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* make sure these values refect your actual database/host/user/password */
|
||||||
|
-$database_type = "mysql";
|
||||||
|
+$database_type = "mysqli";
|
||||||
|
$database_default = "cacti";
|
||||||
|
$database_hostname = "localhost";
|
||||||
|
$database_username = "cactiuser";
|
163
cacti-php7.patch
Normal file
163
cacti-php7.patch
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
diff -aur cacti/install/index.php cacti-PHP7/install/index.php
|
||||||
|
--- cacti/install/index.php 2016-02-07 20:26:54.000000000 +0100
|
||||||
|
+++ cacti-PHP7/install/index.php 2016-02-24 22:33:10.713574142 +0100
|
||||||
|
@@ -63,7 +63,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
function verify_php_extensions() {
|
||||||
|
- $extensions = array("session", "sockets", "mysql", "xml");
|
||||||
|
+ $extensions = array("session", "sockets", "pdo_mysql", "xml");
|
||||||
|
$ok = true;
|
||||||
|
$missing_extension = " <p style='font-family: Verdana, Arial; font-size: 16px; font-weight: bold; color: red;'>Error</p>
|
||||||
|
<p style='font-family: Verdana, Arial; font-size: 12px;'>The following PHP extensions are missing:</p><ul>";
|
||||||
|
diff -aur cacti/lib/adodb/adodb.inc.php cacti-PHP7/lib/adodb/adodb.inc.php
|
||||||
|
--- cacti/lib/adodb/adodb.inc.php 2010-08-21 17:03:22.000000000 +0200
|
||||||
|
+++ cacti-PHP7/lib/adodb/adodb.inc.php 2016-02-24 22:19:33.915880478 +0100
|
||||||
|
@@ -863,13 +863,13 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->_queryID === true) { // return simplified recordset for inserts/updates/deletes with lower overhead
|
||||||
|
- $rs =& new ADORecordSet_empty();
|
||||||
|
+ $rs = new ADORecordSet_empty();
|
||||||
|
return $rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return real recordset from select statement
|
||||||
|
$rsclass = $this->rsPrefix.$this->databaseType;
|
||||||
|
- $rs =& new $rsclass($this->_queryID,$this->fetchMode);
|
||||||
|
+ $rs = new $rsclass($this->_queryID,$this->fetchMode);
|
||||||
|
$rs->connection = &$this; // Pablo suggestion
|
||||||
|
$rs->Init();
|
||||||
|
if (is_array($sql)) $rs->sql = $sql[0];
|
||||||
|
@@ -1180,7 +1180,7 @@
|
||||||
|
|
||||||
|
$arrayClass = $this->arrayClass;
|
||||||
|
|
||||||
|
- $rs2 =& new $arrayClass();
|
||||||
|
+ $rs2 = new $arrayClass();
|
||||||
|
$rs2->connection = &$this;
|
||||||
|
$rs2->sql = $rs->sql;
|
||||||
|
$rs2->dataProvider = $this->dataProvider;
|
||||||
|
@@ -1958,7 +1958,7 @@
|
||||||
|
|
||||||
|
$retarr = array();
|
||||||
|
while (!$rs->EOF) { //print_r($rs->fields);
|
||||||
|
- $fld =& new ADOFieldObject();
|
||||||
|
+ $fld = new ADOFieldObject();
|
||||||
|
$fld->name = $rs->fields[0];
|
||||||
|
$fld->type = $rs->fields[1];
|
||||||
|
if (isset($rs->fields[3]) && $rs->fields[3]) {
|
||||||
|
@@ -3024,7 +3024,7 @@
|
||||||
|
function &FetchObject($isupper=true)
|
||||||
|
{
|
||||||
|
if (empty($this->_obj)) {
|
||||||
|
- $this->_obj =& new ADOFetchObj();
|
||||||
|
+ $this->_obj = new ADOFetchObj();
|
||||||
|
$this->_names = array();
|
||||||
|
for ($i=0; $i <$this->_numOfFields; $i++) {
|
||||||
|
$f = $this->FetchField($i);
|
||||||
|
@@ -3589,7 +3589,7 @@
|
||||||
|
return $false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- $obj =& new $cls();
|
||||||
|
+ $obj = new $cls();
|
||||||
|
}
|
||||||
|
|
||||||
|
# constructor should not fail
|
||||||
|
@@ -3664,7 +3664,7 @@
|
||||||
|
@include_once(ADODB_DIR."/perf/perf-$drivername.inc.php");
|
||||||
|
$class = "Perf_$drivername";
|
||||||
|
if (!class_exists($class)) return $false;
|
||||||
|
- $perf =& new $class($conn);
|
||||||
|
+ $perf = new $class($conn);
|
||||||
|
|
||||||
|
return $perf;
|
||||||
|
}
|
||||||
|
@@ -3684,7 +3684,7 @@
|
||||||
|
}
|
||||||
|
include_once($path);
|
||||||
|
$class = "ADODB2_$drivername";
|
||||||
|
- $dict =& new $class();
|
||||||
|
+ $dict = new $class();
|
||||||
|
$dict->dataProvider = $conn->dataProvider;
|
||||||
|
$dict->connection = &$conn;
|
||||||
|
$dict->upperName = strtoupper($drivername);
|
||||||
|
diff -aur cacti/lib/adodb/drivers/adodb-pdo.inc.php cacti-PHP7/lib/adodb/drivers/adodb-pdo.inc.php
|
||||||
|
--- cacti/lib/adodb/drivers/adodb-pdo.inc.php 2010-08-21 17:03:22.000000000 +0200
|
||||||
|
+++ cacti-PHP7/lib/adodb/drivers/adodb-pdo.inc.php 2016-02-24 22:20:42.780689777 +0100
|
||||||
|
@@ -43,16 +43,16 @@
|
||||||
|
$this->_connectionID = new PDO($argDSN, $argUsername, $argPassword);
|
||||||
|
if ($this->_connectionID) {
|
||||||
|
switch(ADODB_ASSOC_CASE){
|
||||||
|
- case 0: $m = PDO_CASE_LOWER; break;
|
||||||
|
- case 1: $m = PDO_CASE_UPPER; break;
|
||||||
|
+ case 0: $m = PDO::CASE_LOWER; break;
|
||||||
|
+ case 1: $m = PDO::CASE_UPPER; break;
|
||||||
|
default:
|
||||||
|
- case 2: $m = PDO_CASE_NATURAL; break;
|
||||||
|
+ case 2: $m = PDO::CASE_NATURAL; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
- //$this->_connectionID->setAttribute(PDO_ATTR_ERRMODE,PDO_ERRMODE_SILENT );
|
||||||
|
- $this->_connectionID->setAttribute(PDO_ATTR_CASE,$m);
|
||||||
|
+ //$this->_connectionID->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_SILENT );
|
||||||
|
+ $this->_connectionID->setAttribute(PDO::ATTR_CASE,$m);
|
||||||
|
|
||||||
|
- //$this->_connectionID->setAttribute(PDO_ATTR_AUTOCOMMIT,true);
|
||||||
|
+ //$this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT,true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -96,7 +96,7 @@
|
||||||
|
if ($this->transOff) return true;
|
||||||
|
$this->transCnt += 1;
|
||||||
|
$this->_autocommit = false;
|
||||||
|
- $this->_connectionID->setAttribute(PDO_ATTR_AUTOCOMMIT,false);
|
||||||
|
+ $this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT,false);
|
||||||
|
return $this->_connectionID->beginTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -108,7 +108,7 @@
|
||||||
|
$this->_autocommit = true;
|
||||||
|
|
||||||
|
$ret = $this->_connectionID->commit();
|
||||||
|
- $this->_connectionID->setAttribute(PDO_ATTR_AUTOCOMMIT,true);
|
||||||
|
+ $this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT,true);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@
|
||||||
|
$this->_autocommit = true;
|
||||||
|
|
||||||
|
$ret = $this->_connectionID->rollback();
|
||||||
|
- $this->_connectionID->setAttribute(PDO_ATTR_AUTOCOMMIT,true);
|
||||||
|
+ $this->_connectionID->setAttribute(PDO::ATTR_AUTOCOMMIT,true);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -242,9 +242,9 @@
|
||||||
|
}
|
||||||
|
switch($mode) {
|
||||||
|
default:
|
||||||
|
- case ADODB_FETCH_BOTH: $mode = PDO_FETCH_BOTH; break;
|
||||||
|
- case ADODB_FETCH_NUM: $mode = PDO_FETCH_NUM; break;
|
||||||
|
- case ADODB_FETCH_ASSOC: $mode = PDO_FETCH_ASSOC; break;
|
||||||
|
+ case ADODB_FETCH_BOTH: $mode = PDO::FETCH_BOTH; break;
|
||||||
|
+ case ADODB_FETCH_NUM: $mode = PDO::FETCH_NUM; break;
|
||||||
|
+ case ADODB_FETCH_ASSOC: $mode = PDO::FETCH_ASSOC; break;
|
||||||
|
}
|
||||||
|
$this->fetchMode = $mode;
|
||||||
|
|
||||||
|
diff -aur cacti/lib/html_tree.php cacti-PHP7/lib/html_tree.php
|
||||||
|
--- cacti/lib/html_tree.php 2015-11-17 02:39:54.000000000 +0100
|
||||||
|
+++ cacti-PHP7/lib/html_tree.php 2016-02-24 22:24:00.738287850 +0100
|
||||||
|
@@ -510,7 +510,7 @@
|
||||||
|
|
||||||
|
$default_tree_id = read_graph_config_option('default_tree_id');
|
||||||
|
|
||||||
|
- if (empty($default_tree_id)) {
|
||||||
|
+ if (empty($default_tree_id) && isset($_SESSION['sess_user_id'])) {
|
||||||
|
$user = db_fetch_row('SELECT * FROM user_auth WHERE id=' . $_SESSION['sess_user_id']);
|
||||||
|
|
||||||
|
if ($user['policy_trees'] == 1) {
|
11
cacti-php7_2.patch
Normal file
11
cacti-php7_2.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- cacti-0.8.8g/lib/adodb/adodb-lib.inc.php 2010-08-21 17:03:22.000000000 +0200
|
||||||
|
+++ cacti-0.8.8g-php7/lib/adodb/adodb-lib.inc.php 2016-04-21 12:30:45.707940772 +0200
|
||||||
|
@@ -534,7 +534,7 @@
|
||||||
|
//because we have to call MetaType.
|
||||||
|
//php can't do a $rsclass::MetaType()
|
||||||
|
$rsclass = $zthis->rsPrefix.$zthis->databaseType;
|
||||||
|
- $recordSet =& new $rsclass(-1,$zthis->fetchMode);
|
||||||
|
+ $recordSet = new $rsclass(-1,$zthis->fetchMode);
|
||||||
|
$recordSet->connection = &$zthis;
|
||||||
|
|
||||||
|
if (is_string($cacheRS) && $cacheRS == $rs) {
|
17
cacti.spec
17
cacti.spec
@ -1,6 +1,6 @@
|
|||||||
Name: cacti
|
Name: cacti
|
||||||
Version: 0.8.8h
|
Version: 0.8.8h
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: An rrd based graphing tool
|
Summary: An rrd based graphing tool
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.cacti.net/
|
URL: http://www.cacti.net/
|
||||||
@ -13,8 +13,11 @@ Source5: d.png
|
|||||||
Source6: throbber.gif
|
Source6: throbber.gif
|
||||||
Source7: %{name}.cron
|
Source7: %{name}.cron
|
||||||
Patch0: cacti-0.8.8a-legal.patch
|
Patch0: cacti-0.8.8a-legal.patch
|
||||||
|
Patch1: cacti-php7.patch
|
||||||
|
Patch2: cacti-php7_2.patch
|
||||||
|
Patch3: cacti-mysqli.patch
|
||||||
|
|
||||||
Requires: php, php-mysqlnd, mysql, httpd, rrdtool, net-snmp, php-snmp
|
Requires: php, php-mysqlnd, php-snmp, php-pdo, php-xml, mariadb, httpd, rrdtool, net-snmp
|
||||||
Requires: net-snmp-utils
|
Requires: net-snmp-utils
|
||||||
Requires: crontabs
|
Requires: crontabs
|
||||||
Requires(pre): shadow-utils
|
Requires(pre): shadow-utils
|
||||||
@ -37,8 +40,11 @@ data in a MySQL database. The frontend is completely PHP
|
|||||||
driven.
|
driven.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup
|
%setup -q
|
||||||
%patch0 -p1
|
%patch0 -p1 -b .legal-patch
|
||||||
|
%patch1 -p1 -b .php7-patch1
|
||||||
|
%patch2 -p1 -b .php7-patch2
|
||||||
|
%patch3 -p1 -b .php7-mysqli
|
||||||
|
|
||||||
cp %{SOURCE4} %{SOURCE5} %{SOURCE6} include/js/jquery/themes/default/
|
cp %{SOURCE4} %{SOURCE5} %{SOURCE6} include/js/jquery/themes/default/
|
||||||
chmod -R 0644 include/js/images/*
|
chmod -R 0644 include/js/images/*
|
||||||
@ -124,6 +130,9 @@ fi
|
|||||||
%attr(0644,root,root) %{_localstatedir}/lib/%{name}/lib
|
%attr(0644,root,root) %{_localstatedir}/lib/%{name}/lib
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 18 2017 Morten Stevens <mstevens@fedoraproject.org> - 0.8.8h-3
|
||||||
|
- Fixes for PHP7 backported from Arch Linux (#1390770)
|
||||||
|
|
||||||
* Tue Jun 28 2016 Jon Ciesla <limburgher@gmail.com> - 0.8.8h-2
|
* Tue Jun 28 2016 Jon Ciesla <limburgher@gmail.com> - 0.8.8h-2
|
||||||
- php7 Requires fix.
|
- php7 Requires fix.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user