diff --git a/boost.admin.inc b/boost.admin.inc index 8c36a29cbfb7b1ec4e124a4ae76ba48e9ed920cc..0184069a145da2e07416213d6d12420544c2256d 100644 --- a/boost.admin.inc +++ b/boost.admin.inc @@ -745,7 +745,7 @@ function boost_admin_boost_performance_page() { '#type' => 'checkbox', '#default_value' => variable_get('boost_domain_whitelist_use_domain', FALSE), '#title' => t('Include all managed domains in the whitelist.'), - '#description' => t('If this box is checked, all domains and domain aliases managed by the Domains module will be whitelisted automatically.'), + '#description' => t('If this box is checked, all domains and domain aliases managed by the Domain Access module will be whitelisted automatically.'), ); } $form['domain']['boost_domain_whitelist_wild'] = array( @@ -1182,24 +1182,28 @@ function boost_admin_boost_performance_page_validate($form, &$form_state) { $whitelist_values = explode("\n", $form_state['values']['boost_domain_whitelist']); $whitelist_values = array_map('trim', $whitelist_values); $whitelist = array_combine($whitelist_values, $whitelist_values); - foreach ($whitelist as $key => $value) { - $error_msg = domain_valid_domain($value); - if (!empty($error_msg)) { - $error_msg = str_replace(':', t(' in domain whitelist:'), $error_msg); - form_set_error('boost_domain_whitelist', $error_msg); + if ($form_state['values']['boost_domain_whitelist']) { + foreach ($whitelist as $key => $value) { + $error_msg = domain_valid_domain($value); + if (!empty($error_msg)) { + $error_msg = str_replace(':', t(' in domain whitelist:'), $error_msg); + form_set_error('boost_domain_whitelist', $error_msg); + } } } $whitelist_wild_values = explode("\n", $form_state['values']['boost_domain_whitelist_wild']); $whitelist_wild_values = array_map('trim', $whitelist_wild_values); $whitelist_wild = array_combine($whitelist_wild_values, $whitelist_wild_values); - foreach ($whitelist_wild as $key => $value) { - $value = str_replace('*', 'qwerqwrkasdwiopekasdn', $value); - $error_msg = domain_valid_domain($value); - if (!empty($error_msg)) { - $error_msg = str_replace(':', t(' in domain wildcard whitelist:'), $error_msg); - $error_msg = str_replace('qwerqwrkasdwiopekasdn', '*', $error_msg); - form_set_error('boost_domain_whitelist_wild', $error_msg); + if ($form_state['values']['boost_domain_whitelist_wild']) { + foreach ($whitelist_wild as $key => $value) { + $value = str_replace('*', 'qwerqwrkasdwiopekasdn', $value); + $error_msg = domain_valid_domain($value); + if (!empty($error_msg)) { + $error_msg = str_replace(':', t(' in domain wildcard whitelist:'), $error_msg); + $error_msg = str_replace('qwerqwrkasdwiopekasdn', '*', $error_msg); + form_set_error('boost_domain_whitelist_wild', $error_msg); + } } } } @@ -1208,11 +1212,13 @@ function boost_admin_boost_performance_page_validate($form, &$form_state) { $blacklist_values = explode("\n", $form_state['values']['boost_domain_blacklist']); $blacklist_values = array_map('trim', $blacklist_values); $blacklist = array_combine($blacklist_values, $blacklist_values); - foreach ($blacklist as $key => $value) { - $error_msg = domain_valid_domain($value); - if (!empty($error_msg)) { - $error_msg = str_replace(':', t(' in domain blacklist:'), $error_msg); - form_set_error('boost_domain_blacklist', $error_msg); + if ($form_state['values']['boost_domain_blacklist']) { + foreach ($blacklist as $key => $value) { + $error_msg = domain_valid_domain($value); + if (!empty($error_msg)) { + $error_msg = str_replace(':', t(' in domain blacklist:'), $error_msg); + form_set_error('boost_domain_blacklist', $error_msg); + } } } } diff --git a/boost.module b/boost.module index 195ba31a8816d0cf279d3e865360ba737146ae3d..f5deb632a36ff1334ce59d3fcb79b0d465db70b5 100644 --- a/boost.module +++ b/boost.module @@ -422,6 +422,24 @@ function boost_views_get_valid_array() { function boost_views_pre_view(&$view) { } +/** +* Send out a fast 404 and exit. +*/ +function boost_fast404() { + global $base_path; + if (!headers_sent()) { + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + } + print '' . "\n"; + print ''; + print '' . t('404 Not Found') . ''; + print '

' . t('Not Found') . '

'; + print '

' . t('The requested URL was not found on this server.') . '

'; + print '

' . t('Home') . '

'; + print ''; + exit(); +} + /** * Implementation of hook_init(). Performs page setup tasks if page not cached. */ @@ -481,8 +499,7 @@ function boost_init() { if (BOOST_VERBOSE >= 7 && isset($_boost['verbose_option_selected']['boost_init_404'])) { watchdog('boost', '404 received from server via redirect, going to send a 404. Info: !output', array('!output' => boost_print_r($_SERVER, TRUE, TRUE))); } - drupal_not_found(); - return; + boost_fast404(); } //set variables @@ -619,6 +636,16 @@ function boost_redirect_handler($destination) { $alt_src = boost_glue_url($alt_parts); $urls = array($alt_src, $source); + $debug = array( + 'destination' => $destination, + 'source' => $source, + 'alt_src' => $alt_src, + 'current_path' => $current_path, + 'current_path_system' => $current_path_system, + 'new_path' => $new_path, + 'new_path_system' => $new_path_system, + ); + // Handle domain alias redirects if ( module_exists('domain_alias') && isset($_domain['redirect']) @@ -655,6 +682,7 @@ function boost_redirect_handler($destination) { if (isset($path_redirects)) { foreach ($path_redirects as $path_redirect) { $current_path_system = $path_redirect['redirect']; + $debug['new_current_path_system'] = $current_path_system; break; } } @@ -668,6 +696,7 @@ function boost_redirect_handler($destination) { if (isset($path_redirects)) { foreach ($path_redirects as $path_redirect) { $current_path_system = $path_redirect['redirect']; + $debug['new_current_path_system'] = $current_path_system; break; } } @@ -689,6 +718,7 @@ function boost_redirect_handler($destination) { } } } + //watchdog('boost-redirect', 'Nothing Done' . str_replace(' ', '    ', nl2br(htmlentities(print_r($debug, TRUE))))); } /** @@ -710,7 +740,7 @@ function boost_redirect_handler($destination) { function boost_exit($destination = NULL) { global $_boost, $user; - // Check for redirects + // Check for redirects. if (!empty($destination) && $_SERVER['REQUEST_METHOD'] != 'POST' && empty($_GET['destination'])) { // Make sure path functions are available. drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); @@ -1245,6 +1275,19 @@ function boost_views_async() { if ($key == $_GET['key']) { // Break connection so processing is async. Return key. boost_async_opp($_GET['key']); + + // Give us lots of ram + $m_limit = ini_get('memory_limit'); + $m_limit_int = substr($m_limit, 0, -1); + $m_limit_int = (int) $m_limit_int; + $m_limit_scale = strtoupper(substr($m_limit, -1)); + if ($m_limit_scale == 'M') { + @ini_set('memory_limit', $m_limit_int*4 . 'M'); + } + + // Give us lots of time + $t_limit = ini_get('max_execution_time'); + @ini_set('max_execution_time', $t_limit*4); } else { return; @@ -1259,7 +1302,17 @@ function boost_views_async() { $_boost['new_nodes'] = $_GET['new_nodes']; // Process list. - return _boost_views_runit(); + $data = _boost_views_runit(); + + // Set ini variables back + if (isset($m_limit)) { + @ini_set('memory_limit', $m_limit); + } + if (isset($t_limit)) { + @ini_set('max_execution_time', $t_limit); + } + + return $data; } /** @@ -3789,6 +3842,7 @@ function boost_cache_set($path, $data, $extension = BOOST_FILE_EXTENSION) { _boost_generate_gzip_test_file(); boost_cache_write($filename, _boost_inject_code($data, '' . "\n")); } else {