diff --git a/sites/all/modules/contrib/dev/prod_check/README.txt b/sites/all/modules/contrib/dev/prod_check/README.txt index c572136f..eb496e04 100644 --- a/sites/all/modules/contrib/dev/prod_check/README.txt +++ b/sites/all/modules/contrib/dev/prod_check/README.txt @@ -113,6 +113,20 @@ Production monitor 6. If you wish to fetch the data immediately, check the appropriate box and save the settings. Good to go! +Cron setup +---------- +To automatically check the site status and/or module updates on cron, you will +need to install drush and configure the following tasks in the crontab: + +# Check ALL sites for updates, once a day starting at 0100H at night. +0 1 * * * /path/to/drush -r /path/to/docroot prod-monitor-updates -y --quiet +# Fetch ALL site data every five minutes (or whatever you please obviously). +0/5 * * * * /path/to/drush -r /path/to/docroot prod-monitor-fetch -y --quiet + +Obviously, the time and frequency of these cron jobs is at your discretion. +Do note that, depending on the number of sites you have configured, the crons +may be running for quite some time, especially the module update checking job! + Upgrading --------- When upgrading Production monitor to a newer version, always run update.php to @@ -123,9 +137,9 @@ Nagios ------ 1. Download and install the Nagios module from http://drupal.org/project/nagios as per its readme instructions -2. Enable Nagios support in the prod_check module on /admin/settings/prod-check +2. Enable Nagios support in the prod_check module on /admin/config/system/prod-check by ticking the appropriate box. -3. Untick the checboxes for those items you do not whish to be monitored by +3. Untick the checkboxes for those items you do not whish to be monitored by Nagios. 4. Save the settings and you're good to go! @@ -172,7 +186,7 @@ For Production monitor, these commands are available: $ drush prod-monitor-fetch [id] $ drush prod-monitor-flush [id] $ drush prod-monitor-delete [id] - $ drush prod-monitor-updates [id] (--check) + $ drush prod-monitor-updates [id] (--check, --security-only) or their aliases: @@ -180,7 +194,7 @@ or their aliases: $ drush pmon-fe [id] $ drush pmon-fl [id] $ drush pmon-rm [id] - $ drush pmon-up [id] (--check) + $ drush pmon-up [id] (--check, --security-only) The id parameter is optional for the prod-monitor command. The best usage is to first get a list of sites: @@ -200,16 +214,19 @@ You can pass multiple ID's by separating them with spaces: The prod-monitor-updates command acts on one id only! -APC ---- +APC/OPcache +----------- Production Check complains about APC not being installed or misconfigured. What is APC you wonder? Well, APC is an opcode caching mechanism that will pre-com- pile PHP files and keep them stored in memory. The full manual can be found here: http://php.net/manual/en/book.apc.php . -For Drupal sites, it is important to tune APC in order to achieve maximum per- -formance there. Drupal uses a massive amount of files and therefore you should -assign a proper amount of RAM to APC. For a dedicated setup 64Mb should be -sufficient, in shared setups, you should easily double that! +PHP version 5.5 comes bundled with an alternative to APC named OPcache. The full +manual can be found here: http://php.net/manual/en/book.opcache.php . + +For Drupal sites, it is important to tune APC/OPcache in order to achieve +maximum performance there. Drupal uses a massive amount of files and therefore +you should assign a proper amount of RAM to APC/OPcache. For a dedicated setup +64Mb should be sufficient, in shared setups, you will need to multiply that! To tune your setup, you can use the aforementioned hidden link provided by Production check. You can see the memory usage there, verify your settings and much more. @@ -219,6 +236,7 @@ extension (drupal.org CVS did not seem to accept files with .ini extension?). Note: This 'hidden link' makes use of the APC supplied PHP code and is subject to the PHP license: http://www.php.net/license/3_01.txt . +The OPcache variant is taken from https://github.com/rlerdorf/opcache-status . Updates @@ -233,8 +251,8 @@ Cron is NOT used to do this, since we want to keep the transfer to a minimum. Hidden link =========== Production check adds some 'hidden links' to the site where you can check the -APC, Memcache and DB status of your site. These pages can be found on: - /admin/reports/status/apc +APC/OPcache, Memcache and DB status of your site. These pages can be found on: + /admin/reports/status/apc-opc /admin/reports/status/memcache /admin/reports/status/database @@ -251,8 +269,8 @@ The detailed report page The page is divided into 4 sections: - Settings: checks various Drupal settings - - Server: checks that are 'outside of Drupal' such as APC and wether or not you - have removed the release note files from the root. + - Server: checks that are 'outside of Drupal' such as APC/OPcache and wether or + not you have removed the release note files from the root. - Performance: checks relevant to the performance settings in Drupal such as page / block caching. - Modules: checks if certain modules are on / off diff --git a/sites/all/modules/contrib/dev/prod_check/includes/prod_check.admin.inc b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.admin.inc index b82b0b41..3a940e58 100644 --- a/sites/all/modules/contrib/dev/prod_check/includes/prod_check.admin.inc +++ b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.admin.inc @@ -97,8 +97,8 @@ function prod_check_settings_form($form, &$form_state) { $form['prod_check_apc'] = array( '#type' => 'fieldset', - '#title' => t('Advanced APC settings'), - '#description' => t('These settings are used in the !link functionality.', prod_check_link_array('advanced APC', 'admin/reports/status/apc')), + '#title' => t('Advanced APC/OPcache settings'), + '#description' => t('These settings are used in the !link functionality.', prod_check_link_array('advanced APC', 'admin/reports/status/apc-opc')), '#collapsible' => TRUE, '#collapsed' => TRUE, ); @@ -106,7 +106,7 @@ function prod_check_settings_form($form, &$form_state) { // Cache full count threshold $form['prod_check_apc']['prod_check_apc_expunge'] = array( '#type' => 'textfield', - '#title' => t('APC cache full count threshold'), + '#title' => t('APC/OPcache cache full count threshold'), '#default_value' => variable_get('prod_check_apc_expunge', 0), '#size' => 2, '#description' => t('Issue a critical error when the cache full count is greater than the number entered here.'), @@ -293,7 +293,7 @@ function prod_check_settings_form($form, &$form_state) { '!settings' => l(t('Nagios page callback'), 'admin/config/system/nagios'), '%callback' => 'prod_check_nagios_status_page', ) - ) .'
', + ) . '', ); $form['prod_check_nagios']['nagios']['settings']['prod_check_nagios_verbose'] = array( @@ -428,7 +428,7 @@ function prod_check_settings_form_validate($form, &$form_state) { } if (!is_numeric($form_state['values']['prod_check_apc_expunge'])) { - form_set_error('prod_check_apc_expunge', t('APC Cache full count threshold should be numeric!')); + form_set_error('prod_check_apc_expunge', t('APC/OPcache Cache full count threshold should be numeric!')); } if (isset($form_state['values']['prod_check_enable_nagios']) && $form_state['values']['prod_check_enable_nagios']) { @@ -461,9 +461,11 @@ function prod_check_settings_form_submit($form, &$form_state) { case t('Save configuration'): variable_set('prod_check_sitemail', $form_state['values']['prod_check_sitemail']); // PHP errors. - variable_set('prod_check_dblog_php', $form_state['values']['prod_check_dblog_php']); - variable_set('prod_check_dblog_php_threshold', $form_state['values']['prod_check_dblog_php_threshold']); - // APC. + if (module_exists('dblog')) { + variable_set('prod_check_dblog_php', $form_state['values']['prod_check_dblog_php']); + variable_set('prod_check_dblog_php_threshold', $form_state['values']['prod_check_dblog_php_threshold']); + } + // APC/OPcache. variable_set('prod_check_apc_expunge', $form_state['values']['prod_check_apc_expunge']); variable_set('prod_check_apcuser', $form_state['values']['prod_check_apcuser']); if (!empty($form_state['values']['prod_check_apcpass'])) { @@ -1031,11 +1033,22 @@ function _prod_check_dbstatus_pgsql($db_name, $details) { /** * Integration of the APC status page. */ -function prod_check_apc() { - define('ADMIN_USERNAME', variable_get('prod_check_apcuser', 'apc')); - define('ADMIN_PASSWORD', variable_get('prod_check_apcpass', 'password')); - include(drupal_get_path('module', 'prod_check') . '/includes/prod_check.apc.inc'); - exit; +function prod_check_apc_opc() { + // APC. + if (function_exists('apc_cache_info')) { + define('ADMIN_USERNAME', variable_get('prod_check_apcuser', 'apc')); + define('ADMIN_PASSWORD', variable_get('prod_check_apcpass', 'password')); + include(drupal_get_path('module', 'prod_check') . '/includes/prod_check.apc.inc'); + exit; + } + // OPcache. + elseif (function_exists('opcache_get_status')) { + include(drupal_get_path('module', 'prod_check') . '/includes/prod_check.opcache.inc'); + exit; + } + else { + return t('APC nor OPcache is installed on this webserver!'); + } } /** diff --git a/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.data_sample.inc b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.data_sample.inc new file mode 100644 index 00000000..5ee18fdf --- /dev/null +++ b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.data_sample.inc @@ -0,0 +1,502 @@ + true, + 'cache_full' => false, + 'memory_usage' => + array ( + 'used_memory' => 12028872, + 'free_memory' => 4235696, + 'wasted_memory' => 512648, + 'current_wasted_percentage' => 3.0556201934814, + ), + 'opcache_statistics' => + array ( + 'num_cached_scripts' => 59, + 'num_cached_keys' => 78, + 'max_cached_keys' => 223, + 'hits' => 66817, + 'last_restart_time' => 0, + 'misses' => 126, + 'blacklist_misses' => 0, + 'blacklist_miss_ratio' => 0, + 'opcache_hit_rate' => 99.81178017119, + 'oom_restarts' => 0, + 'manual_restarts' => 0, + 'hash_restarts' => 0, + ), + 'scripts' => + array ( + '/var/www/phpweb/manual/en/toc/faq.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/faq.inc', + 'hits' => 9, + 'memory_consumption' => 5680, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345905, + ), + '/var/www/phpweb/downloads.php' => + array ( + 'full_path' => '/var/www/phpweb/downloads.php', + 'hits' => 86, + 'memory_consumption' => 9488, + 'last_used' => 'Sat Mar 16 12:03:47 2013', + 'last_used_timestamp' => 1363460627, + 'timestamp' => 1355102402, + ), + '/var/www/phpweb/include/languages.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/languages.inc', + 'hits' => 5605, + 'memory_consumption' => 16984, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1362994804, + ), + '/var/www/phpweb/include/header.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/header.inc', + 'hits' => 9, + 'memory_consumption' => 20352, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1357938001, + ), + '/var/www/phpweb/manual/en/toc/getting-started.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/getting-started.inc', + 'hits' => 9, + 'memory_consumption' => 1936, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345409, + ), + '/var/www/phpweb/manual/en/faq.php' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/faq.php', + 'hits' => 122, + 'memory_consumption' => 5152, + 'last_used' => 'Sat Mar 16 12:06:15 2013', + 'last_used_timestamp' => 1363460775, + 'timestamp' => 1363345906, + ), + '/var/www/phpweb/include/footer.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/footer.inc', + 'hits' => 9, + 'memory_consumption' => 1976, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/site.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/site.inc', + 'hits' => 5605, + 'memory_consumption' => 63488, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1354724402, + ), + '/var/www/phpweb/include/mirrors.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/mirrors.inc', + 'hits' => 5605, + 'memory_consumption' => 96160, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363419613, + ), + '/var/www/phpweb/manual/en/toc/refs.basic.vartype.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/refs.basic.vartype.inc', + 'hits' => 9, + 'memory_consumption' => 5032, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345844, + ), + '/var/www/phpweb/include/layout.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/layout.inc', + 'hits' => 5605, + 'memory_consumption' => 145704, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1356610801, + ), + '/var/www/phpweb/sites.php' => + array ( + 'full_path' => '/var/www/phpweb/sites.php', + 'hits' => 73, + 'memory_consumption' => 2024, + 'last_used' => 'Sat Mar 16 12:10:10 2013', + 'last_used_timestamp' => 1363461010, + 'timestamp' => 1354724402, + ), + '/var/www/phpweb/search.php' => + array ( + 'full_path' => '/var/www/phpweb/search.php', + 'hits' => 3083, + 'memory_consumption' => 19728, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1347648005, + ), + '/var/www/phpweb/manual/en/toc/langref.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/langref.inc', + 'hits' => 49, + 'memory_consumption' => 7416, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345411, + ), + '/var/www/phpweb/manual/en/toc/index.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/index.inc', + 'hits' => 132, + 'memory_consumption' => 4680, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345409, + ), + '/var/www/phpweb/docs.php' => + array ( + 'full_path' => '/var/www/phpweb/docs.php', + 'hits' => 73, + 'memory_consumption' => 4536, + 'last_used' => 'Sat Mar 16 12:04:36 2013', + 'last_used_timestamp' => 1363460676, + 'timestamp' => 1347648000, + ), + '/var/www/phpweb/include/shared-manual.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/shared-manual.inc', + 'hits' => 122, + 'memory_consumption' => 107688, + 'last_used' => 'Sat Mar 16 12:06:15 2013', + 'last_used_timestamp' => 1363460775, + 'timestamp' => 1357938001, + ), + '/var/www/phpweb/include/mozopensearch.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/mozopensearch.inc', + 'hits' => 14, + 'memory_consumption' => 1232, + 'last_used' => 'Sat Mar 16 12:00:34 2013', + 'last_used_timestamp' => 1363460434, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/ip-to-country.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/ip-to-country.inc', + 'hits' => 5605, + 'memory_consumption' => 21840, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/version.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/version.inc', + 'hits' => 775, + 'memory_consumption' => 7880, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363321202, + ), + '/var/www/phpweb/include/errors.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/errors.inc', + 'hits' => 691, + 'memory_consumption' => 59888, + 'last_used' => 'Sat Mar 16 12:10:33 2013', + 'last_used_timestamp' => 1363461033, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/countries.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/countries.inc', + 'hits' => 5605, + 'memory_consumption' => 31184, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363419614, + ), + '/var/www/phpweb/error.php' => + array ( + 'full_path' => '/var/www/phpweb/error.php', + 'hits' => 691, + 'memory_consumption' => 61952, + 'last_used' => 'Sat Mar 16 12:10:33 2013', + 'last_used_timestamp' => 1363461033, + 'timestamp' => 1347648000, + ), + '/var/www/phpweb/manual/en/toc/refs.basic.text.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/refs.basic.text.inc', + 'hits' => 9, + 'memory_consumption' => 3312, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345831, + ), + '/var/www/phpweb/include/loadavg.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/loadavg.inc', + 'hits' => 3775, + 'memory_consumption' => 12184, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1354738801, + ), + '/var/www/phpweb/include/prepend.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/prepend.inc', + 'hits' => 5605, + 'memory_consumption' => 23432, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/o.php' => + array ( + 'full_path' => '/var/www/phpweb/o.php', + 'hits' => 1, + 'memory_consumption' => 13424, + 'last_used' => 'Sat Mar 16 18:11:21 2013', + 'last_used_timestamp' => 1363482681, + 'timestamp' => 1363482654, + ), + '/var/www/phpweb/include/pregen-events.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/pregen-events.inc', + 'hits' => 1141, + 'memory_consumption' => 840, + 'last_used' => 'Sat Mar 16 12:15:07 2013', + 'last_used_timestamp' => 1363461307, + 'timestamp' => 1363419615, + ), + '/var/www/phpweb/opcache.php' => + array ( + 'full_path' => '/var/www/phpweb/opcache.php', + 'hits' => 0, + 'memory_consumption' => 13944, + 'last_used' => 'Sun Mar 17 01:22:31 2013', + 'last_used_timestamp' => 1363508551, + 'timestamp' => 1363508542, + ), + '/var/www/phpweb/manual/en/toc/refs.calendar.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/refs.calendar.inc', + 'hits' => 9, + 'memory_consumption' => 2264, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345437, + ), + '/var/www/phpweb/manual/en/toc/security.inc' => + array ( + 'full_path' => '/var/www/phpweb/manual/en/toc/security.inc', + 'hits' => 19, + 'memory_consumption' => 5352, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363345419, + ), + '/var/www/phpweb/include/pregen-news.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/pregen-news.inc', + 'hits' => 1161, + 'memory_consumption' => 57896, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363419615, + ), + '/var/www/phpweb/my.php' => + array ( + 'full_path' => '/var/www/phpweb/my.php', + 'hits' => 34, + 'memory_consumption' => 22640, + 'last_used' => 'Sat Mar 16 12:15:15 2013', + 'last_used_timestamp' => 1363461315, + 'timestamp' => 1354724402, + ), + '/var/www/phpweb/include/pregen-confs.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/pregen-confs.inc', + 'hits' => 678, + 'memory_consumption' => 1400, + 'last_used' => 'Sat Mar 16 12:02:49 2013', + 'last_used_timestamp' => 1363460569, + 'timestamp' => 1363419615, + ), + '/var/www/index.php' => + array ( + 'full_path' => '/var/www/index.php', + 'hits' => 1, + 'memory_consumption' => 744, + 'last_used' => 'Sat Mar 16 12:01:20 2013', + 'last_used_timestamp' => 1363460480, + 'timestamp' => 1358644238, + ), + '/var/www/phpweb/index-stable.php' => + array ( + 'full_path' => '/var/www/phpweb/index-stable.php', + 'hits' => 679, + 'memory_consumption' => 22208, + 'last_used' => 'Sat Mar 16 12:02:49 2013', + 'last_used_timestamp' => 1363460569, + 'timestamp' => 1347648003, + ), + '/var/www/phpweb/conferences/index.php' => + array ( + 'full_path' => '/var/www/phpweb/conferences/index.php', + 'hits' => 462, + 'memory_consumption' => 3872, + 'last_used' => 'Sat Mar 16 12:15:07 2013', + 'last_used_timestamp' => 1363461307, + 'timestamp' => 1347648000, + ), + '/var/www/phpweb/support.php' => + array ( + 'full_path' => '/var/www/phpweb/support.php', + 'hits' => 73, + 'memory_consumption' => 1912, + 'last_used' => 'Sat Mar 16 12:06:40 2013', + 'last_used_timestamp' => 1363460800, + 'timestamp' => 1347648005, + ), + '/var/www/phpweb/op.php' => + array ( + 'full_path' => '/var/www/phpweb/op.php', + 'hits' => 0, + 'memory_consumption' => 1448, + 'last_used' => 'Sun Mar 17 01:34:33 2013', + 'last_used_timestamp' => 1363509273, + 'timestamp' => 1363509263, + ), + '/var/www/phpweb/include/posttohost.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/posttohost.inc', + 'hits' => 342, + 'memory_consumption' => 3824, + 'last_used' => 'Sat Mar 16 12:09:18 2013', + 'last_used_timestamp' => 1363460958, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/langchooser.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/langchooser.inc', + 'hits' => 5605, + 'memory_consumption' => 23784, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1347648001, + ), + '/var/www/phpweb/include/manual-lookup.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/manual-lookup.inc', + 'hits' => 624, + 'memory_consumption' => 26648, + 'last_used' => 'Sat Mar 16 12:10:33 2013', + 'last_used_timestamp' => 1363461033, + 'timestamp' => 1354750802, + ), + '/var/www/phpweb/mailing-lists.php' => + array ( + 'full_path' => '/var/www/phpweb/mailing-lists.php', + 'hits' => 342, + 'memory_consumption' => 31576, + 'last_used' => 'Sat Mar 16 12:09:18 2013', + 'last_used_timestamp' => 1363460958, + 'timestamp' => 1361200802, + ), + '/var/www/phpweb/include/last_updated.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/last_updated.inc', + 'hits' => 5605, + 'memory_consumption' => 840, + 'last_used' => 'Sat Mar 16 12:16:31 2013', + 'last_used_timestamp' => 1363461391, + 'timestamp' => 1363419675, + ), + '/var/www/phpweb/include/email-validation.inc' => + array ( + 'full_path' => '/var/www/phpweb/include/email-validation.inc', + 'hits' => 342, + 'memory_consumption' => 9168, + 'last_used' => 'Sat Mar 16 12:09:18 2013', + 'last_used_timestamp' => 1363460958, + 'timestamp' => 1362175205, + ), + '/var/www/phpweb/index.php' => + array ( + 'full_path' => '/var/www/phpweb/index.php', + 'hits' => 679, + 'memory_consumption' => 1840, + 'last_used' => 'Sat Mar 16 12:02:49 2013', + 'last_used_timestamp' => 1363460569, + 'timestamp' => 1347648003, + ), + ), + ); +} + +function opcache_get_configuration() { + return array ( + 'directives' => + array ( + 'opcache.enable' => true, + 'opcache.enable_cli' => false, + 'opcache.use_cwd' => true, + 'opcache.validate_timestamps' => true, + 'opcache.inherited_hack' => true, + 'opcache.dups_fix' => false, + 'opcache.revalidate_path' => false, + 'opcache.log_verbosity_level' => 4, + 'opcache.memory_consumption' => 16777216, + 'opcache.interned_strings_buffer' => 8, + 'opcache.max_accelerated_files' => 200, + 'opcache.max_wasted_percentage' => 0.05, + 'opcache.consistency_checks' => 0, + 'opcache.force_restart_timeout' => 180, + 'opcache.revalidate_freq' => 0, + 'opcache.preferred_memory_model' => '', + 'opcache.blacklist_filename' => '/etc/zo_blacklist.txt', + 'opcache.max_file_size' => 0, + 'opcache.error_log' => '', + 'opcache.protect_memory' => false, + 'opcache.save_comments' => true, + 'opcache.load_comments' => true, + 'opcache.fast_shutdown' => true, + 'opcache.enable_file_override' => false, + 'opcache.optimization_level' => 4294967295, + ), + 'version' => + array ( + 'version' => '7.0.1-dev', + 'opcache_product_name' => 'Zend Optimizer+', + ), + 'blacklist' => + array ( + 0 => '/var/www/www.php.net/manual/es', + 1 => '/var/www/www.php.net/manual/it', + 2 => '/var/www/www.php.net/manual/bg', + 3 => '/var/www/www.php.net/manual/fa', + 4 => '/var/www/www.php.net/manual/fr', + 5 => '/var/www/www.php.net/manual/kr', + 6 => '/var/www/www.php.net/manual/pt_BR', + 7 => '/var/www/www.php.net/manual/tr', + 8 => '/var/www/www.php.net/manual/de', + 9 => '/var/www/www.php.net/manual/ro', + 10 => '/var/www/www.php.net/manual/ru', + 11 => '/var/www/www.php.net/manual/zh', + 12 => '/var/www/www.php.net/manual/ja', + 13 => '/var/www/www.php.net/manual/pl', + 14 => '/var/www/www.php.net/manual/sr', + ), + ); +} diff --git a/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.inc b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.inc new file mode 100644 index 00000000..ce8e1db1 --- /dev/null +++ b/sites/all/modules/contrib/dev/prod_check/includes/prod_check.opcache.inc @@ -0,0 +1,748 @@ +You do not have the Zend OPcache extension loaded, sample data is being shown instead.'; + require 'prod_check.opcache.data_sample.inc'; +} + +class OpCacheDataModel +{ + private $_configuration; + private $_status; + private $_d3Scripts = array(); + + public function __construct() + { + $this->_configuration = opcache_get_configuration(); + $this->_status = opcache_get_status(); + } + + public function getPageTitle() + { + return 'PHP ' . phpversion() . " with OpCache {$this->_configuration['version']['version']}"; + } + + public function getStatusDataRows() + { + $rows = array(); + foreach ($this->_status as $key => $value) { + if ($key === 'scripts') { + continue; + } + + if (is_array($value)) { + foreach ($value as $k => $v) { + if ($v === false) { + $value = 'false'; + } + if ($v === true) { + $value = 'true'; + } + if ($k === 'used_memory' || $k === 'free_memory' || $k === 'wasted_memory') { + $v = $this->_size_for_humans( + $v + ); + } + if ($k === 'current_wasted_percentage' || $k === 'opcache_hit_rate') { + $v = number_format( + $v, + 2 + ) . '%'; + } + if ($k === 'blacklist_miss_ratio') { + $v = number_format($v, 2) . '%'; + } + if ($k === 'start_time' || $k === 'last_restart_time') { + $v = ($v ? date(DATE_RFC822, $v) : 'never'); + } + if (THOUSAND_SEPARATOR === true && is_int($v)) { + $v = number_format($v); + } + + $rows[] = "Hits | +Memory | +Path | +
---|
'.t('Production check is a module that will add a report detailing the status of several settings and modules. The report is tailored for a production environment. It will tell you which modules should (not) be running, what settings are OK or not and much more. It is an easy way to have an overview of the status of your site when bringing it live, so that you can quickly put all the configuration details in order to be ready for production use.').'
'; - $output .= ''.t('Using the settings page, you can enable XMLRPC support so that it can report back to the Production monitor module, available as an extra module in this package. If you install the Production monitor module on a central site, you can monitor several sites in a glance, ensuring that no one changes settings without you knowing about it. See the Production monitor built in help for more information.').'
'; - $output .= ''.t('If you prefer using !link for monitoring, you can simply enable support for that on the settings page by ticking the appropriate checkmark. An extra set of checkboxes will appear, allowing you to configure in detail what exactly you wish !link to monitor.', prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')).'
'; + $output .= '' . t('Production check is a module that will add a report detailing the status of several settings and modules. The report is tailored for a production environment. It will tell you which modules should (not) be running, what settings are OK or not and much more. It is an easy way to have an overview of the status of your site when bringing it live, so that you can quickly put all the configuration details in order to be ready for production use.') . '
'; + $output .= '' . t('Using the settings page, you can enable XMLRPC support so that it can report back to the Production monitor module, available as an extra module in this package. If you install the Production monitor module on a central site, you can monitor several sites in a glance, ensuring that no one changes settings without you knowing about it. See the Production monitor built in help for more information.') . '
'; + $output .= '' . t('If you prefer using !link for monitoring, you can simply enable support for that on the settings page by ticking the appropriate checkmark. An extra set of checkboxes will appear, allowing you to configure in detail what exactly you wish !link to monitor.', prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')) . '
'; break; case 'admin/reports/prod-check': case 'admin/reports/prod-check/status': - $output .= ''.t('This is an overview of all checks performed by the Production check module and their status. You can click the links inside the report to jump to the module\'s settings page, or to go to the project page of a module, in case you need to download it for installation.').'
'; + $output .= '' . t("This is an overview of all checks performed by the Production check module and their status. You can click the links inside the report to jump to the module's settings page, or to go to the project page of a module, in case you need to download it for installation.") . '
'; break; case 'admin/config/system/prod-check': - $output .= ''.t('Sitemail check').'
';
- $output .= t('The value entered here is used in a regular expression. Prod check will use it to see if the e-mail address you have entered in Site information is no longer a development e-mail address.').'
'.t('Advanced APC settings').'
';
- $output .= t('Production check enables a hidden path where you can review your APC setup. This is absolutely unmissable if you want to properly setup APC and tune it specifically for your website.').'
'.t('Enable XMLRPC API').'
';
- $output .= t('By ticking this box, you open up the module\'s XMLRPC functions so they can be called by the Production monitor module for remote monitoring of your site. When enabling XMLRPC, you must enter an API key to secure the transfer of data. It\'s limited to 128 characters. A mixture of alphanumeric and special characters will increase security.').'
'.t('Report module list every x at time y').'
';
- $output .= t('Select on which day of the week and at what time Production check is allowed to pass the module list of the site it is on to Production monitor. Set this carefully, as the amount data being transfered is quite big!').'
';
- $output .= t('Depending on when the cron is run on the Production monitor site, the module list will be reported on or maybe even several hours(!) after the time given here!').'
'.t('Enable Nagios integration').'
';
- $output .= t('By ticking this box, you open up the module\'s Nagios hooks, so that it can interface with the !link module. You will obviously need to install this module next to Production check to enable this functionality.', prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')).'
';
- $output .= t('When the checkbox is enabled, a new array of checkboxes will appear, allowing you to specify in detail what will be reported to !link.', prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')).'
' . t('Sitemail check') . '
';
+ $output .= t('The value entered here is used in a regular expression. Prod check will use it to see if the e-mail address you have entered in Site information is no longer a development e-mail address.') . '
' . t('Advanced APC/OPcache settings') . '
';
+ $output .= t('Production check enables a hidden path where you can review your APC setup. This is absolutely unmissable if you want to properly setup APC and tune it specifically for your website.') . '
' . t('Enable XMLRPC API') . '
';
+ $output .= t("By ticking this box, you open up the module's XMLRPC functions so they can be called by the Production monitor module for remote monitoring of your site. When enabling XMLRPC, you must enter an API key to secure the transfer of data. It's limited to 128 characters. A mixture of alphanumeric and special characters will increase security.") . '
' . t('Report module list every x at time y') . '
';
+ $output .= t('Select on which day of the week and at what time Production check is allowed to pass the module list of the site it is on to Production monitor. Set this carefully, as the amount data being transfered is quite big!') . '
';
+ $output .= t('Depending on when the cron is run on the Production monitor site, the module list will be reported on or maybe even several hours(!) after the time given here!') . '
' . t('Enable Nagios integration') . '
';
+ $output .= t("By ticking this box, you open up the module's Nagios hooks, so that it can interface with the !link module. You will obviously need to install this module next to Production check to enable this functionality.", prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')) . '
';
+ $output .= t('When the checkbox is enabled, a new array of checkboxes will appear, allowing you to specify in detail what will be reported to !link.', prod_check_link_array('Nagios', 'http://drupal.org/project/nagios')) . '
'.t($data['description']).'
' . t($data['description']) . '
'.$nodata.'
'; + $output .= '
' . $nodata . '
'; } } } if (empty($output)) { - $output = '
'.$nodata.'
'; + $output = '
' . $nodata . '
'; } // TODO: do not use drupal_render but change this so that hook_page_alter can // be used as well. - $output .= drupal_render(drupal_get_form('_prod_monitor_update_data_form', $id, $site)); + $form = drupal_get_form('_prod_monitor_update_data_form', $id, $site); + $output .= drupal_render($form); return $output; } @@ -51,30 +59,54 @@ function prod_monitor_status($id) { * Helper function to provide general status block on status overview page */ function _prod_monitor_status_general($prod_mon, $modules) { - // TODO: Should we hide the rows for which no data is being retrieved? - $cron = t('Unknown'); - if (isset($prod_mon['prod_check_cron_last'])) { - $cron = format_date($prod_mon['prod_check_cron_last'], 'large'); - } - $updates = _prod_monitor_generate_updates_link($modules['id'], $modules['updates']); - $output = '
' . $data . '
'; return $output; } $output = ''.t('Production monitor is a module that can connect to the Production check module using XMLRPC and an API key. It will retrieve all specified data from the remote site to create a satus page and monitoring facility in a central place.').'
';
- $output .= t('You can add multiple sites and configure per site what data you wish (not) to monitor, allowing you to setup a central Drupal site that will monitor all of your sites that have the Production check module with XMLRPC enabled.').'
';
- $output .= t('The data retrieval mechanism can be called manually and is integrated with the cron, so you get a fresh update of data each cron run.').'
' . t('Production monitor is a module that can connect to the Production check module using XMLRPC and an API key. It will retrieve all specified data from the remote site to create a satus page and monitoring facility in a central place.') . '
';
+ $output .= t('You can add multiple sites and configure per site what data you wish (not) to monitor, allowing you to setup a central Drupal site that will monitor all of your sites that have the Production check module with XMLRPC enabled.') . '
';
+ $output .= t('The data retrieval mechanism can be called manually and is integrated with the cron, so you get a fresh update of data each cron run.') . '
'.t('Site overview table').'
';
- $output .= t('The overview table gives you an overview of what sites you have added together with their status. The status will be the highest error detected in the retrieved data set.').'
';
- $output .= t('The per site functions View, Edit, Fetch data, Flush and Delete should be self explanatory.').'
' . t('Site overview table') . '
';
+ $output .= t('The overview table gives you an overview of what sites you have added together with their status. The status will be the highest error detected in the retrieved data set.') . '
';
+ $output .= t('The per site functions View, Edit, Fetch data, Flush and Delete should be self explanatory.') . '
'.t('Website URL & API key').'
';
- $output .= t('To add a site, enter it\'s full url, including the protocol, but omitting the xmlrpc.php part and the API key that you have configured for it using the Production check module. Now click the Get settings button.').'
';
- $output .= t('All of the checks that the Production check module can perform are fetched from the remote site and presented as an array of checkboxes. Finally you can configure what exactly you wish to monitor for this site, then hit the Add site button.').'
';
- $output .= t('Each time you edit a site, the settings are fetched from the remote server so that any new checks that might have been added to the Production check module there are always up to date in the monitoring section.').'
'; $output .= t('Fetch data immediately does exactly what it says and fetches all the configured data from the remote site and will direct you to the report page.').'
' . t('Website URL & API key') . '
';
+ $output .= t("To add a site, enter it's full url, including the protocol, but omitting the xmlrpc.php part and the API key that you have configured for it using the Production check module. Now click the Get settings button.") . '
';
+ $output .= t('All of the checks that the Production check module can perform are fetched from the remote site and presented as an array of checkboxes. Finally you can configure what exactly you wish to monitor for this site, then hit the Add site button.') . '
';
+ $output .= t('Each time you edit a site, the settings are fetched from the remote server so that any new checks that might have been added to the Production check module there are always up to date in the monitoring section.') . '
';
+ $output .= t('Fetch data immediately does exactly what it says and fetches all the configured data from the remote site and will direct you to the report page.') . '
' . t('Module name') . '
';
+ $output .= t("Enter (part of) the module's machine name to see what sites are using the module.") . '
';
break;
case 'admin/reports/prod-monitor/site/%':
case 'admin/reports/prod-monitor/site/%/view':
- $output .= '
'.t('This is an overview of all checks performed by the Production check module and their status on the remote site. You can click the links inside the report to jump to the module\'s settings page, or to go to the project page of a module, in case you need to download it for installation.').'
'; + $output .= '' . t("This is an overview of all checks performed by the Production check module and their status on the remote site. You can click the links inside the report to jump to the module's settings page, or to go to the project page of a module, in case you need to download it for installation.") . '
'; break; } return $output; @@ -89,6 +97,25 @@ function prod_monitor_menu() { 'file' => 'includes/prod_monitor.admin.inc', ); + // Default primary tab (callback for this is it's parent path). + $items['admin/reports/prod-monitor/overview'] = array( + 'title' => 'Overview', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => 0, + ); + + $items['admin/reports/prod-monitor/module-lookup'] = array( + 'title' => 'Module lookup', + 'description' => 'Searches monitored applications for module versions.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('prod_monitor_module_lookup_form'), + 'access callback' => 'user_access', + 'access arguments' => array('access production monitor'), + 'type' => MENU_LOCAL_TASK, + 'file' => 'includes/prod_monitor.admin.inc', + 'weight' => 1, + ); + // This hook_menu() thing, still can't fully see the logic in it. However, // this here is what I want to achieve. It would be nice to see the /view/ bit // in the path dissapear, that would finish it entirely. I'll settle for this @@ -330,8 +357,10 @@ function prod_monitor_cron() { foreach ($sites as $id => $site_info) { $elapsed = time() - $cron_start; if ($elapsed < $time_limit) { - //TODO: add module status update check here. + // First: all checks. _prod_monitor_retrieve_data($id, $site_info); + // MUST be second because of the status update! + _prod_monitor_db_connect_check($id, $site_info); $process++; } else { @@ -367,7 +396,7 @@ function _prod_monitor_retrieve_functions($url, $api_key, $msg = TRUE) { 'error' ); } - else if ($msg) { + elseif ($msg) { drupal_set_message(t('Settings form updated, please adjust your settings.')); } @@ -469,7 +498,7 @@ function _prod_monitor_retrieve_data($id, $site_info, $msg = FALSE) { ); } } - else if ($msg) { + elseif ($msg) { drupal_set_message(t('Module data for %link successfully updated.', array('%link' => $site_info['url']))); } } @@ -495,7 +524,7 @@ function _prod_monitor_retrieve_data($id, $site_info, $msg = FALSE) { ); } } - else if ($msg) { + elseif ($msg) { drupal_set_message(t('Performance data for %link successfully updated.', array('%link' => $site_info['url']))); } } @@ -504,6 +533,42 @@ function _prod_monitor_retrieve_data($id, $site_info, $msg = FALSE) { } } +/** + * Perform separate dbconnect check. We cannot incorporate this at the side of + * prod_check as this would make no sense at all when the DB is down. + */ +function _prod_monitor_db_connect_check($id, $site_info) { + // Execute only if setup properly. + if (empty($site_info['settings']['dbconnect_path'])) { + return; + } + + // Do the check. + $dbconnect_path = rtrim($site_info['url'], '/') . '/' . $site_info['settings']['dbconnect_path']; + $response = drupal_http_request($dbconnect_path); + if ($response->code !== '200' && $response->data !== 'OK') { + // Update status to notify the user of the problem! + $site_info['status'] = PROD_MONITOR_REQUIREMENT_ERROR; + $response->data = 'NOK'; + } + + // ALWAYS get stored site data as it should have been updated right before + // calling this function! + $site_data = _prod_monitor_get_site($id, 'data'); + // Add data to site and save. + $site_data['data']['prod_mon']['prod_check_dbconnect'] = $response->code . ' ' . $response->data; + + // Store site data + $site = new stdClass(); + $site->id = $id; + if (isset($site_info['status'])) { + $site->status = $site_info['status']; + } + $site->data = serialize($site_data['data']); + $site->lastupdate = REQUEST_TIME; + $result = drupal_write_record('prod_monitor_sites', $site, array('id')); +} + /** * Helper function to get all sites. */ @@ -526,7 +591,7 @@ function _prod_monitor_get_sites($start_id = FALSE) { if (!empty($row->data)) { foreach ($row->data as $set => $checks) { foreach ($checks as $check => $results) { - $status = ($results['severity'] > $status) ? $results['severity'] : $status; + $status = (isset($results['severity']) && $results['severity'] > $status) ? $results['severity'] : $status; } } $data_status = TRUE; @@ -561,21 +626,33 @@ function _prod_monitor_get_sites($start_id = FALSE) { * * @param $id * int site id. - * @param $all - * Boolean whether or not to return all fields or just the url and settings. + * @param $type + * String the amount of data to be returned. */ -function _prod_monitor_get_site($id, $all = FALSE) { - if (!$all) { - $site = db_query("SELECT url, settings FROM {prod_monitor_sites} WHERE id = :id", array(':id' => $id))->fetchAssoc(); - } - else { - $site = db_query("SELECT * FROM {prod_monitor_sites} WHERE id = :id", array(':id' => $id))->fetchAssoc(); +function _prod_monitor_get_site($id, $type = 'settings') { + switch ($type) { + case 'settings': + $site = db_query("SELECT url, settings FROM {prod_monitor_sites} WHERE id = :id", array(':id' => $id))->fetchAssoc(); + break; + case 'all': + $site = db_query("SELECT * FROM {prod_monitor_sites} WHERE id = :id", array(':id' => $id))->fetchAssoc(); + break; + case 'data': + $site = db_query("SELECT data FROM {prod_monitor_sites} WHERE id = :id", array(':id' => $id))->fetchAssoc(); + break; } if (!empty($site)) { - $site['settings'] = unserialize($site['settings']); - if ($all) { - $site['data'] = unserialize($site['data']); + switch ($type) { + case 'all': + $site['data'] = unserialize($site['data']); + // No break! + case 'settings': + $site['settings'] = unserialize($site['settings']); + break; + case 'data': + $site['data'] = unserialize($site['data']); + break; } } @@ -607,6 +684,25 @@ function _prod_monitor_get_site_modules($id, $exists = FALSE) { return $modules; } +/** + * Returns an array of ignored directives by site id. + * + * @param int $id The site id. + * + * @return array + * - updates array List of project names, whose update status we'll ignore. + */ +function _prod_monitor_get_site_ignored($id) { + $ignored = &drupal_static(__FUNCTION__, array()); + if (!array_key_exists($id, $ignored)) { + $ignored[$id] = module_invoke_all('prod_monitor_ignore', $id) + array( + 'updates' => array(), + ); + } + + return $ignored[$id]; +} + /** * Helper function to get the module status of a site by ID. * diff --git a/sites/all/modules/contrib/theming/colorbox/README.txt b/sites/all/modules/contrib/theming/colorbox/README.txt index a5c217e2..31cb8901 100644 --- a/sites/all/modules/contrib/theming/colorbox/README.txt +++ b/sites/all/modules/contrib/theming/colorbox/README.txt @@ -89,7 +89,7 @@ Make any CSS adjustments to your "colorbox_mycolorbox.css" file. Load images from custom links in a Colorbox: -------------------------------------------- -Add the class "colorbox" to the link and point the src to the image +Add the class "colorbox" to the link and point its href attribute to the image you want to display in the Colorbox. diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.api.php b/sites/all/modules/contrib/theming/colorbox/colorbox.api.php index 83ead10d..61495bab 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.api.php +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.api.php @@ -27,3 +27,18 @@ function hook_colorbox_settings_alter(&$settings, &$style) { $style = 'mystyle'; } } + +/** + * Allows to override activation of Colobox for the current URL. + * + * @param $active + * A boolean indicating whether colorbox should be active for the current + * URL or not. + */ +function hook_colorbox_active_alter(&$active) { + $path = drupal_get_path_alias($_GET['q']); + if (drupal_match_path($path, 'admin/config/colorbox_test')) { + // Enable colorbox for this URL. + $active = TRUE; + } +} diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.info b/sites/all/modules/contrib/theming/colorbox/colorbox.info index 68a3d4e7..4b5fda87 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.info +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.info @@ -1,14 +1,14 @@ name = Colorbox description = A light-weight, customizable lightbox plugin for jQuery 1.4.3+. -dependencies[] = libraries (2.x) +dependencies[] = libraries (>=2.x) core = 7.x configure = admin/config/media/colorbox files[] = views/colorbox_handler_field_colorbox.inc -; Information added by Drupal.org packaging script on 2014-09-12 -version = "7.x-2.8" +; Information added by Drupal.org packaging script on 2015-10-01 +version = "7.x-2.10" core = "7.x" project = "colorbox" -datestamp = "1410514129" +datestamp = "1443691449" diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.module b/sites/all/modules/contrib/theming/colorbox/colorbox.module index da22f8ae..e3d94d23 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.module +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.module @@ -152,6 +152,9 @@ function _colorbox_active() { } $page_match = variable_get('colorbox_visibility', 0) == 0 ? !$page_match : $page_match; + // Allow other modules to change the state of colorbox for the current URL. + drupal_alter('colorbox_active', $page_match); + return $page_match; } diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc index 89e38ba7..74ceaf88 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc @@ -17,6 +17,7 @@ * @ingroup themeable */ function theme_colorbox_image_formatter($variables) { + static $gallery_token = NULL; $item = $variables['item']; $entity_type = $variables['entity_type']; $entity = $variables['entity']; @@ -123,6 +124,16 @@ function theme_colorbox_image_formatter($variables) { $gallery_id = ''; } + // If gallery id is not empty add unique per-request token to avoid images being added manually to galleries. + if (!empty($gallery_id)) { + // Check if gallery token has alrady been set, we need to reuse the token for the whole request. + if (is_null($gallery_token)) { + // We use a short token since randomness is not critical. + $gallery_token = drupal_random_key(8); + } + $gallery_id = $gallery_id . '-' . $gallery_token; + } + if ($style_name = $settings['colorbox_image_style']) { $path = image_style_url($style_name, $image['path']); } diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js index ace202ef..cd0520bb 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js @@ -2,7 +2,7 @@ Drupal.behaviors.initColorbox = { attach: function (context, settings) { - if (!$.isFunction($.colorbox)) { + if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { return; } diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js index f515036e..0b27b655 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js @@ -2,7 +2,7 @@ Drupal.behaviors.initColorboxInline = { attach: function (context, settings) { - if (!$.isFunction($.colorbox)) { + if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { return; } $.urlParam = function(name, url){ diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js index e63043ed..30e99a77 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js @@ -2,7 +2,7 @@ Drupal.behaviors.initColorboxLoad = { attach: function (context, settings) { - if (!$.isFunction($.colorbox)) { + if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { return; } $.urlParams = function (url) { diff --git a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc index 27a20452..205d0995 100644 --- a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc +++ b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc @@ -162,10 +162,15 @@ If you would like to have the characters %5B and %5D please use the html entity $tokens = $this->get_render_tokens($this->options['alter']); $popup = filter_xss_admin($this->options['popup']); $caption = filter_xss_admin($this->options['caption']); - $gallery = drupal_html_class($this->options['custom_gid']); + $gallery = filter_xss_admin($this->options['custom_gid']); $popup = strtr($popup, $tokens); $caption = strtr($caption, $tokens); - $gallery = strtr($gallery, $tokens); + $gallery = drupal_html_class(strtr($gallery, $tokens)); + + // Return nothing if popup is empty. + if (empty($popup)) { + return; + } $width = $this->options['width'] ? $this->options['width'] : ''; $height = $this->options['height'] ? $this->options['height'] : '';