diff --git a/core/page.class.php b/core/page.class.php index ad58430f..f15b31c5 100644 --- a/core/page.class.php +++ b/core/page.class.php @@ -273,7 +273,7 @@ class Page { { global $config; - if (!$config->get_bool("autocache_css") || !$config->get_bool("autocache_js")) { + if (!$config->get_bool("autocache_css") && !$config->get_bool("autocache_js")) { return false; // caching disabled } @@ -283,7 +283,7 @@ class Page { // Create directory if needed. if(!file_exists($cache_location)) { - if (is_writeable($cache_location) && !mkdir($cache_location, 0750, true)) { + if (!mkdir($cache_location, 0750, true)) { return false; // failed to create directory } } @@ -342,6 +342,17 @@ class Page { } // tell the client where to get the css cache file $this->add_html_header(''); + } else { + // Caching of CSS disabled. + foreach(glob("lib/*.css") as $css) { + $this->add_html_header(""); + } + $css_files = glob("ext/*/style.css"); + if($css_files) { + foreach($css_files as $css_file) { + $this->add_html_header(""); + } + } } @@ -380,6 +391,17 @@ class Page { } // tell the client where to get the js cache file $this->add_html_header(''); + } else { + // Caching of Javascript disabled. + foreach(glob("lib/*.js") as $js) { + $this->add_html_header(""); + } + $js_files = glob("ext/*/script.js"); + if($js_files) { + foreach($js_files as $js_file) { + $this->add_html_header(""); + } + } } return true; diff --git a/ext/setup/main.php b/ext/setup/main.php index 776f1e2d..d972ee99 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -287,11 +287,11 @@ class Setup extends SimpleExtension { $sb->add_text_option("api_recaptcha_pubkey", "
Public key: "); $event->panel->add_block($sb); - $sb = new SetupBlock("Automatic CSS and JavaScript Caching"); - $sb->add_text_option("autocache_location", "
Location: "); - $sb->add_label("
Needs to be writeable by the webserver"); - $sb->add_bool_option("autocache_css", "
Enable automatic caching of CSS: "); - $sb->add_bool_option("autocache_js", "
Enable automatic caching of JS: "); + $sb = new SetupBlock("Automatic CSS & JS Caching"); + $sb->add_text_option("autocache_location", "Location: "); + $sb->add_label("
Needs to be writeable by the webserver."); + $sb->add_bool_option("autocache_css", "
Automatic caching of CSS: "); + $sb->add_bool_option("autocache_js", "
Automatic caching of JS: "); $sb->add_bool_option("autocache_min_css", "
Minimize CSS files: "); $sb->add_bool_option("autocache_min_js", "
Minimize JS files: "); $event->panel->add_block($sb);