Moodle

CFG->themedir broken

Details

  • Testing Instructions:
    Hide

    Note that this issue can be effectively tested together with MDL-26955

    1. Create a folder called 'morethemes' in moodledata directory and set permissions so that the web server can at least read it
    2. Put the following into your config.php: $CFG->themedir = $CFG->dataroot.'/morethemes';
    3. Move a theme folder from $CFG->dirroot/theme/ into the morethemes folders
    4. Go to the theme selector
    5. TEST: make sure that the moved theme is still displayed in the list
    6. TEST: make sure that the name of the theme is displayed correctly
    7. TEST: make sure that when the theme is selected, it works as if it was in the standard location

    Show
    Note that this issue can be effectively tested together with MDL-26955 1. Create a folder called 'morethemes' in moodledata directory and set permissions so that the web server can at least read it 2. Put the following into your config.php: $CFG->themedir = $CFG->dataroot.'/morethemes'; 3. Move a theme folder from $CFG->dirroot/theme/ into the morethemes folders 4. Go to the theme selector 5. TEST: make sure that the moved theme is still displayed in the list 6. TEST: make sure that the name of the theme is displayed correctly 7. TEST: make sure that when the theme is selected, it works as if it was in the standard location
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE
  • Pull from Repository:
  • Pull 2.0 Branch:
    MDL-27116-themedir-config_20_STABLE
  • Pull Master Branch:
    MDL-27116-themedir-config

Description

CFG->themedir do not work in 2.0.

Workaround
file: /lib/outputlib.php
Function: function find_theme_location

REPLACE
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
$dir = "$CFG->dirroot/theme/$themename";
WITH
if (file_exists("$CFG->dirroot/theme/$themename/config.php")) { $dir = "$CFG->dirroot/theme/$themename"; } elseif (file_exists("$CFG->themedir/$themename/config.php")) {
$dir = "$CFG->themedir/$themename";

MDL-26955 will still be an issue.

Issue Links

Activity

Hide
Patrick Malley added a comment -

Solution falls outside the theme directory - I"m not sure how to fix.

Show
Patrick Malley added a comment - Solution falls outside the theme directory - I"m not sure how to fix.
Hide
Petr Škoda (skodak) added a comment -

reassigning, David: could you please have a look at this?

Show
Petr Škoda (skodak) added a comment - reassigning, David: could you please have a look at this?
Hide
Urs Hunkler added a comment -

I created two branches on a Moodle fork on Github to solve the external themedir issue. The branch with the solution for this issue is https://github.com/uhunkler/moodle2_optimized4design/commits/MDL-27116_CFG-themedir_broken. Have a look there and feel free to pull the solution.

Show
Urs Hunkler added a comment - I created two branches on a Moodle fork on Github to solve the external themedir issue. The branch with the solution for this issue is https://github.com/uhunkler/moodle2_optimized4design/commits/MDL-27116_CFG-themedir_broken. Have a look there and feel free to pull the solution.
Hide
David Mudrak added a comment -

Thanks Jai for the idea of the patch.

Integrators, please pull the patch that adds support for $CFG->themedir into the theme_config::find_theme_location()

Show
David Mudrak added a comment - Thanks Jai for the idea of the patch. Integrators, please pull the patch that adds support for $CFG->themedir into the theme_config::find_theme_location()
Hide
Urs Hunkler added a comment -

I checked your solution on m2stable and it works here.

Show
Urs Hunkler added a comment - I checked your solution on m2stable and it works here.
Hide
Sam Hemelryk added a comment -

Thanks guys this has been integrated now.

Show
Sam Hemelryk added a comment - Thanks guys this has been integrated now.
Hide
Aparup Banerjee added a comment -

this works great for me.

(ps: had to be careful, git thought my theme was deleted and wouldn't let me get it back when i was reverting the test, had to checkout the theme again.)

Show
Aparup Banerjee added a comment - this works great for me. (ps: had to be careful, git thought my theme was deleted and wouldn't let me get it back when i was reverting the test, had to checkout the theme again.)
Hide
David Mudrak added a comment -

yup, `git-checkout <path>` is a correct way to restore deleted contents from the working dir. thanks for the testing.

Show
David Mudrak added a comment - yup, `git-checkout <path>` is a correct way to restore deleted contents from the working dir. thanks for the testing.
Hide
Eloy Lafuente (stronk7) added a comment -

Closing as fixed. Many thanks!

Show
Eloy Lafuente (stronk7) added a comment - Closing as fixed. Many thanks!

Dates

  • Created:
    Updated:
    Resolved:
    Integration date: