diff --git a/bl-plugins/backup/languages/en.json b/bl-plugins/backup/languages/en.json new file mode 100644 index 00000000..033c7938 --- /dev/null +++ b/bl-plugins/backup/languages/en.json @@ -0,0 +1,7 @@ +{ + "plugin-data": + { + "name": "Backup", + "description": "" + } +} \ No newline at end of file diff --git a/bl-plugins/backup/metadata.json b/bl-plugins/backup/metadata.json new file mode 100644 index 00000000..0a1ec2d2 --- /dev/null +++ b/bl-plugins/backup/metadata.json @@ -0,0 +1,10 @@ +{ + "author": "Bludit", + "email": "", + "website": "https://plugins.bludit.com", + "version": "2.0", + "releaseDate": "2017-06-15", + "license": "MIT", + "compatible": "2.0", + "notes": "" +} \ No newline at end of file diff --git a/bl-plugins/backup/plugin.php b/bl-plugins/backup/plugin.php new file mode 100644 index 00000000..21fd2dba --- /dev/null +++ b/bl-plugins/backup/plugin.php @@ -0,0 +1,125 @@ +formButtons = false; + + // Check for zip extension installed + $this->zip = extension_loaded('zip'); + } + + // Install the plugin and create the workspace directory + public function install($position=0) + { + parent::install($position); + $workspace = $this->workspace(); + return mkdir($workspace, 0755, true); + } + + // Uninstall the plugin and delete the workspace directory + public function uninstall() + { + parent::uninstall(); + $workspace = $this->workspace(); + return Filesystem::deleteRecursive($workspace); + } + + // Redefine workspace + public function workspace() + { + return PATH_CONTENT.'backup'.DS; + } + + public function post() + { + if (isset($_POST['createBackup'])) { + return $this->createBackup(); + } + + if (isset($_POST['restoreBackup'])) { + return $this->restoreBackup($_POST['restoreBackup']); + } + + return false; + } + + public function form() + { + global $Language; + + $backups = Filesystem::listDirectories($this->workspace(), '*', true); + if ($this->zip) { + $backups = Filesystem::listFiles($this->workspace(), '*', 'zip', true); + } + + $html = '