summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gevers <elbrus@debian.org>2016-05-13 12:18:55 (GMT)
committerPaul Gevers <elbrus@debian.org>2016-05-14 20:29:47 (GMT)
commitb94dd8459080d242f24d900786d4ab5052526545 (patch)
tree82187706afa5870ea519503a88f1c8db648bda0d
parent38e7aa928117844337d2a9cf11284fb7713337d4 (diff)
Add make_cacti_sql_mode-strict_compatible.patch
-rw-r--r--debian/patches/make_cacti_sql_mode-strict_compatible.patch32
-rw-r--r--debian/patches/series1
2 files changed, 33 insertions, 0 deletions
diff --git a/debian/patches/make_cacti_sql_mode-strict_compatible.patch b/debian/patches/make_cacti_sql_mode-strict_compatible.patch
new file mode 100644
index 0000000..ce4d3dc
--- /dev/null
+++ b/debian/patches/make_cacti_sql_mode-strict_compatible.patch
@@ -0,0 +1,32 @@
+Description: Since MySQL 5.7 sql_mode is by default set to strict
+ mode. However, cacti is not designed to be compatible. So to enable cacti to
+ keep working, it needs to force NO_ZERO_DATE to be unset.
+Author: Paul Gevers <elbrus@debian.org>
+Bug: http://bugs.cacti.net/view.php?id=2159
+Ubuntu-bug: https://bugs.launchpad.net/ubuntu/+source/cacti/+bug/1578144
+
+Index: cacti/cacti.sql
+===================================================================
+--- cacti.orig/cacti.sql
++++ cacti/cacti.sql
+@@ -2,6 +2,8 @@
+ -- Table structure for table `cdef`
+ --
+
++SET SESSION sql_mode = (SELECT REPLACE(@@sql_mode,'NO_ZERO_DATE', '')) ;
++
+ CREATE TABLE cdef (
+ id mediumint(8) unsigned NOT NULL auto_increment,
+ hash varchar(32) NOT NULL default '',
+Index: cacti/lib/database.php
+===================================================================
+--- cacti.orig/lib/database.php
++++ cacti/lib/database.php
+@@ -51,6 +51,7 @@ function db_connect_real($host, $user, $
+ $cnn_id = ADONewConnection($dsn);
+ if ($cnn_id) {
+ $cnn_id->EXECUTE("set names 'utf8'");
++ $cnn_id->EXECUTE("SET SESSION sql_mode = (SELECT REPLACE(@@sql_mode,'NO_ZERO_DATE', ''))");
+ return($cnn_id);
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index 8a380b9..83e0923 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@ fix_php_strict_warning_in_ping.patch
use_debian_javascript_packages.patch
add_rrdtool-1.5_to_utilities.php.patch
11_1571432_mysqli.patch
+make_cacti_sql_mode-strict_compatible.patch