function _variable_clean_timeouts in Variable Cleanup 7
Same name and namespace in other branches
- 6 variable_clean.module \_variable_clean_timeouts()
Setup some timeouts and check for required stuff.
1 call to _variable_clean_timeouts()
- variable_clean_form in ./
variable_clean.module - Form builder for variable cleanup.
File
- ./
variable_clean.module, line 260 - Allows you to remove variables not currently used.
Code
function _variable_clean_timeouts() {
// This may take a long time. Set some timeouts in a way that shared hosting can handle.
if (ini_get('safe_mode')) {
drupal_set_message(t('You are running PHP in safe-mode. If you have trouble with PHP timing-out before processing completes you will need to increase "max_execution_time" in php.ini. Note that the use of safe-mode is depricated and not recommended.'), 'error');
}
else {
if (function_exists('set_time_limit')) {
drupal_set_time_limit(300);
}
else {
drupal_set_message(t('The set_time_limit() function does not exist. If you have trouble with PHP timing-out before processing completes you will need to increase "max_execution_time" in php.ini.'), 'error');
}
}
if (function_exists('memory_get_usage')) {
ini_set('memory_limit', '256M');
}
else {
drupal_set_message(t('The version of PHP is old and not compiled with --enable-memory-limit. If you have trouble with PHP timing-out before processing completes you will need to increase "memory_limit" in php.ini. But you should really be using a modern version of PHP.'), 'error');
}
db_query('SET SESSION wait_timeout = 300');
// Test for grep.
$return_var = 0;
$grep_out = array();
exec('grep --version', $grep_out, $return_var);
if ($return_var != 0) {
drupal_set_message(t('This module requires the command line utility "grep". The following error was received: !error', array(
'!error' => $return_var . '<br />' . filter_xss_admin(implode('<br />', $grep_out)),
)));
}
}