From 072193682fef21fe22601a460523682c1c178f2e Mon Sep 17 00:00:00 2001 From: Kenji ITO Date: Sun, 9 Oct 2016 17:35:04 +0900 Subject: [PATCH] Fixed some of the SQL statements in the installer incompatible with MySQL-5.7 --- plugins/spamx/autoinstall.php | 4 +-- plugins/spamx/sql/mysql_install.php | 2 +- plugins/spamx/sql/mysql_updates.php | 7 +++-- plugins/staticpages/autoinstall.php | 6 ++--- plugins/staticpages/sql/mysql_install.php | 6 ++--- plugins/staticpages/sql/mysql_updates.php | 8 +++--- public_html/admin/block.php | 12 ++++----- .../admin/install/classes/installer.class.php | 2 +- sql/mysql_tableanddata.php | 26 +++++++++---------- sql/updates/mysql_2.1.1_to_2.1.2.php | 8 ++++++ 10 files changed, 45 insertions(+), 36 deletions(-) diff --git a/plugins/spamx/autoinstall.php b/plugins/spamx/autoinstall.php index 2a46d0d01..6e64ba809 100644 --- a/plugins/spamx/autoinstall.php +++ b/plugins/spamx/autoinstall.php @@ -50,8 +50,8 @@ function plugin_autoinstall_spamx($pi_name) $info = array( 'pi_name' => $pi_name, 'pi_display_name' => $pi_display_name, - 'pi_version' => '1.3.2', - 'pi_gl_version' => '2.1.0', + 'pi_version' => '1.3.3', + 'pi_gl_version' => '2.1.2', 'pi_homepage' => 'http://www.geeklog.net/', ); diff --git a/plugins/spamx/sql/mysql_install.php b/plugins/spamx/sql/mysql_install.php index 0c88a7268..a4fc14cab 100644 --- a/plugins/spamx/sql/mysql_install.php +++ b/plugins/spamx/sql/mysql_install.php @@ -35,7 +35,7 @@ name varchar(20) NOT NULL default '', value varchar(255) NOT NULL default '', counter int(11) NOT NULL default '0', - regdate datetime NOT NULL default '0000-00-00 00:00:00', + regdate datetime default NULL, INDEX spamx_name(name), PRIMARY KEY (name, value) ) ENGINE=MyISAM diff --git a/plugins/spamx/sql/mysql_updates.php b/plugins/spamx/sql/mysql_updates.php index 597e90c16..0cba6e190 100644 --- a/plugins/spamx/sql/mysql_updates.php +++ b/plugins/spamx/sql/mysql_updates.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Spam-X Plugin 1.2 | +// | Spam-X Plugin 1.3 | // +---------------------------------------------------------------------------+ // | Upgrade SQL | // +---------------------------------------------------------------------------+ @@ -33,7 +33,6 @@ */ $_UPDATES = array( - '1.2.0' => array( "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) VALUES ('spamx.skip', 'Skip checking posts for Spam')", "UPDATE {$_TABLES['plugins']} SET pi_homepage = 'http://www.geeklog.net/' WHERE pi_name = 'spamx'" @@ -50,6 +49,10 @@ '1.3.0' => array( "ALTER TABLE {$_TABLES['spamx']} ADD counter INT NOT NULL DEFAULT '0'", "ALTER TABLE {$_TABLES['spamx']} ADD regdate datetime NOT NULL default '0000-00-00 00:00:00'" + ), + + '1.3.2' => array( + "ALTER TABLE {$_TABLES['spamx']} MODIFY COLUMN regdate DATETIME DEFAULT NULL" ) ); diff --git a/plugins/staticpages/autoinstall.php b/plugins/staticpages/autoinstall.php index 4c899d0f6..269bf63fb 100644 --- a/plugins/staticpages/autoinstall.php +++ b/plugins/staticpages/autoinstall.php @@ -51,8 +51,8 @@ function plugin_autoinstall_staticpages($pi_name) $info = array( 'pi_name' => $pi_name, 'pi_display_name' => $pi_display_name, - 'pi_version' => '1.6.7', - 'pi_gl_version' => '2.1.1', + 'pi_version' => '1.6.8', + 'pi_gl_version' => '2.1.2', 'pi_homepage' => 'http://www.geeklog.net/' ); @@ -185,5 +185,3 @@ function plugin_postinstall_staticpages($pi_name) return true; } - -?> diff --git a/plugins/staticpages/sql/mysql_install.php b/plugins/staticpages/sql/mysql_install.php index e30db479a..20b4d9d43 100644 --- a/plugins/staticpages/sql/mysql_install.php +++ b/plugins/staticpages/sql/mysql_install.php @@ -42,8 +42,8 @@ sp_page_title varchar(128) NOT NULL default '', sp_content text NOT NULL, sp_hits mediumint(8) unsigned NOT NULL default '0', - `created` datetime NOT NULL default '0000-00-00 00:00:00', - modified datetime NOT NULL default '0000-00-00 00:00:00', + `created` datetime default NULL, + modified datetime default NULL, sp_format varchar(20) NOT NULL default '', sp_onmenu tinyint(1) unsigned NOT NULL default '0', sp_label varchar(64) default NULL, @@ -74,5 +74,3 @@ KEY staticpage_sp_where (sp_where) ) ENGINE=MyISAM "; - -?> diff --git a/plugins/staticpages/sql/mysql_updates.php b/plugins/staticpages/sql/mysql_updates.php index 0efa75e97..7d5046a7b 100644 --- a/plugins/staticpages/sql/mysql_updates.php +++ b/plugins/staticpages/sql/mysql_updates.php @@ -33,7 +33,6 @@ */ $_UPDATES = array( - '1.4.3' => array( "ALTER TABLE {$_TABLES['staticpage']} ADD commentcode tinyint(4) NOT NULL default '0' AFTER sp_label", // disable comments on all existing static pages @@ -72,6 +71,11 @@ '1.6.5' => array( "ALTER TABLE {$_TABLES['staticpage']} ADD `cache_time` INT NOT NULL DEFAULT '0' AFTER `template_id`", "ALTER TABLE {$_TABLES['staticpage']} CHANGE `sp_id` `sp_id` VARCHAR(128) NOT NULL DEFAULT ''" + ), + + '1.6.7' => array( + "ALTER TABLE {$_TABLES['staticpage']} MODIFY COLUMN `created` DATETIME DEFAULT NULL", + "ALTER TABLE {$_TABLES['staticpage']} MODIFY COLUMN `modified` DATETIME DEFAULT NULL" ) ); @@ -187,5 +191,3 @@ function SP_update_ConfValues_1_6_1() return true; } - -?> diff --git a/public_html/admin/block.php b/public_html/admin/block.php index 77476aea3..1d69264b3 100644 --- a/public_html/admin/block.php +++ b/public_html/admin/block.php @@ -434,7 +434,7 @@ function editblock($bid = '') $block_templates->set_var('lang_rdflimit', $LANG21[62]); $block_templates->set_var('block_rdflimit', $A['rdflimit']); $block_templates->set_var('lang_lastrdfupdate', $LANG21[15]); - if ($A['rdfupdated'] == '0000-00-00 00:00:00') { + if (empty($A['rdfupdated'])) { $block_templates->set_var('block_rdfupdated', ''); } else { $block_templates->set_var('block_rdfupdated', $A['rdfupdated']); @@ -793,11 +793,11 @@ function saveblock($bid, $name, $title, $help, $type, $blockOrder, $device, $con if ($rdfLimit < 0) { $rdfLimit = 0; } - if (!empty ($rdfUrl)) { + if (!empty($rdfUrl)) { $rdfUrl = DB_escapeString($rdfUrl); } - if (empty ($rdfUpdated)) { - $rdfUpdated = 'NOW()'; + if (empty($rdfUpdated)) { + $rdfUpdated = 'CURRENT_TIMESTAMP'; } if ($bid > 0) { @@ -810,7 +810,7 @@ function saveblock($bid, $name, $title, $help, $type, $blockOrder, $device, $con $sql['pgsql'] = "INSERT INTO {$_TABLES['blocks']} " . '(bid,name,title,help,type,blockorder,device,content,rdfurl,rdfupdated,rdflimit,phpblockfn,onleft,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,is_enabled,allow_autotags,cache_time) ' - . "VALUES ((SELECT NEXTVAL('{$_TABLES['blocks']}_bid_seq')),'$name','$title','$help','$type','$blockOrder','$device','$content','$rdfUrl','1970-01-01','$rdfLimit','$phpBlockFn',$onLeft,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_enabled,$allow_autotags,$cache_time)"; + . "VALUES ((SELECT NEXTVAL('{$_TABLES['blocks']}_bid_seq')),'$name','$title','$help','$type','$blockOrder','$device','$content','$rdfUrl',CURRENT_TIMESTAMP,'$rdfLimit','$phpBlockFn',$onLeft,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_enabled,$allow_autotags,$cache_time)"; DB_query($sql); $bid = DB_insertId(); @@ -1007,7 +1007,7 @@ function deleteBlock($bid) } if (($mode == $LANG_ADMIN['delete']) && !empty($LANG_ADMIN['delete'])) { - if (!isset ($bid) || empty ($bid) || ($bid == 0)) { + if (!isset ($bid) || empty($bid) || ($bid == 0)) { COM_errorLog('Attempted to delete block, bid empty or null, value =' . $bid); COM_redirect($_CONF['site_admin_url'] . '/block.php'); } elseif (SEC_checkToken()) { diff --git a/public_html/admin/install/classes/installer.class.php b/public_html/admin/install/classes/installer.class.php index 91fee16fd..d9b3a4cfa 100644 --- a/public_html/admin/install/classes/installer.class.php +++ b/public_html/admin/install/classes/installer.class.php @@ -2135,7 +2135,7 @@ private function doDatabaseUpgrades($currentGlVersion) $filename = substr($_CONF['rdf_file'], $pos + 1); $siteName = DB_escapeString($_CONF['site_name']); $siteSlogan = DB_escapeString($_CONF['site_slogan']); - DB_query("INSERT INTO {$_TABLES['syndication']} (title, description, limits, content_length, filename, charset, language, is_enabled, updated, update_info) VALUES ('{$siteName}', '{$siteSlogan}', '{$_CONF['rdf_limit']}', {$_CONF['rdf_storytext']}, '{$filename}', '{$_CONF['default_charset']}', '{$_CONF['rdf_language']}', {$_CONF['backend']}, '0000-00-00 00:00:00', NULL)"); + DB_query("INSERT INTO {$_TABLES['syndication']} (title, description, limits, content_length, filename, charset, language, is_enabled, updated, update_info) VALUES ('{$siteName}', '{$siteSlogan}', '{$_CONF['rdf_limit']}', {$_CONF['rdf_storytext']}, '{$filename}', '{$_CONF['default_charset']}', '{$_CONF['rdf_language']}', {$_CONF['backend']}, CURRENT_TIMESTAMP, NULL)"); // upgrade static pages plugin $spVersion = $this->getStaticPagesVersion(); diff --git a/sql/mysql_tableanddata.php b/sql/mysql_tableanddata.php index 54bffedbe..e529a6827 100644 --- a/sql/mysql_tableanddata.php +++ b/sql/mysql_tableanddata.php @@ -30,7 +30,7 @@ allow_autotags tinyint(1) unsigned NOT NULL DEFAULT '0', cache_time INT NOT NULL DEFAULT '0', rdfurl varchar(255) default NULL, - rdfupdated datetime NOT NULL default '0000-00-00 00:00:00', + rdfupdated datetime default NULL, rdf_last_modified varchar(40) default NULL, rdf_etag varchar(40) default NULL, rdflimit smallint(5) unsigned NOT NULL default '0', @@ -330,7 +330,7 @@ hits mediumint(8) unsigned NOT NULL default '0', numemails mediumint(8) unsigned NOT NULL default '0', comments mediumint(8) unsigned NOT NULL default '0', - comment_expire datetime NOT NULL default '0000-00-00 00:00:00', + comment_expire datetime default NULL, trackbacks mediumint(8) unsigned NOT NULL default '0', related text, featured tinyint(1) unsigned NOT NULL default '0', @@ -338,7 +338,7 @@ commentcode tinyint(4) NOT NULL default '0', trackbackcode tinyint(4) NOT NULL default '0', statuscode tinyint(4) NOT NULL default '0', - expire DATETIME NOT NULL default '0000-00-00 00:00:00', + expire DATETIME default NULL, postmode varchar(10) NOT NULL default 'html', advanced_editor_mode tinyint(1) unsigned default '0', frontpage tinyint(1) unsigned default '1', @@ -393,7 +393,7 @@ charset varchar(20) NOT NULL default 'UTF-8', language varchar(20) NOT NULL default 'en-gb', is_enabled tinyint(1) unsigned NOT NULL default '1', - updated datetime NOT NULL default '0000-00-00 00:00:00', + updated datetime default NULL, update_info text, PRIMARY KEY (fid), INDEX syndication_type(type), @@ -546,7 +546,7 @@ email varchar(96) default NULL, homepage varchar(96) default NULL, sig varchar(160) NOT NULL default '', - regdate datetime NOT NULL default '0000-00-00 00:00:00', + regdate datetime default NULL, photo varchar(128) DEFAULT NULL, cookietimeout int(8) unsigned default '28800', theme varchar(64) default NULL, @@ -642,13 +642,13 @@ $_DATA[] = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES (67,16) "; $_DATA[] = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES (68,18) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (1,1,'user_block','gldefault','User Functions',30,'','','0000-00-00 00:00:00',1,'',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (2,1,'admin_block','gldefault','Admins Only',20,'','','0000-00-00 00:00:00',1,'',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (3,1,'section_block','gldefault','Topics',10,'','','0000-00-00 00:00:00',1,'',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (4,1,'whats_new_block','gldefault','What\'s New',30,'','','0000-00-00 00:00:00',0,'',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (5,1,'first_block','normal','About Geeklog',20,'

