? boost-615406.1.patch
? boost-615406.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.95
diff -u -p -r1.1.2.1.2.3.2.95 boost.admin.inc
--- boost.admin.inc 23 Oct 2009 02:56:20 -0000 1.1.2.1.2.3.2.95
+++ boost.admin.inc 27 Oct 2009 09:37:32 -0000
@@ -504,12 +504,29 @@ function boost_admin_boost_performance_p
if (ini_get('safe_mode')) {
$form['advanced']['boost_ignore_safe_warning'] = array(
'#type' => 'checkbox',
- '#title' => t('Disable warnings about php safe mode'),
+ '#title' => t('Disable warning about php safe mode'),
'#default_value' => BOOST_IGNORE_SAFE_WARNING,
'#description' => t('Disable the warning on the status page about running boost in safe mode.'),
);
}
-
+ $form['advanced']['boost_ignore_subdir_limit'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Disable warning about reaching the ext3 file system subdir limit.'),
+ '#default_value' => BOOST_IGNORE_SUBDIR_LIMIT,
+ '#description' => t('Disable the warning on the status page about coming close to the file system directory limit; warning thrown when at 31,000 subdirectories. Boost will stop creating new subdirectories when 31,998 subdirectories have been created.'),
+ );
+ $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(
@@ -726,18 +743,6 @@ function boost_admin_boost_performance_p
),
'#description' => t('Uses FileETag Directive to set ETags for the files cached by Boost. More info on this subject', array('!link' => url('http://httpd.apache.org/docs/trunk/mod/core.html#fileetag'), '!about' => url('http://en.wikipedia.org/wiki/HTTP_ETag'), '!stack' => url('http://stackoverflow.com/questions/tagged?tagnames=etag&sort=votes&pagesize=50'))),
);
- $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.'),
- );
// Clear database button
$form['clear'] = array(
@@ -1015,7 +1020,7 @@ function boost_admin_generate_htaccess($
$string .= " # Caching for anonymous users\n";
$string .= " # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request\n";
$string .= " RewriteCond %{REQUEST_METHOD} !^GET$ [OR]\n";
- $string .= " RewriteCond %{REQUEST_URI} (^$drupal_subdir(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]\n";
+ $string .= " RewriteCond %{REQUEST_URI} (^$drupal_subdir(admin|$cache_dir|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]\n";
$string .= " RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]\n";
$string .= BOOST_LOOPBACK_BYPASS ? " RewriteCond %{REMOTE_ADDR} ^$server_ip$ [OR]\n" : '';
$string .= " RewriteCond %{HTTPS} on\n";
Index: boost.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.install,v
retrieving revision 1.2.2.1.2.3.2.64
diff -u -p -r1.2.2.1.2.3.2.64 boost.install
--- boost.install 23 Oct 2009 23:19:56 -0000 1.2.2.1.2.3.2.64
+++ boost.install 27 Oct 2009 09:37:32 -0000
@@ -66,6 +66,7 @@ function boost_requirements($phase) {
$t = get_t();
switch ($phase) {
case 'runtime':
+ boost_tree_directory(BOOST_ROOT_CACHE_DIR);
$cache_directories = array();
$cache_directories[] = BOOST_ROOT_CACHE_DIR;
$cache_directories[] = BOOST_FILE_PATH;
@@ -194,6 +195,22 @@ function boost_requirements($phase) {
'value' => $t('Boost crawler does not have efficient settings.'),
);
}
+ if (!BOOST_IGNORE_SUBDIR_LIMIT && isset($GLOBALS['_boost_dir_limit_warning'])) {
+ $requirements['boost_dir_limit'] = array(
+ 'title' => $t('Boost'),
+ 'description' => $t('Sub directory limit about to be hit in these directories:
!list
Change your url structure or open a new thread on the Boost issue tracker; there is a solution but it will cost you $100, since it can not be generalized & must be customized for your configuration', array('!list' => implode("
\n ", $GLOBALS['_boost_dir_limit_warning']))),
+ 'severity' => REQUIREMENT_WARNING,
+ 'value' => $t('File system sub directory limit.'),
+ );
+ }
+ if (!BOOST_IGNORE_SUBDIR_LIMIT && isset($GLOBALS['_boost_dir_limit_hit'])) {
+ $requirements['boost_dir_limit'] = array(
+ 'title' => $t('Boost'),
+ 'description' => $t('Sub directory has been hit in these directories:
!list
Change your url structure or open a new thread on the Boost issue tracker; there is a solution but it will cost you $100, since it can not be generalized & must be customized for your configuration.', array('!list' => implode("
\n ", $GLOBALS['_boost_dir_limit_hit']))),
+ 'severity' => REQUIREMENT_WARNING,
+ 'value' => $t('File system sub directory limit.'),
+ );
+ }
if (empty($requirements)) {
$requirements['boost'] = array(
'title' => $t('Boost'),
@@ -280,6 +297,68 @@ function boost_chk_htaccess_doc($htacces
return TRUE;
}
+
+/**
+ * Return a tree directory structure array
+ *
+ * @param $dir
+ * Directory name
+ * @param $limit
+ * If there are more then this many sub directories in this directory then set
+ * the $GLOBALS['_boost_dir_limit_hit'] variable. Default is 31,000; set to
+ * zero to disable this functionality.
+ */
+function boost_tree_directory($dir, $limit = 31000) {
+ if (!is_dir($dir)) {
+ return FALSE;
+ }
+ // Get directories/files
+ $files = scandir($dir);
+
+ // Only keep directories
+ foreach ($files as $file) {
+ if (is_dir($dir . '/' . $file) && $file != '.' && $file != '..') {
+ $dirs[] = $file;
+ }
+ }
+
+ // Recursive operation to get subdirectories
+ if (count($dirs)) {
+ if (count($dirs) >= 31990) {
+ $GLOBALS['_boost_dir_limit_hit'][] = $dir;
+ }
+ elseif ($limit && count($dirs) > $limit) {
+ $GLOBALS['_boost_dir_limit_warning'][] = $dir;
+ }
+ foreach ($dirs as $key => $subdir) {
+ unset($dirs[$key]);
+ $dirs[$subdir] = boost_tree_directory($dir . '/' . $subdir, $limit);
+ }
+ }
+ else {
+ return NULL;
+ }
+
+ // Return Array
+ return $dirs;
+}
+
+
+/**
+ * PHP4 compatible scandir function
+ *
+ * @see http://php.net/scandir
+ */
+if (!function_exists("scandir")) {
+ function scandir($dir) {
+ $dh = opendir($dir);
+ while (FALSE !== ($filename = readdir($dh))) {
+ $files[] = $filename;
+ }
+ return($files);
+ }
+}
+
/**
* Implementation of hook_schema().
*/
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.203
diff -u -p -r1.3.2.2.2.5.2.203 boost.module
--- boost.module 23 Oct 2009 02:56:20 -0000 1.3.2.2.2.5.2.203
+++ boost.module 27 Oct 2009 09:37:33 -0000
@@ -77,6 +77,7 @@ define('BOOST_PERMISSIONS_DIR', var
define('BOOST_EXPIRE_NO_FLUSH', variable_get('boost_expire_no_flush', FALSE));
define('BOOST_VERBOSE', variable_get('boost_verbose', 5));
define('BOOST_IGNORE_SAFE_WARNING', variable_get('boost_ignore_safe_warning', FALSE));
+define('BOOST_IGNORE_SUBDIR_LIMIT', variable_get('boost_ignore_subdir_limit', FALSE));
define('BOOST_NO_DATABASE', variable_get('boost_no_database', FALSE));
// Crawler Settings