mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-20799 renewed support for alternative theme dir location
This commit is contained in:
parent
ea4e78782f
commit
73e504bca9
@ -330,8 +330,6 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// $CFG->emailconnectionerrorsto = 'your@emailaddress.com';
|
||||
//
|
||||
// NOTE: if you are using custompix in your theme, see /fixpix.php.
|
||||
//
|
||||
// Set the priority of themes from highest to lowest. This is useful (for
|
||||
// example) in sites where the user theme should override all other theme
|
||||
// settings for accessibility reasons. You can also disable types of themes
|
||||
@ -340,7 +338,11 @@ $CFG->admin = 'admin';
|
||||
// NOTE: course, category, session, user themes still require the
|
||||
// respective settings to be enabled
|
||||
//
|
||||
|
||||
// It is possible to add extra themes directory stored outside of $CFG->dirroot.
|
||||
// This local directory does not have to be accessible from internet.
|
||||
//
|
||||
// $CFG->themedir = '/location/of/extra/themes';
|
||||
//
|
||||
//=========================================================================
|
||||
// 8. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
|
||||
//=========================================================================
|
||||
|
@ -714,7 +714,9 @@ function clean_param($param, $type) {
|
||||
|
||||
case PARAM_THEME:
|
||||
$param = clean_param($param, PARAM_SAFEDIR);
|
||||
if (file_exists($CFG->dirroot.'/theme/'.$param)) {
|
||||
if (file_exists("$CFG->dirroot/theme/$param/config.php")) {
|
||||
return $param;
|
||||
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$param/config.php")) {
|
||||
return $param;
|
||||
} else {
|
||||
return ''; // Specified theme is not installed
|
||||
@ -6798,8 +6800,11 @@ function get_plugin_list($plugintype) {
|
||||
$fulldirs[] = $CFG->dirroot.'/mod';
|
||||
|
||||
} else if ($plugintype === 'theme') {
|
||||
// themes are an exception because they may be stored also in dataroot
|
||||
$fulldirs[] = $CFG->dirroot.'/theme';
|
||||
// themes are special because they may be stored also in separate directory
|
||||
if (!empty($CFG->themedir) and file_exists($CFG->themedir) and is_dir($CFG->themedir) ) {
|
||||
$fulldirs[] = $CFG->themedir;
|
||||
}
|
||||
|
||||
} else {
|
||||
$types = get_plugin_types(true);
|
||||
@ -6815,8 +6820,6 @@ function get_plugin_list($plugintype) {
|
||||
|
||||
$result = array();
|
||||
|
||||
//TODO: MDL-20799 add themedir support
|
||||
|
||||
foreach ($fulldirs as $fulldir) {
|
||||
if (!is_dir($fulldir)) {
|
||||
continue;
|
||||
@ -6863,7 +6866,6 @@ function get_list_of_plugins($directory='mod', $exclude='', $basedir='') {
|
||||
$plugins = array();
|
||||
|
||||
if (empty($basedir)) {
|
||||
// TODO: MDL-20799 megre theme with themedir if defined
|
||||
$basedir = $CFG->dirroot .'/'. $directory;
|
||||
|
||||
} else {
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
// we need just the values from config.php and minlib.php
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
require('../config.php'); // this stops immediately at the beginning of lib/setup.php
|
||||
@ -36,7 +37,11 @@ if (empty($component) or empty($image)) {
|
||||
image_not_found();
|
||||
}
|
||||
|
||||
if (!file_exists("$CFG->dirroot/theme/$themename/config.php") and !file_exists("$CFG->dataroot/theme/$themename/config.php")) {
|
||||
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
|
||||
// exists
|
||||
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
|
||||
// exists
|
||||
} else {
|
||||
image_not_found();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,11 @@ require('../config.php'); // this stops immediately at the beginning of lib/setu
|
||||
$themename = min_optional_param('theme', 'standard', 'SAFEDIR');
|
||||
$rev = min_optional_param('rev', 0, 'INT');
|
||||
|
||||
if (!file_exists("$CFG->dirroot/theme/$themename/config.php") and !file_exists("$CFG->dataroot/theme/$themename/config.php")) {
|
||||
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
|
||||
// exists
|
||||
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
|
||||
// exists
|
||||
} else {
|
||||
header('HTTP/1.0 404 not found');
|
||||
die('Theme was not found, sorry.');
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
// we need just the values from config.php and minlib.php
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
require('../config.php'); // this stops immediately at the beginning of lib/setup.php
|
||||
@ -36,7 +37,11 @@ if (!in_array($type, array('all', 'ie', 'editor', 'yui', 'plugins', 'parents', '
|
||||
die('Theme was not found, sorry.');
|
||||
}
|
||||
|
||||
if (!file_exists("$CFG->dirroot/theme/$themename/config.php") and !file_exists("$CFG->dataroot/theme/$themename/config.php")) {
|
||||
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
|
||||
// exists
|
||||
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
|
||||
// exists
|
||||
} else {
|
||||
header('HTTP/1.0 404 not found');
|
||||
die('Theme was not found, sorry.');
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
// no chaching
|
||||
define('NO_MOODLE_COOKIES', true); // Session not used here
|
||||
define('NO_UPGRADE_CHECK', true); // Ignore upgrade check
|
||||
@ -33,7 +34,11 @@ $type = required_param('type', PARAM_SAFEDIR);
|
||||
$subtype = optional_param('subtype', '', PARAM_SAFEDIR);
|
||||
$sheet = optional_param('sheet', '', PARAM_SAFEDIR);
|
||||
|
||||
if (!file_exists("$CFG->dirroot/theme/$themename/config.php") and !file_exists("$CFG->dataroot/theme/$themename/config.php")) {
|
||||
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
|
||||
// exists
|
||||
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
|
||||
// exists
|
||||
} else {
|
||||
css_not_found();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user