Commit 89ca9119 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Check for the existance of the sessions directory when checking

sanity. Added a function to find out what subdirectory mahara is installed
in, which is useful for setting cookie paths
parent eae67bf1
...@@ -123,7 +123,8 @@ function ensure_sanity() { ...@@ -123,7 +123,8 @@ function ensure_sanity() {
if ( if (
!check_dir_exists(get_config('dataroot') . 'smarty/compile') || !check_dir_exists(get_config('dataroot') . 'smarty/compile') ||
!check_dir_exists(get_config('dataroot') . 'smarty/cache') || !check_dir_exists(get_config('dataroot') . 'smarty/cache') ||
!check_dir_exists(get_config('dataroot') . 'templates')) { !check_dir_exists(get_config('dataroot') . 'templates') ||
!check_dir_exists(get_config('dataroot') . 'sessions')) {
throw new ConfigSanityException(get_string('couldnotmakedatadirectories', 'error')); throw new ConfigSanityException(get_string('couldnotmakedatadirectories', 'error'));
} }
} }
...@@ -1359,4 +1360,16 @@ function get_dir_contents($directory) { ...@@ -1359,4 +1360,16 @@ function get_dir_contents($directory) {
return $contents; return $contents;
} }
/**
* Returns the subdirectory where mahara is installed, normally / but could
* be something different on a shared host. Useful for setting cookie paths.
*
* @return string
*/
function get_mahara_install_subdirectory() {
$wwwroot = get_config('wwwroot');
$wwwroot = preg_replace('#^https?://#', '', $wwwroot);
return substr($wwwroot, strpos($wwwroot, '/'));
}
?> ?>
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