summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boost.admin.inc64
-rw-r--r--boost.install10
-rw-r--r--boost.module4
-rw-r--r--stats/boost_stats.ajax.inc14
-rw-r--r--stats/boost_stats.php15
5 files changed, 61 insertions, 46 deletions
diff --git a/boost.admin.inc b/boost.admin.inc
index 74bb816..c4e6c97 100644
--- a/boost.admin.inc
+++ b/boost.admin.inc
@@ -466,12 +466,14 @@ function boost_admin_boost_performance_page() {
'#default_value' => BOOST_DISABLE_CLEAN_URL,
'#description' => t('Drupal will output non clean url\'s for non anonymous users. This allows for the browser to cache the page and still have logging in work. This is more on the extreme side of tweaks.'),
);
- $form['advanced']['boost_aggressive_gzip'] = array(
- '#type' => 'checkbox',
- '#title' => t('Aggressive Gzip: Deliver gzipped content independent of the request header.'),
- '#default_value' => BOOST_AGGRESSIVE_GZIP,
- '#description' => t('In order to deliver gzipped content independent of the header, this will test for gzip compression in a small iframe by sending it compressed content. This compressed content is javascript which creates a cookie with a note of gzip support. On the server side it checks for the cookie and then sends out gzipped content accordingly. See <a href="@url">Website Performance - Activate Gzip</a>. In short some firewalls/proxies mangle the gzip header; this gets around that. iframe is on non compressed version of the frontpage only.', array('@url' => 'http://actionable-stats.com/website-performance-activate-gzip')),
- );
+ if (BOOST_GZIP) {
+ $form['advanced']['boost_aggressive_gzip'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Aggressive Gzip: Deliver gzipped content independent of the request header.'),
+ '#default_value' => BOOST_AGGRESSIVE_GZIP,
+ '#description' => t('In order to deliver gzipped content independent of the header, this will test for gzip compression in a small iframe by sending it compressed content. This compressed content is javascript which creates a cookie with a note of gzip support. On the server side it checks for the cookie and then sends out gzipped content accordingly. See <a href="@url">Website Performance - Activate Gzip</a>. In short some firewalls/proxies mangle the gzip header; this gets around that. iframe is on non compressed version of the frontpage only.', array('@url' => 'http://actionable-stats.com/website-performance-activate-gzip')),
+ );
+ }
$form['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'))),
@@ -968,30 +970,32 @@ function boost_admin_generate_htaccess($server_name = '%{SERVER_NAME}', $documen
$string .= BOOST_GZIP ? " AddEncoding gzip $_gz\n" : '';
$string .= " </IfModule>\n";
}
- if (BOOST_CACHE_HTML) {
- $string .= " <FilesMatch \"$html$gz$\">\n";
- $string .= " ForceType text/html\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_XML) {
- $string .= " <FilesMatch \"$xml$gz$\">\n";
- $string .= " ForceType text/xml\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_CSS) {
- $string .= " <FilesMatch \"$css$gz$\">\n";
- $string .= " ForceType text/css\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_JS) {
- $string .= " <FilesMatch \"$js$gz$\">\n";
- $string .= " ForceType text/javascript\n";
- $string .= " </FilesMatch>\n";
- }
- if (BOOST_CACHE_JSON) {
- $string .= " <FilesMatch \"$json$gz$\">\n";
- $string .= " ForceType text/javascript\n";
- $string .= " </FilesMatch>\n";
+ if (BOOST_GZIP) {
+ if (BOOST_CACHE_HTML) {
+ $string .= " <FilesMatch \"$html$gz$\">\n";
+ $string .= " ForceType text/html\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_XML) {
+ $string .= " <FilesMatch \"$xml$gz$\">\n";
+ $string .= " ForceType text/xml\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_CSS) {
+ $string .= " <FilesMatch \"$css$gz$\">\n";
+ $string .= " ForceType text/css\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_JS) {
+ $string .= " <FilesMatch \"$js$gz$\">\n";
+ $string .= " ForceType text/javascript\n";
+ $string .= " </FilesMatch>\n";
+ }
+ if (BOOST_CACHE_JSON) {
+ $string .= " <FilesMatch \"$json$gz$\">\n";
+ $string .= " ForceType text/javascript\n";
+ $string .= " </FilesMatch>\n";
+ }
}
if (BOOST_AGGRESSIVE_GZIP) {
$string .= "\n";
diff --git a/boost.install b/boost.install
index f388c13..1b6e034 100644
--- a/boost.install
+++ b/boost.install
@@ -90,6 +90,8 @@ function boost_requirements($phase) {
$crawler_response = drupal_http_request(BOOST_CRAWLER_SELF . '&test=1');
$crawler_response = $crawler_response->code;
}
+ $robots = file_exists('robots.txt') ? file_get_contents('robots.txt') : FALSE;
+
foreach ($cache_directories as $cache_directory) {
_boost_mkdir_p($cache_directory);
$root_file = file_put_contents($cache_directory . '/' . variable_get('boost_root_file', '.boost'), $cache_directory);
@@ -220,6 +222,14 @@ function boost_requirements($phase) {
'value' => $t('File system sub directory limit.'),
);
}
+ if ($robots && !stristr($robots, 'Disallow: /boost_stats.php')) {
+ $requirements['boost_robots'] = array(
+ 'title' => $t('Boost'),
+ 'description' => $t('Your robots.txt file does not contain "Disallow: /boost_stats.php". This is needed inorder to prevent the output of this from accendently getting indexed by search engines.'),
+ 'severity' => REQUIREMENT_WARNING,
+ 'value' => $t('"Disallow: /boost_stats.php" entry missing in robots.txt'),
+ );
+ }
if (empty($requirements)) {
$requirements['boost'] = array(
'title' => $t('Boost'),
diff --git a/boost.module b/boost.module
index 0aaae16..4b639eb 100644
--- a/boost.module
+++ b/boost.module
@@ -72,7 +72,7 @@ define('BOOST_OVERWRITE_FILE', variable_get('boost_overwrite_file', FALSE)
define('BOOST_HALT_ON_ERRORS', variable_get('boost_halt_on_errors', FALSE));
define('BOOST_HALT_ON_MESSAGES', variable_get('boost_halt_on_messages', TRUE));
define('BOOST_DISABLE_CLEAN_URL', variable_get('boost_disable_clean_url', FALSE));
-define('BOOST_AGGRESSIVE_GZIP', variable_get('boost_aggressive_gzip', TRUE));
+define('BOOST_AGGRESSIVE_GZIP', BOOST_GZIP ? variable_get('boost_aggressive_gzip', TRUE) : FALSE);
define('BOOST_PERMISSIONS_FILE', variable_get('boost_permissions_file', ''));
define('BOOST_PERMISSIONS_DIR', variable_get('boost_permissions_dir', ''));
define('BOOST_EXPIRE_NO_FLUSH', variable_get('boost_expire_no_flush', FALSE));
@@ -1964,7 +1964,7 @@ function boost_cache_set($path, $data, $extension = BOOST_FILE_EXTENSION) {
// Special handling of the front page for aggressive gzip test
if ($path == '' && BOOST_AGGRESSIVE_GZIP && $extension == BOOST_FILE_EXTENSION) {
_boost_generate_gzip_test_file();
- boost_cache_write($filename, _boost_inject_code($data, '<iframe src="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border: 0px"></iframe>' . "\n"));
+ boost_cache_write($filename, _boost_inject_code($data, '<iframe src="/boost-gzip-cookie-test.html" style="width:0px; height:0px; border:0px; position:absolute; top:-1000px; z-index:10;"></iframe>' . "\n"));
}
else {
boost_cache_write($filename, $data);
diff --git a/stats/boost_stats.ajax.inc b/stats/boost_stats.ajax.inc
index aa603bd..bc267f5 100644
--- a/stats/boost_stats.ajax.inc
+++ b/stats/boost_stats.ajax.inc
@@ -10,18 +10,18 @@
* AJAX Menu Callback.
*/
function boost_stats_ajax_callback() {
- if (!isset($_GET['js'])) {
- // stats not called via JS, send image out & close connection.
- boost_async_opp("\x47\x49\x46\x38\x39\x61\x1\x0\x1\x0\x80\xff\x0\xc0\xc0\xc0\x0\x0\x0\x21\xf9\x4\x1\x0\x0\x0\x0\x2c\x0\x0\x0\x0\x1\x0\x1\x0\x0\x2\x2\x44\x1\x0\x3b", TRUE, 'image/gif', 43);
- }
-
// Exit if nothing was passed to this.
if ( !isset($_GET['nid'])
&& !isset($_GET['title'])
&& !isset($_GET['qq'])
&& !isset($_GET['referer'])
) {
- exit;
+ return drupal_not_found();
+ }
+
+ if (!isset($_GET['js'])) {
+ // stats not called via JS, send image out & close connection.
+ boost_async_opp("\x47\x49\x46\x38\x39\x61\x1\x0\x1\x0\x80\xff\x0\xc0\xc0\xc0\x0\x0\x0\x21\xf9\x4\x1\x0\x0\x0\x0\x2c\x0\x0\x0\x0\x1\x0\x1\x0\x0\x2\x2\x44\x1\x0\x3b", TRUE, 'image/gif', 43);
}
// Set variables passed via GET.
@@ -68,7 +68,7 @@ function boost_stats_ajax_callback() {
// Send JSON Back
if (!empty($json)) {
- echo drupal_json($json);
+ drupal_json($json);
}
}
// Send HTML back
diff --git a/stats/boost_stats.php b/stats/boost_stats.php
index 4e09e42..74ce427 100644
--- a/stats/boost_stats.php
+++ b/stats/boost_stats.php
@@ -6,20 +6,22 @@
* Place in webroot, for faster stats if needed.
*/
-if (!isset($_GET['js'])) {
- // stats not called via JS, send image out & close connection.
- boost_stats_async_image();
-}
-
// Exit script if nothing was passed to it.
if ( !isset($_GET['nid'])
&& !isset($_GET['title'])
&& !isset($_GET['qq'])
&& !isset($_GET['referer'])
) {
+ boost_stats_full_boot();
+ drupal_not_found();
exit;
}
+if (!isset($_GET['js'])) {
+ // stats not called via JS, send image out & close connection.
+ boost_stats_async_image();
+}
+
// connect to db & set variables.
boost_stats_init();
@@ -41,8 +43,7 @@ if (isset($_GET['js'])) {
// Send JSON Back
if (!empty($json)) {
- header('Content-Type: text/javascript; charset=utf-8');
- echo json_encode($json);
+ drupal_json($json);
}
}
// Send HTML back