diff options
author | Simon Rettberg | 2016-05-11 19:00:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-05-11 19:00:30 +0200 |
commit | 1cc1c2ed092c46eb35893c1d85accb24cf43d7f9 (patch) | |
tree | 95c1302f4a1ae441e174a1dca64133e2873f8297 /modules-available/sysconfig/inc/configmodule/branding.inc.php | |
parent | Add PhpStorm prefs (diff) | |
download | slx-admin-1cc1c2ed092c46eb35893c1d85accb24cf43d7f9.tar.gz slx-admin-1cc1c2ed092c46eb35893c1d85accb24cf43d7f9.tar.xz slx-admin-1cc1c2ed092c46eb35893c1d85accb24cf43d7f9.zip |
Still working in modularization cleanup and refinement
Diffstat (limited to 'modules-available/sysconfig/inc/configmodule/branding.inc.php')
-rw-r--r-- | modules-available/sysconfig/inc/configmodule/branding.inc.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules-available/sysconfig/inc/configmodule/branding.inc.php b/modules-available/sysconfig/inc/configmodule/branding.inc.php new file mode 100644 index 00000000..479b406c --- /dev/null +++ b/modules-available/sysconfig/inc/configmodule/branding.inc.php @@ -0,0 +1,56 @@ +<?php + +ConfigModule::registerModule( + ConfigModule_Branding::MODID, // ID + Dictionary::translateFile('config-module', 'branding_title'), // Title + Dictionary::translateFile('config-module', 'branding_description'), // Description + Dictionary::translateFile('config-module', 'group_branding'), // Group + true // Only one per config? +); + +class ConfigModule_Branding extends ConfigModule +{ + + const MODID = 'Branding'; + const VERSION = 1; + + private $tmpFile = false; + + protected function generateInternal($tgz, $parent) + { + if (!$this->validateConfig()) { + return $this->archive() !== false && file_exists($this->archive()); // No new temp file given, old archive still exists, pretend it worked... + } + $task = Taskmanager::submit('MoveFile', array( + 'source' => $this->tmpFile, + 'destination' => $tgz, + 'parentTask' => $parent, + 'failOnParentFail' => false + )); + return $task; + } + + protected function moduleVersion() + { + return self::VERSION; + } + + protected function validateConfig() + { + return $this->tmpFile !== false && file_exists($this->tmpFile); + } + + public function setData($key, $value) + { + if ($key !== 'tmpFile' || !is_string($value) || !file_exists($value)) + return false; + $this->tmpFile = $value; + return true; + } + + public function getData($key) + { + return false; + } + +} |