Welcome to Geeklog!

If you\'re already familiar with Geeklog - and especially if you\'re not: There have been many improvements to Geeklog since earlier versions that you might want to read up on. Please read the release notes. If you need help, please see the support options.

','','0000-00-00 00:00:00',0,'',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (6,1,'whosonline_block','phpblock','Who\'s Online',10,'','','0000-00-00 00:00:00',0,'phpblock_whosonline',4,2,3,3,2,2) "; -$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (7,1,'older_stories','gldefault','Older Stories',40,'','','0000-00-00 00:00:00',1,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (1,1,'user_block','gldefault','User Functions',30,'','',CURRENT_TIMESTAMP,1,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (2,1,'admin_block','gldefault','Admins Only',20,'','',CURRENT_TIMESTAMP,1,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (3,1,'section_block','gldefault','Topics',10,'','',CURRENT_TIMESTAMP,1,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (4,1,'whats_new_block','gldefault','What\'s New',30,'','',CURRENT_TIMESTAMP,0,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (5,1,'first_block','normal','About Geeklog',20,'

Welcome to Geeklog!

If you\'re already familiar with Geeklog - and especially if you\'re not: There have been many improvements to Geeklog since earlier versions that you might want to read up on. Please read the release notes. If you need help, please see the support options.

','',CURRENT_TIMESTAMP,0,'',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (6,1,'whosonline_block','phpblock','Who\'s Online',10,'','',CURRENT_TIMESTAMP,0,'phpblock_whosonline',4,2,3,3,2,2) "; +$_DATA[] = "INSERT INTO {$_TABLES['blocks']} (bid, is_enabled, name, type, title, blockorder, content, rdfurl, rdfupdated, onleft, phpblockfn, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES (7,1,'older_stories','gldefault','Older Stories',40,'','',CURRENT_TIMESTAMP,1,'',4,2,3,3,2,2) "; $_DATA[] = "INSERT INTO {$_TABLES['commentcodes']} (code, name) VALUES (0,'Comments Enabled') "; $_DATA[] = "INSERT INTO {$_TABLES['commentcodes']} (code, name) VALUES (-1,'Comments Disabled') "; @@ -844,7 +844,7 @@ $_DATA[] = "INSERT INTO {$_TABLES['storysubmission']} (sid, uid, title, introtext, date, postmode) VALUES ('security-reminder',2,'Are you secure?','

This is a reminder to secure your site once you have Geeklog up and running. What you should do:

\r\r
    \r
  1. Change the default password for the Admin account.
  2. \r
  3. Remove the install directory (you won\'t need it any more).
  4. \r
',NOW(),'html') "; -$_DATA[] = "INSERT INTO {$_TABLES['syndication']} (type, topic, header_tid, format, limits, content_length, title, description, filename, charset, language, is_enabled, updated, update_info) VALUES ('article', '::all', 'all', 'RSS-2.0', 10, 1, 'Geeklog Site', 'Another Nifty Geeklog Site', 'geeklog.rss', 'iso-8859-1', 'en-gb', 1, '0000-00-00 00:00:00', NULL)"; +$_DATA[] = "INSERT INTO {$_TABLES['syndication']} (type, topic, header_tid, format, limits, content_length, title, description, filename, charset, language, is_enabled, updated, update_info) VALUES ('article', '::all', 'all', 'RSS-2.0', 10, 1, 'Geeklog Site', 'Another Nifty Geeklog Site', 'geeklog.rss', 'iso-8859-1', 'en-gb', 1, CURRENT_TIMESTAMP, NULL)"; $_DATA[] = "INSERT INTO {$_TABLES['topic_assignments']} (tid, type, id, inherit, tdefault) VALUES ('all', 'block', '1', 1, 0)"; $_DATA[] = "INSERT INTO {$_TABLES['topic_assignments']} (tid, type, id, inherit, tdefault) VALUES ('all', 'block', '2', 1, 0)"; diff --git a/sql/updates/mysql_2.1.1_to_2.1.2.php b/sql/updates/mysql_2.1.1_to_2.1.2.php index b7ce8a87d..52ab73abc 100644 --- a/sql/updates/mysql_2.1.1_to_2.1.2.php +++ b/sql/updates/mysql_2.1.1_to_2.1.2.php @@ -1,5 +1,13 @@