? boost-500944.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.33
diff -u -p -r1.1.2.1.2.3.2.33 boost.admin.inc
--- boost.admin.inc	20 Jun 2009 20:35:15 -0000	1.1.2.1.2.3.2.33
+++ boost.admin.inc	25 Jun 2009 00:14:23 -0000
@@ -186,11 +186,17 @@ function boost_admin_settings($form = ar
     '#default_value' => BOOST_MULTISITE_SINGLE_DB,
     '#description'   => t('If Drupal is running on a multi-site with a single/shared database, then enabling this will allow for correct multi-site caching.'),
   );
-  $form['boost']['advanced']['boost_permissions'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Use 0777 & 0666 permissions.'),
-    '#default_value' => BOOST_PERMISSIONS,
-    '#description'   => t('Sometimes because of funky servers you need it to use very loose file permissions.'),
+  $form['boost']['advanced']['boost_permissions_file'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Files: Enter in a 4 digit number (octal) that will be used by !link. Example 0664', array('!link' => l(t('chmod()'), 'http://php.net/chmod'))),
+    '#default_value' => BOOST_PERMISSIONS_FILE,
+    '#description'   => t('Sometimes because of funky servers you need it use a different file mode then the default.'),
+  );
+  $form['boost']['advanced']['boost_permissions_dir'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Directories: Enter in a 4 digit number (octal) that will be used by !link. Example 0775', array('!link' => l(t('chmod()'), 'http://php.net/chmod'))),
+    '#default_value' => BOOST_PERMISSIONS_DIR,
+    '#description'   => t('Sometimes because of funky servers you need it use a different file mode then the default.'),
   );
   $form['boost']['advanced']['boost_ignore_flush'] = array(
     '#type'          => 'radios',
Index: boost.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.install,v
retrieving revision 1.2.2.1.2.3.2.17
diff -u -p -r1.2.2.1.2.3.2.17 boost.install
--- boost.install	23 Jun 2009 08:45:51 -0000	1.2.2.1.2.3.2.17
+++ boost.install	25 Jun 2009 00:14:23 -0000
@@ -231,4 +231,12 @@ function boost_update_6100() {
 function boost_update_6101() {
   // copy variable
   return db_query("UPDATE {variable} SET name = 'boost_enabled' WHERE name = 'boost'");
-}
\ No newline at end of file
+}
+
+/**
+ * Update 6102 - Delete old variable.
+ */
+function boost_update_6102() {
+  // copy variable
+  return db_query("DELETE {variable} WHERE name = 'boost_permissions' LIMIT 1");
+}
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.64
diff -u -p -r1.3.2.2.2.5.2.64 boost.module
--- boost.module	23 Jun 2009 08:34:49 -0000	1.3.2.2.2.5.2.64
+++ boost.module	25 Jun 2009 00:14:23 -0000
@@ -37,7 +37,8 @@ define('BOOST_CACHE_QUERY',          var
 define('BOOST_IGNORE_FLUSH',         variable_get('boost_ignore_flush', 0));
 define('BOOST_CACHE_CSS',            variable_get('boost_cache_css', FALSE));
 define('BOOST_CACHE_JS',             variable_get('boost_cache_js', FALSE));
-define('BOOST_PERMISSIONS',          variable_get('boost_permissions', FALSE));
+define('BOOST_PERMISSIONS_FILE',     variable_get('boost_permissions_file', ''));
+define('BOOST_PERMISSIONS_DIR',      variable_get('boost_permissions_dir', ''));
 
 // This cookie is set for all authenticated users, so that they can be
 // excluded from caching (or in the future get a user-specific cached page):
@@ -917,7 +918,9 @@ function boost_cache_write($filename, $d
       return FALSE;
     }
     else {
-      BOOST_PERMISSIONS ? @chmod($tempfile, 0666) : @chmod($tempfile, 0664);
+      if (is_numeric(BOOST_PERMISSIONS_FILE)) {
+        @chmod($tempfile, octdec(BOOST_PERMISSIONS_FILE));
+      }
       // put the temp file in its final location
       if (@rename($tempfile, $filename) === FALSE) {
         watchdog('boost', 'Unable to rename file: %temp  to  %file<br /> Group ID: %gid<br /> User ID: %uid<br /> Current script owner: %user<br />', array('%temp' => $tempfile, '%file' => $filename, '%gid' => getmygid(), '%uid' => getmyuid(), '%user' => get_current_user()), WATCHDOG_WARNING);
@@ -1202,7 +1205,9 @@ function _boost_copy_js_files($js) {
 function _boost_copy_file($src, $dest) {
   if (_boost_mkdir_p(dirname($dest))) {
     @copy($src, $dest);
-    BOOST_PERMISSIONS ? @chmod($dest, 0666) : @chmod($dest, 0664);
+    if (is_numeric(BOOST_PERMISSIONS_FILE)) {
+      @chmod($tempfile, octdec(BOOST_PERMISSIONS_FILE));
+    }
   }
 }
 
@@ -1217,7 +1222,9 @@ function _boost_copy_file($src, $dest) {
 function _boost_gz_copy_file($src, $dest) {
   if (_boost_mkdir_p(dirname($dest))) {
     @file_put_contents($dest, gzencode(file_get_contents($src), 9));
-    BOOST_PERMISSIONS ? @chmod($dest, 0666) : @chmod($dest, 0664);
+    if (is_numeric(BOOST_PERMISSIONS_FILE)) {
+      @chmod($tempfile, octdec(BOOST_PERMISSIONS_FILE));
+    }
   }
 }
 
@@ -1267,17 +1274,15 @@ function _boost_get_menu_router() {
  *
  * @param $pathname
  *   The top-level directory that will be recursively created.
- * @param $mode
- *   Set permissions.
  * @param $recursive
  *   Opperate in a recursive manner.
  */
-function _boost_mkdir_p($pathname, $mode = 0775, $recursive = TRUE) {
-  $mode = BOOST_PERMISSIONS ? 0777 : $mode;
+function _boost_mkdir_p($pathname, $recursive = TRUE) {
+  $mode = is_numeric(BOOST_PERMISSIONS_DIR) ? octdec(BOOST_PERMISSIONS_DIR) : 0775;
   if (is_dir($pathname)) {
     return TRUE;
   }
-  if ($recursive && !_boost_mkdir_p(dirname($pathname), $mode)) {
+  if ($recursive && !_boost_mkdir_p(dirname($pathname))) {
     return FALSE;
   }
   if ($result = @mkdir($pathname, $mode)) {
