diff --git a/Makefile b/Makefile index 041a8f3..aa8e36e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ source_dir=$(build_dir)/source sign_dir=$(build_dir)/sign package_name=$(app_name) cert_dir=$(CURDIR)/../../key -version+=0.0.28 +version+=0.0.29 all: appstore diff --git a/appinfo/info.xml b/appinfo/info.xml index 5a5c902..d4a2ef6 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Mind Map A Mind map editor - 0.0.28 + 0.0.29 agpl Jingtao Yan Files_MindMap @@ -18,14 +18,11 @@ https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/2.png https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/3.png - + OCA\Files_MindMap\Migration\InstallStep - - OCA\Files_MindMap\Migration\UninstallStep - diff --git a/lib/Migration/InstallStep.php b/lib/Migration/InstallStep.php index ca20356..7626db7 100644 --- a/lib/Migration/InstallStep.php +++ b/lib/Migration/InstallStep.php @@ -42,30 +42,6 @@ public function run(IOutput $output) { if (!file_exists($coreImagePath) || md5_file($coreImagePath) !== md5_file($appImagePath)) { copy($appImagePath, $coreImagePath); } - } - - if (version_compare($currentVersion, '19.0.0.4', '<')) { - /* Since 19.0.0.beta3, NC has mindmap's mimetype */ - $configDir = \OC::$configDir; - $mimetypealiasesFile = $configDir . 'mimetypealiases.json'; - $mimetypemappingFile = $configDir . 'mimetypemapping.json'; - - $this->appendToFile($mimetypealiasesFile, ['application/km' => 'mindmap', 'application/x-freemind' => 'mindmap', 'application/vnd.xmind.workbook' => 'mindmap']); - $this->appendToFile($mimetypemappingFile, ['km' => ['application/km'], 'mm' => ['application/x-freemind'], 'xmind' => ['application/vnd.xmind.workbook']]); - $this->logger->info("Add .km,.mm,.xmind to mimetype list.", ["app" => "files_mindmap"]); - $this->updateJS->run(new StringInput(''), new ConsoleOutput()); - } - } - - private function appendToFile(string $filename, array $data) { - $obj = []; - if (file_exists($filename)) { - $content = file_get_contents($filename); - $obj = json_decode($content, true); - } - foreach ($data as $key => $value) { - $obj[$key] = $value; - } - file_put_contents($filename, json_encode($obj, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); + } } } diff --git a/lib/Migration/UninstallStep.php b/lib/Migration/UninstallStep.php deleted file mode 100644 index 3e679d0..0000000 --- a/lib/Migration/UninstallStep.php +++ /dev/null @@ -1,58 +0,0 @@ -logger = $logger; - $this->updateJS = $updateJS; - } - - /** - * Returns the step's name - */ - public function getName() { - return 'Uninstall MindMap'; - } - - /** - * @param IOutput $output - */ - public function run(IOutput $output) { - $currentVersion = implode('.', \OC_Util::getVersion()); - if (version_compare($currentVersion, '19.0.0.4', '<')) { - /* Since 19.0.0.beta3, NC has mindmap's mimetype */ - $configDir = \OC::$configDir; - $mimetypealiasesFile = $configDir . 'mimetypealiases.json'; - $mimetypemappingFile = $configDir . 'mimetypemapping.json'; - - $this->removeFromFile($mimetypealiasesFile, ['application/km' => 'mindmap', 'application/x-freemind' => 'mindmap', 'application/vnd.xmind.workbook' => 'mindmap']); - $this->removeFromFile($mimetypemappingFile, ['km' => ['application/km'], 'mm' => ['application/x-freemind'], 'xmind' => ['application/vnd.xmind.workbook']]); - $this->logger->info("Remove .km,.mm,.xmind from mimetype list.", ["app" => "files_mindmap"]); - $this->updateJS->run(new StringInput(''), new ConsoleOutput()); - } - } - - private function removeFromFile(string $filename, array $data) { - $obj = []; - if (file_exists($filename)) { - $content = file_get_contents($filename); - $obj = json_decode($content, true); - } - foreach ($data as $key => $value) { - unset($obj[$key]); - } - file_put_contents($filename, json_encode($obj, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); - } -}