summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArto Bendiken2008-10-24 23:03:53 (GMT)
committerArto Bendiken2008-10-24 23:03:53 (GMT)
commit4bc8ce8706ecd38e61d593b856f59cff3f5eabb1 (patch)
treed7df018480e592edcfa043b78604b4c48e5ce02f
parenta2217cd28bd7f7f80e6b5ad13f861fe77988bc89 (diff)
Undoing accidental overwrite of DRUPAL-5 branch...
-rw-r--r--INSTALL.txt2
-rw-r--r--README.txt2
-rw-r--r--boost.admin.inc25
-rw-r--r--boost.api.inc4
-rw-r--r--boost.info1
-rw-r--r--boost.module50
6 files changed, 57 insertions, 27 deletions
diff --git a/INSTALL.txt b/INSTALL.txt
index 0abc2fa..c292771 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -2,7 +2,7 @@
REQUIREMENTS
------------
-This version of Boost is designed for Drupal 6.x running on a Unix platform.
+This version of Boost is designed for Drupal 4.7 running on a Unix platform.
Drupal's clean URLs MUST be enabled and working properly.
The `path' and `pathauto' modules are recommended.
diff --git a/README.txt b/README.txt
index 8c2cbc4..d3ee85a 100644
--- a/README.txt
+++ b/README.txt
@@ -2,7 +2,7 @@
DESCRIPTION
-----------
-This module provides static page caching for Drupal 6.x, enabling a
+This module provides static page caching for Drupal 5.x, enabling a
potentially very significant performance and scalability boost for
heavily-trafficked Drupal sites.
diff --git a/boost.admin.inc b/boost.admin.inc
index 2dd56f6..e3c9d52 100644
--- a/boost.admin.inc
+++ b/boost.admin.inc
@@ -14,7 +14,7 @@
*
* Called from hook_form_alter().
*/
-function boost_system_settings_form($form = array()) {
+function boost_system_settings_form($form = array()) {
$form['cache'] = array('#type' => 'hidden','#value' => CACHE_DISABLED);
$form['boost'] = array(
'#type' => 'radios',
@@ -46,12 +46,11 @@ function boost_system_settings_form($form = array()) {
/**
* Declares administrative settings for the Boost module.
*
- * @see system_settings_form
- * @ingroup forms
+ * Called from hook_settings().
*/
-function boost_admin_settings($form = array()) {
+function boost_settings_form($form = array()) {
//_boost_check_htaccess(); // TODO
-
+
$options = array(t('Cache every page except the listed pages.'), t('Cache only the listed pages.'));
$description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => theme('placeholder', 'blog'), '%blog-wildcard' => theme('placeholder', 'blog/*'), '%front' => theme('placeholder', '<front>')));
if (user_access('use PHP for block visibility')) {
@@ -76,6 +75,20 @@ function boost_admin_settings($form = array()) {
'#description' => $description,
);
+ // TODO
+ /*$form['throttle'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Throttle settings'),
+ '#collapsible' => FALSE,
+ );
+ $form['throttle']['boost_cron_limit'] = array(
+ '#type' => 'select',
+ '#title' => t('Pages to update per cron run'),
+ '#default_value' => BOOST_CRON_LIMIT,
+ '#options' => drupal_map_assoc(array(10, 20, 50, 100, 200, 500, 1000)),
+ '#description' => t('The maximum number of static pages that will be built or rebuilt in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'),
+ );*/
+
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
@@ -114,7 +127,7 @@ function boost_admin_settings($form = array()) {
'#description' => t('If you are synchronizing the generated static cache files to an external server through some means such as SFTP or rsync, you can enter a shell command to be executed following a successful cron-triggered cache update. Note that this is an advanced setting that should normally be left blank.'),
);*/
- return system_settings_form($form);
+ return $form;
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/boost.api.inc b/boost.api.inc
index ac3038e..09afb94 100644
--- a/boost.api.inc
+++ b/boost.api.inc
@@ -135,7 +135,7 @@ function boost_cache_set($path, $data = '') {
_boost_mkdir_p(dirname($filename));
if (!file_exists($filename) || boost_file_is_expired($filename)) {
if (file_put_contents($filename, $data) === FALSE) {
- watchdog('boost', 'Unable to write file: %file', array('%file' => $filename), array(), WATCHDOG_WARNING);
+ watchdog('boost', t('Unable to write file: %file', array('%file' => $filename)), WATCHDOG_WARNING);
}
}
@@ -147,7 +147,7 @@ function boost_cache_set($path, $data = '') {
@unlink($symlink);
}
if (!_boost_symlink($filename, $symlink)) {
- watchdog('boost', 'Unable to create symlink: %link to %target', array('%link' => $symlink, '%target' => $filename), array(), WATCHDOG_WARNING);
+ watchdog('boost', t('Unable to create symlink: %link to %target', array('%link' => $symlink, '%target' => $filename)), WATCHDOG_WARNING);
}
}
}
diff --git a/boost.info b/boost.info
index 54550b0..b51760a 100644
--- a/boost.info
+++ b/boost.info
@@ -2,4 +2,3 @@
name = Boost
description = Provides a performance and scalability boost through caching Drupal pages as static HTML files.
package = Caching
-core = 6.x
diff --git a/boost.module b/boost.module
index f199012..96057b5 100644
--- a/boost.module
+++ b/boost.module
@@ -10,8 +10,8 @@
// BOOST SETTINGS
define('BOOST_PATH', dirname(__FILE__));
+define('BOOST_FRONTPAGE', drupal_get_normal_path(variable_get('site_frontpage', 'node')));
-// BOOST_FRONTPAGE now hidden in boost_init due to bootstrap changes in D6
define('BOOST_ENABLED', variable_get('boost', CACHE_DISABLED));
define('BOOST_FILE_PATH', variable_get('boost_file_path', 'cache'));
define('BOOST_FILE_EXTENSION', variable_get('boost_file_extension', '.html'));
@@ -47,8 +47,8 @@ require_once BOOST_PATH . '/boost.api.inc';
/**
* Implementation of hook_help(). Provides online user help.
*/
-function boost_help($path, $arg) {
- switch ($path) {
+function boost_help($section) {
+ switch ($section) {
case 'admin/modules#name':
return t('boost');
case 'admin/modules#description':
@@ -64,32 +64,40 @@ function boost_help($path, $arg) {
}
/**
+ * Implementation of hook_perm(). Defines user permissions.
+ */
+function boost_perm() {
+ return array('administer cache');
+}
+
+/**
* Implementation of hook_menu(). Defines menu items and page callbacks.
*/
-function boost_menu() {
+function boost_menu($may_cache) {
+ $access = user_access('administer cache');
$items = array();
- $items['admin/settings/performance/boost'] = array(
+ if ($may_cache) {
+ $items[] = array(
+ 'path' => 'admin/settings/performance/boost',
'title' => t('Boost'),
- 'description' => t('Configure static page cache settings.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('boost_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'boost.admin.inc'
+ 'description' => t('Enable or disable page caching for anonymous users and set CSS and JS bandwidth optimization options.'),
+ 'callback' => 'drupal_get_form',
+ 'callback arguments' => array('boost_settings'),
+ 'access' => user_access('administer site configuration'),
);
// TODO: define menu actions for cache administration.
+ }
return $items;
}
/**
- * Implementation of hook_init(). Performs page setup tasks if page not cached.
+ * Implementation of hook_init(). Performs page setup tasks.
*/
function boost_init() {
// Stop right here unless we're being called for an ordinary page request
if (strpos($_SERVER['PHP_SELF'], 'index.php') === FALSE)
return;
-
- // hidden here as d6 loads path.inc after parsing this file looking for hook_boot
- define('BOOST_FRONTPAGE', drupal_get_normal_path(variable_get('site_frontpage', 'node')));
+
// TODO: check interaction with other modules that use ob_start(); this
// may have to be moved to an earlier stage of the page request.
if (!variable_get('cache', CACHE_DISABLED) && BOOST_ENABLED) {
@@ -173,7 +181,7 @@ function boost_exit($destination = NULL) {
* Implementation of hook_form_alter(). Performs alterations before a form
* is rendered.
*/
-function boost_form_alter(&$form, &$form_state, $form_id ) {
+function boost_form_alter($form_id, &$form) {
// Alter Drupal's settings form by hiding the default cache enabled/disabled control (which will now always default to CACHE_DISABLED), and add our own control instead.
if ($form_id == 'system_performance_settings') {
require_once BOOST_PATH . '/boost.admin.inc';
@@ -188,7 +196,7 @@ function boost_cron() {
if (!BOOST_ENABLED) return;
if (boost_cache_expire_all()) {
- watchdog('boost', 'Expired stale files from static page cache.', array(), WATCHDOG_NOTICE);
+ watchdog('boost', t('Expired stale files from static page cache.'), WATCHDOG_NOTICE);
}
}
@@ -269,6 +277,16 @@ function boost_user($op, &$edit, &$account, $category = NULL) {
}
}
+/**
+ * Implementation of hook_settings(). Declares administrative settings for a module.
+ *
+ * @deprecated in Drupal 5.0.
+ */
+function boost_settings() {
+ require_once BOOST_PATH . '/boost.admin.inc';
+ return system_settings_form(boost_settings_form());
+}
+
//////////////////////////////////////////////////////////////////////////////
// OUTPUT BUFFERING CALLBACK