? boost-609310.patch ? boost-610198.patch Index: boost.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v retrieving revision 1.1.2.1.2.3.2.93 diff -u -p -r1.1.2.1.2.3.2.93 boost.admin.inc --- boost.admin.inc 21 Oct 2009 01:27:53 -0000 1.1.2.1.2.3.2.93 +++ boost.admin.inc 21 Oct 2009 04:13:30 -0000 @@ -501,6 +501,18 @@ function boost_admin_boost_performance_p 5 => t('5 Record all errors to the db log (watchdog)'), ), ); + $form['advanced']['no_db'] = array( + '#type' => 'fieldset', + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#title' => t('Boost Retro Mode (no database)'), + ); + $form['advanced']['no_db']['boost_no_database'] = array( + '#type' => 'checkbox', + '#title' => t('NOT RECOMMENDED. Do not use the database at all.'), + '#default_value' => BOOST_NO_DATABASE, + '#description' => t('Go old school and don\'t use the database. Very extreme tweak & support for features in this mode is pretty much non existent.'), + ); // Crawler $form['crawler'] = array( @@ -1084,7 +1096,7 @@ function boost_clear_cache_submit() { function boost_clear_expired_cache_submit() { $ignore = variable_get('boost_ignore_flush', 0); $GLOBALS['conf']['boost_ignore_flush'] = 0; - if (boost_cache_db_expire()) { + if (boost_cache_expire_all()) { drupal_set_message(t('Boost: Expired stale files from static page cache.')); } else { Index: boost.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v retrieving revision 1.3.2.2.2.5.2.201 diff -u -p -r1.3.2.2.2.5.2.201 boost.module --- boost.module 21 Oct 2009 03:42:09 -0000 1.3.2.2.2.5.2.201 +++ boost.module 21 Oct 2009 04:13:32 -0000 @@ -76,6 +76,7 @@ define('BOOST_PERMISSIONS_FILE', var define('BOOST_PERMISSIONS_DIR', variable_get('boost_permissions_dir', '')); define('BOOST_EXPIRE_NO_FLUSH', variable_get('boost_expire_no_flush', FALSE)); define('BOOST_VERBOSE', variable_get('boost_verbose', 5)); +define('BOOST_NO_DATABASE', variable_get('boost_no_database', FALSE)); // Crawler Settings define('BOOST_CRAWL_ON_CRON', variable_get('boost_crawl_on_cron', FALSE)); @@ -143,7 +144,7 @@ function boost_help($path, $arg) { * reference to the view being worked on */ function boost_views_pre_render(&$view) { - if (!is_null($view) && $GLOBALS['_boost_cache_this']) { + if (!is_null($view) && $GLOBALS['_boost_cache_this'] && !BOOST_NO_DATABASE) { foreach ($view->result as $item) { $node = node_load($item->nid); $GLOBALS['_boost_relationships'][] = array('child_page_callback' => 'node', 'child_page_type' => $node->type, 'child_page_id' => $item->nid); @@ -356,7 +357,7 @@ function boost_cron() { $expire = boost_has_site_changed(TRUE); } // Expire old content - if (!BOOST_LOOPBACK_BYPASS && variable_get('boost_expire_cron', TRUE) && $expire && boost_cache_db_expire()) { + if (!BOOST_LOOPBACK_BYPASS && variable_get('boost_expire_cron', TRUE) && $expire && boost_cache_expire_all()) { if (BOOST_VERBOSE >= 5) { watchdog('boost', 'Expired stale files from static page cache.', array(), WATCHDOG_NOTICE); } @@ -707,7 +708,7 @@ function boost_block($op = 'list', $delt case 'config': // Don't show the block to anonymous users, nor on any pages that // aren't even cacheable to begin with (e.g. admin/*). - if (!empty($user->uid) && boost_is_cacheable($GLOBALS['_boost_path'])) { + if (!empty($user->uid) && boost_is_cacheable($GLOBALS['_boost_path']) && !BOOST_NO_DATABASE) { $block['subject'] = ''; $block['content'] = theme('boost_cache_status', -1, drupal_get_form('boost_block_db_settings_form')); } @@ -1227,7 +1228,7 @@ function boost_is_cacheable($path) { * * @return FALSE to not cache the page, TRUE to cache the page. * Returning a FALSE is absolute, Returning TRUE is more like an ignore, - * doesn't guarntee it will be cached; some other setting could make the + * doesn't guarantee it will be cached; some other setting could make the * is_boost_cacheable() call return FALSE to boost_init() * */ @@ -1263,10 +1264,9 @@ function boost_cache_clear_all() { } /** - * Deletes all expired static files currently in the cache. - * OLD FUNCTION + * Deletes all expired static files currently in the cache via filesystem. */ -function boost_cache_expire_all() { +function boost_cache_expire_all_filesystem() { boost_cache_delete(FALSE); return TRUE; } @@ -1347,11 +1347,11 @@ function boost_cache_expire_derivative($ } } $paths = array_unique($paths); - if ($db) { - boost_cache_expire($paths); + if (BOOST_NO_DATABASE) { + boost_cache_expire_by_filename($paths); } else { - boost_cache_expire_by_filename($paths); + boost_cache_expire_by_db($paths); } } @@ -1361,7 +1361,7 @@ function boost_cache_expire_derivative($ * @param $paths * Array of URL's */ -function boost_cache_expire($paths) { +function boost_cache_expire_by_db($paths) { $hashes = array(); // Get all cache files directly associated with this path foreach ($paths as $path) { @@ -1550,29 +1550,43 @@ function boost_cache_kill($filename, $ha } /** - * Flushes all expired pages from database + * Flushes all expired pages from cache. * * TODO del empty dirs if enabled */ -function boost_cache_db_expire() { +function boost_cache_expire_all() { if (variable_get('boost_ignore_flush', 0) < 2) { - if (BOOST_FLUSH_ALL_MULTISITE) { - $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE expire BETWEEN 1 AND %d", BOOST_TIME); + if (BOOST_NO_DATABASE) { + boost_cache_expire_all_filesystem(); } else { - $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE base_dir = '%s' AND expire BETWEEN 1 AND %d", BOOST_FILE_PATH, BOOST_TIME); - } - while ($boost = db_fetch_array($result)) { - boost_cache_kill($boost['filename'], $boost['hash'], TRUE, $boost['base_dir']); + boost_cache_expire_all_db(); } - if (BOOST_FLUSH_DIR) { - // TO-DO: del empty dirs. - } - return TRUE; } return FALSE; } + /** + * Flushes all expired pages via database lookup. + * + * TODO del empty dirs if enabled + */ +function boost_cache_expire_all_db() { + if (BOOST_FLUSH_ALL_MULTISITE) { + $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE expire BETWEEN 1 AND %d", BOOST_TIME); + } + else { + $result = db_query("SELECT filename, hash, base_dir FROM {boost_cache} WHERE base_dir = '%s' AND expire BETWEEN 1 AND %d", BOOST_FILE_PATH, BOOST_TIME); + } + while ($boost = db_fetch_array($result)) { + boost_cache_kill($boost['filename'], $boost['hash'], TRUE, $boost['base_dir']); + } + if (BOOST_FLUSH_DIR) { + // TO-DO: del empty dirs. + } + return TRUE; +} + /** * Returns the cached contents of the specified page, if available. * @@ -1687,8 +1701,10 @@ function boost_cache_set($path, $data, $ if (BOOST_GZIP) { boost_cache_write(str_replace(BOOST_FILE_PATH, BOOST_GZIP_FILE_PATH, $filename) . BOOST_GZIP_EXTENSION, gzencode($data, 9)); } - boost_db_prep($filename, $extension, BOOST_TIME + $expire); - boost_cache_set_node_relationships($GLOBALS['_boost_relationships']); + if (!BOOST_NO_DATABASE) { + boost_db_prep($filename, $extension, BOOST_TIME + $expire); + boost_cache_set_node_relationships($GLOBALS['_boost_relationships']); + } return TRUE; } else {