Commit 0f08ee94 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1795522: Allow the dwoo cache to be placed at custom path



behatnotneeded

Change-Id: I90271065f0a119292f14c07c86a2d1944a42d3a9
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 2205f03f)
parent 57b06d06
......@@ -775,3 +775,9 @@ $cfg->sessionhandler = 'file';
"class" : "s3_file_system",
}';
*/
/**
* @global string $cfg->dwoocachedir
* The location of the dwoo cache directory
*/
//$cfg->customdwoocachedir = '/var/cache/appcache/testing';
......@@ -49,15 +49,16 @@ class Dwoo_Mahara extends Core {
public function __construct() {
global $THEME;
$dwoo_dir = get_dwoo_dir();
// make sure cache/compile paths exist
check_dir_exists(get_config('dataroot') . 'dwoo/compile/' . $THEME->basename);
check_dir_exists(get_config('dataroot') . 'dwoo/cache/' . $THEME->basename);
check_dir_exists($dwoo_dir . 'compile/' . $THEME->basename);
check_dir_exists($dwoo_dir . 'cache/' . $THEME->basename);
// set paths
$this->template_dir = $THEME->templatedirs;
$compileDir = get_config('dataroot') . 'dwoo/compile/' . $THEME->basename;
$cacheDir = get_config('dataroot') . 'dwoo/cache/' . $THEME->basename;
$compileDir = $dwoo_dir . 'compile/' . $THEME->basename;
$cacheDir = $dwoo_dir . 'cache/' . $THEME->basename;
parent::__construct($compileDir, $cacheDir);
// add plugins dir to the loader
......
......@@ -502,9 +502,8 @@ function error ($code, $message, $file, $line, $vars) {
}
// Ignore errors from smarty templates, which happen all too often
if (function_exists('get_config')) {
$compiledir = realpath(get_config('dataroot') . 'dwoo/compile');
if (function_exists('get_config') && function_exists('get_dwoo_dir')) {
$compiledir = realpath(get_dwoo_dir() . 'compile');
if (E_NOTICE == $code && substr($file, 0, strlen($compiledir)) == $compiledir) {
return;
}
......
......@@ -141,9 +141,9 @@ function ensure_sanity() {
}
throw new ConfigSanityException($message);
}
$dwoo_dir = get_dwoo_dir();
if (
!check_dir_exists(get_config('dataroot') . 'dwoo') ||
!check_dir_exists($dwoo_dir) ||
!check_dir_exists(get_config('dataroot') . 'temp') ||
!check_dir_exists(get_config('dataroot') . 'langpacks') ||
!check_dir_exists(get_config('dataroot') . 'htmlpurifier') ||
......@@ -160,6 +160,10 @@ function ensure_sanity() {
raise_memory_limit('128M');
}
function get_dwoo_dir() {
return !empty(get_config('customdwoocachedir')) ? get_config('customdwoocachedir') . '/dwoo/' : get_config('dataroot') . 'dwoo/';
}
/**
* Check sanity of things that we only check at installation time - not on
* every request, like ensure_sanity() does
......@@ -5341,7 +5345,7 @@ function clear_all_caches($clearsessiondirs = false) {
bump_cache_version();
clear_resized_images_cache();
$dwoo_dir = get_config('dataroot') . 'dwoo';
$dwoo_dir = get_dwoo_dir();
if (check_dir_exists($dwoo_dir) && !rmdirr($dwoo_dir)) {
throw new SystemException('Can not remove dwoo directory ' . $dwoo_dir);
}
......
......@@ -21,7 +21,7 @@
{else}
<span class="icon icon-wrench text-default left" role="presentation" aria-hidden="true"></span>
{/if}
<span class="sr-only">{$item->strtype}</span>
<span class="sr-only">{$i->strtype}</span>
{$i->subject|truncate:50}
<span class="icon icon-chevron-down collapse-indicator pull-right text-small" role="presentation" aria-hidden="true"></span>
</a>
......
......@@ -21,7 +21,7 @@
'handheld_device': {if $HANDHELD_DEVICE}1{else}0{/if},
'cc_enabled': {$CC_ENABLED|intval},
'mathjax': {ifconfig key=mathjax}1{else}0{/ifconfig},
'select2_lang': '{$select2_language}'
'select2_lang': '{if $select2_language}{$select2_language}{/if}'
{literal}}{/literal};
</script>
{$STRINGJS|safe}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment