Skip to content
Snippets Groups Projects
Unverified Commit 432cf0d1 authored by Michael Große's avatar Michael Große
Browse files

fix: switch extensions if stylesheet in style.ini doesn't exist

This should give us some backwards compatibility for changing files in
dokuwiki template from .css to .less

This way template authors get a warning to adjust their template, it
won't break right away.

This should prevent breaking search pages in other templates due to
pull request #2286 .
parent d9e82b09
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,18 @@ class StyleUtils
// stylesheets
if(is_array($data['stylesheets'])) foreach($data['stylesheets'] as $file => $mode){
$stylesheets[$mode][$incbase.$file] = $webbase;
if (!file_exists($incbase . $file)) {
list($extension, $basename) = array_map('strrev', explode('.', strrev($file), 2));
$newExtension = $extension === 'css' ? 'less' : 'css';
if (file_exists($incbase . $basename . '.' . $newExtension)) {
$stylesheets[$mode][$incbase . $basename . '.' . $newExtension] = $webbase;
if ($conf['allowdebug']) {
msg("Stylesheet $file not found, using $basename.$newExtension instead. Please contact developer of \"{$conf['template']}\" template.", 2);
}
continue;
}
}
$stylesheets[$mode][$incbase . $file] = $webbase;
}
// replacements
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment