aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Updater.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2017-01-06 11:40:54 +0100
committerGitHub <noreply@github.com>2017-01-06 11:40:54 +0100
commit7418f7cb60524c3bfc2f240386b5e3e7eb9b3257 (patch)
tree4b0c89c133ad1679c5db3a4f0f6b94079f776395 /application/Updater.php
parent93b1fe54fb99efff30eec0d405cc7319fbbc1f95 (diff)
parent01c6e32a02034ab119d83364c4648ce55d75543b (diff)
downloadShaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.gz
Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.tar.zst
Shaarli-7418f7cb60524c3bfc2f240386b5e3e7eb9b3257.zip
Merge pull request #732 from ArthurHoaro/feature/theme-manager
Theme manager: improvements
Diffstat (limited to 'application/Updater.php')
-rw-r--r--application/Updater.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/application/Updater.php b/application/Updater.php
index 38de3350..621c7238 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -279,6 +279,35 @@ class Updater
279 $this->conf->write($this->isLoggedIn); 279 $this->conf->write($this->isLoggedIn);
280 return true; 280 return true;
281 } 281 }
282
283 /**
284 * New setting: theme name. If the default theme is used, nothing to do.
285 *
286 * If the user uses a custom theme, raintpl_tpl dir is updated to the parent directory,
287 * and the current theme is set as default in the theme setting.
288 *
289 * @return bool true if the update is successful, false otherwise.
290 */
291 public function updateMethodDefaultTheme()
292 {
293 // raintpl_tpl isn't the root template directory anymore.
294 // We run the update only if this folder still contains the template files.
295 $tplDir = $this->conf->get('resource.raintpl_tpl');
296 $tplFile = $tplDir . '/linklist.html';
297 if (! file_exists($tplFile)) {
298 return true;
299 }
300
301 $parent = dirname($tplDir);
302 $this->conf->set('resource.raintpl_tpl', $parent);
303 $this->conf->set('resource.theme', trim(str_replace($parent, '', $tplDir), '/'));
304 $this->conf->write($this->isLoggedIn);
305
306 // Dependency injection gore
307 RainTPL::$tpl_dir = $tplDir;
308
309 return true;
310 }
282} 311}
283 312
284/** 313/**