From b03009d96217c8f3dbd024e5038123b6430875e1 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 20 Nov 2016 16:14:09 +0100 Subject: [PATCH 1/3] use an array for warnings in admin panel --- mod/admin.php | 4 ++-- view/templates/admin_summary.tpl | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index c5ad7de3b6..67b8ed29f7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -431,10 +431,10 @@ function admin_page_summary(&$a) { // are there MyISAM tables in the DB? If so, trigger a warning message $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine`='myisam' LIMIT 1"); $showwarning = false; - $warningtext = ""; + $warningtext = array(); if (dbm::is_result($r)) { $showwarning = true; - $warningtext = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the convert_innodb.sql in the /util directory of your Friendica installation.
'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); + $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the convert_innodb.sql in the /util directory of your Friendica installation.
'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } $r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`"); $accounts = array( diff --git a/view/templates/admin_summary.tpl b/view/templates/admin_summary.tpl index 34df0db510..c8e8af2294 100644 --- a/view/templates/admin_summary.tpl +++ b/view/templates/admin_summary.tpl @@ -3,7 +3,9 @@

{{$title}} - {{$page}}

{{if $showwarning}}
-

{{$warningtext}}

+ {{foreach $warningtext as $wt}} +

{{$wt}}

+ {{/foreach}}
{{/if}} From 97c6f668e616320f804f36219c8d03c7926b87e1 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 20 Nov 2016 16:32:38 +0100 Subject: [PATCH 2/3] add a warning to the admin panel when the MySQL version is problematic --- mod/admin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/admin.php b/mod/admin.php index 67b8ed29f7..7114ca7be7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -428,6 +428,7 @@ function admin_page_queue(&$a) { * @return string */ function admin_page_summary(&$a) { + global $db; // are there MyISAM tables in the DB? If so, trigger a warning message $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine`='myisam' LIMIT 1"); $showwarning = false; @@ -436,6 +437,11 @@ function admin_page_summary(&$a) { $showwarning = true; $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the convert_innodb.sql in the /util directory of your Friendica installation.
'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } + // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements + if ((version_compare($db->server_info(), '5.7.4') >= 0) AND + !(strpos($db->server_info(), 'MariaDB') !== false)) { + $warningtext[] = t('You are using a MySQL version which does not support all features that Friendica uses. You should consider switching to MariaDB.'); + } $r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`"); $accounts = array( array(t('Normal Account'), 0), From c99c98ab8b348287db48f4830d2e281cba3a3105 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 20 Nov 2016 16:33:56 +0100 Subject: [PATCH 3/3] script is moved --- convert_innodb.sql | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 convert_innodb.sql diff --git a/convert_innodb.sql b/convert_innodb.sql deleted file mode 100644 index 9eeb67fe85..0000000000 --- a/convert_innodb.sql +++ /dev/null @@ -1,19 +0,0 @@ - - -ALTER TABLE `profile` DROP INDEX `pub_keywords` ; -ALTER TABLE `profile` DROP INDEX `prv_keywords` ; - -ALTER TABLE `item` DROP INDEX `title` ; -ALTER TABLE `item` DROP INDEX `body` ; -ALTER TABLE `item` DROP INDEX `allow_cid` ; -ALTER TABLE `item` DROP INDEX `allow_gid` ; -ALTER TABLE `item` DROP INDEX `deny_cid` ; -ALTER TABLE `item` DROP INDEX `deny_gid` ; -ALTER TABLE `item` DROP INDEX `tag` ; -ALTER TABLE `item` DROP INDEX `file` ; - - -SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=InnoDB;') -FROM information_schema.tables -WHERE engine = 'MyISAM'; -