diff options
Diffstat (limited to 'modules-available/sysconfig/inc/configmodule/customodule.inc.php')
-rw-r--r-- | modules-available/sysconfig/inc/configmodule/customodule.inc.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/modules-available/sysconfig/inc/configmodule/customodule.inc.php b/modules-available/sysconfig/inc/configmodule/customodule.inc.php index 3c10bada..8b968336 100644 --- a/modules-available/sysconfig/inc/configmodule/customodule.inc.php +++ b/modules-available/sysconfig/inc/configmodule/customodule.inc.php @@ -12,14 +12,27 @@ ConfigModule::registerModule( class ConfigModule_CustomModule extends ConfigModule { const MODID = 'CustomModule'; - const VERSION = 1; + const VERSION = 2; 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... + // No temp file given from wizard + // Old archive still exists? pretend it worked... + if ($this->archive() === false || !file_exists($this->archive())) + return false; + if ($this->currentVersion() == 1) { + // Need an upgrade + return Taskmanager::submit('RecompressArchive', array( + 'inputFiles' => [$this->archive() => false], + 'outputFile' => $tgz, + 'forceRoot' => true, // Force this for old modules for backward compat + )); + } + // Nothing to do + return true; } $task = Taskmanager::submit('MoveFile', array( 'source' => $this->tmpFile, @@ -42,6 +55,7 @@ class ConfigModule_CustomModule extends ConfigModule public function setData($key, $value) { + // Sets the temp file from the wizard, where it stored the processed archive if ($key !== 'tmpFile' || !file_exists($value)) return false; $this->tmpFile = $value; |