summaryrefslogtreecommitdiffstats
path: root/inc/configmodule/customodule.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2015-01-20 18:07:24 +0100
committerSimon Rettberg2015-01-20 18:07:24 +0100
commit1ff2bc4f3c694b7c76df8e57056c51ca39a23a34 (patch)
tree0eb19164af66b3d4e8bf639a710f323b631d23ee /inc/configmodule/customodule.inc.php
parentRework config module class structure. Still some TODOs though.... (diff)
downloadslx-admin-1ff2bc4f3c694b7c76df8e57056c51ca39a23a34.tar.gz
slx-admin-1ff2bc4f3c694b7c76df8e57056c51ca39a23a34.tar.xz
slx-admin-1ff2bc4f3c694b7c76df8e57056c51ca39a23a34.zip
config module structure completed. Many other fixes. Hidden pw field support.
Diffstat (limited to 'inc/configmodule/customodule.inc.php')
-rw-r--r--inc/configmodule/customodule.inc.php37
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;
+ }
}