diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 34f8e0ae365eb..5130816b879bb 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -273,6 +273,7 @@ protected function updateManifestCaches() array('plugin', 'tags', 'finder', 0), array('plugin', 'totp', 'twofactorauth', 0), array('plugin', 'yubikey', 'twofactorauth', 0), + array('plugin', 'maxvars', 'quickicon', 0), // Templates array('template', 'beez3', '', 0), diff --git a/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-07-17.sql b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-07-17.sql new file mode 100644 index 0000000000000..39b28a6101d2b --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-07-17.sql @@ -0,0 +1,2 @@ +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-07-17.sql b/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-07-17.sql new file mode 100644 index 0000000000000..199f967da6329 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-07-17.sql @@ -0,0 +1,2 @@ +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-07-17.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-07-17.sql new file mode 100644 index 0000000000000..79efa2986501d --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-07-17.sql @@ -0,0 +1,2 @@ +INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) +SELECT 453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0; diff --git a/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.ini b/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.ini new file mode 100644 index 0000000000000..a1ce8addfea6c --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_QUICKICON_MAXVARS_WARN="Your PHP configuration has an input limit of %s variables and your website is using approximately %s. This may create issues making changes to your website.
Please contact your hosting provider and ask them to increase the limit of the PHP setting max_input_vars." +PLG_QUICKICON_MAXVARS_FAIL="Your PHP configuration has an input limit of %s variables and your website has reached that limit and is using approximately %s.
This will create issues making changes to your website.

Please contact your hosting provider and ask them to increase the limit of the PHP setting max_input_vars." diff --git a/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.sys.ini b/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.sys.ini new file mode 100644 index 0000000000000..96d5473f2eccd --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_quickicon_maxvars.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_QUICKICON_MAXVARS="Quick Icon - Joomla! php max_input_vars check" +PLG_QUICKICON_MAXVARS_XML_DESCRIPTION="Checks the setting of php max_input_vars and notifies you when you visit the Control Panel page if you have reached the server limit." \ No newline at end of file diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index c7e3aa5b3bfad..b4e8e1850b575 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -610,6 +610,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (449, 'plg_authentication_cookie', 'plugin', 'cookie', 'authentication', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0); (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index ca199d90eb950..0dbe7e6fabc86 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -611,6 +611,7 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (449, 'plg_authentication_cookie', 'plugin', 'cookie', 'authentication', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Templates INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index 7f99a9968d6db..bb0d0ad5319c3 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -1012,7 +1012,8 @@ UNION ALL SELECT 450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL SELECT 451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; - +UNION ALL +SELECT 453, 'plg_quickicon_maxvars', 'plugin', 'maxvars', 'quickicon', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0; INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) SELECT 503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 diff --git a/plugins/quickicon/maxvars/maxvars.php b/plugins/quickicon/maxvars/maxvars.php new file mode 100644 index 0000000000000..8c4d5d0717b27 --- /dev/null +++ b/plugins/quickicon/maxvars/maxvars.php @@ -0,0 +1,85 @@ +loadLanguage(); + } + + /** + * This method is called when the Quick Icons module is constructing its set + * of icons. You can return an array which defines a single icon and it will + * be rendered right after the stock Quick Icons. + * + * @param string $context The calling context + * + * @return array A list of icon definition associative arrays, consisting of the + * keys link, image, text and access. + * + * @since 3.5 + */ + public function onGetIcons($context) + { + $maxinputvars = @ini_get('max_input_vars'); + $varcount = 0; + + $tables = array( + '#__categories', + '#__menu', + '#__modules', + '#__usergroups', + ); + + // Get a db connection. + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + + foreach ($tables as $tableToCheck) + { + $query->clear(); + + $query->select('count(*)'); + $query->from($db->quoteName($tableToCheck)); + + $db->setQuery($query); + $varcount = $varcount + (int) $db->loadResult(); + } + + if ($varcount >= $maxinputvars) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_QUICKICON_MAXVARS_FAIL', $maxinputvars, $varcount), 'error'); + } + + if (($varcount / $maxinputvars) > 0.8) > 80) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_QUICKICON_MAXVARS_WARN', $maxinputvars, $varcount), 'warning'); + } + } +} diff --git a/plugins/quickicon/maxvars/maxvars.xml b/plugins/quickicon/maxvars/maxvars.xml new file mode 100644 index 0000000000000..2f0695b1f02d9 --- /dev/null +++ b/plugins/quickicon/maxvars/maxvars.xml @@ -0,0 +1,19 @@ + + + PLG_QUICKICON_MAXVARS + Joomla! Project + July 2015 + Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 3.5.0 + PLG_QUICKICON_MAXVARS_XML_DESCRIPTION + + maxvars.php + + + en-GB.plg_quickicon_maxvars.ini + en-GB.plg_quickicon_maxvars.sys.ini + +