diff options
Diffstat (limited to 'inc/configmodule/customodule.inc.php')
-rw-r--r-- | inc/configmodule/customodule.inc.php | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/inc/configmodule/customodule.inc.php b/inc/configmodule/customodule.inc.php index 89f0aca6..195f738f 100644 --- a/inc/configmodule/customodule.inc.php +++ b/inc/configmodule/customodule.inc.php @@ -1,6 +1,6 @@ <?php -ConfigModules::registerModule( +ConfigModule::registerModule( ConfigModule_CustomModule::MODID, // ID Dictionary::translate('config-module', 'custom_title'), // Title Dictionary::translate('config-module', 'custom_description'), // Description @@ -12,5 +12,40 @@ ConfigModules::registerModule( class ConfigModule_CustomModule extends ConfigModule { const MODID = 'CustomModule'; + const VERSION = 1; + + private $tmpFile = false; + protected function generateInternal($tgz, $parent) + { + if (!$this->validateConfig()) { + if ($this->archive() !== false && file_exists($this->archive())) + return true; // No new temp file given, old archive still exists, pretend it worked... + return false; + } + $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' || !file_exists($value)) + return false; + $this->tmpFile = $value; + } } |