From 085f9ae1529a7aaa4ce1633bde3aaaeaa6b99a54 Mon Sep 17 00:00:00 2001 From: Shikiryu Date: Sun, 12 Jul 2015 20:53:15 +0200 Subject: [PATCH] adding docs --- app/code/backup/BackupAbstract.php | 33 +++--------------------------- app/code/backup/Folder.php | 22 ++++++++++++++++++++ app/code/backup/Mysql.php | 7 +++++++ bu/newhtml.html | 14 ------------- docs/using-scenario.md | 28 ++++++++++++++++++++++++- 5 files changed, 59 insertions(+), 45 deletions(-) create mode 100644 app/code/backup/Folder.php delete mode 100644 bu/newhtml.html diff --git a/app/code/backup/BackupAbstract.php b/app/code/backup/BackupAbstract.php index 513ebbe..2d5884a 100644 --- a/app/code/backup/BackupAbstract.php +++ b/app/code/backup/BackupAbstract.php @@ -54,7 +54,7 @@ class BackupAbstract * * @return $this */ - function addDate($format = 'Ymd') + public function addDate($format = 'Ymd') { $tmpFiles = array(); foreach ($this->_filesToBackup as $file => $name) { @@ -82,7 +82,7 @@ class BackupAbstract * * @return $this */ - function addTime($format = 'his') + public function addTime($format = 'his') { $tmpFiles = array(); foreach ($this->_filesToBackup as $file => $name) { @@ -108,30 +108,6 @@ class BackupAbstract } - /** - * @param $folder - */ - function backupToFolder($folder) - { - if (!empty($folder)) { - $folder = sprintf('%s/', rtrim($folder, '/')); - } -// if($folder != '') -// { -// if(substr($folder, 0, -1) != '/') -// $folder .= '/'; -// } - foreach ($this->_filesToBackup as $file => $name) { - copy($file, $folder . $name); - } - foreach ($this->_streamsToBackup as $name => $file) { - if (count(explode('.', $name)) < 2) { - $name = 'backup' . $name . '.txt'; - } - file_put_contents($folder . $name, $file); - } - } - /** * Check if all files got the minimum given size. * @@ -157,10 +133,7 @@ class BackupAbstract /** * @return bool */ - public function isValid() - { - return true; - } + abstract public function isValid(); } diff --git a/app/code/backup/Folder.php b/app/code/backup/Folder.php new file mode 100644 index 0000000..4870566 --- /dev/null +++ b/app/code/backup/Folder.php @@ -0,0 +1,22 @@ + diff --git a/bu/newhtml.html b/bu/newhtml.html deleted file mode 100644 index 6bd86f2..0000000 --- a/bu/newhtml.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - -
TODO write content
- - diff --git a/docs/using-scenario.md b/docs/using-scenario.md index 30404ce..b973c55 100644 --- a/docs/using-scenario.md +++ b/docs/using-scenario.md @@ -1 +1,27 @@ -TODO \ No newline at end of file +Scenario is based on a json explaining how the backup will work. +It contains 2 bases : + - backup (what you're going to backup) + - transport (how and where you're going to backup) + +# backup + - must begin with an uppercase + - a PHP class with the same name must exists in the Backup folder + +# transport + - must begin with an uppercase + - a PHP class with the same name must exists in the Transport folder + +# configuration of backup and transport + - all protected variable of the aimed class can be used as a configuration + +# tips +## JSON +The JSON must be compatible with the [PHP `json_decode`](http://php.net/manual/en/function.json-encode.php) implementation which correspond to [this one](http://www.faqs.org/rfcs/rfc4627.html) + +Basically : + - everything surrounded by " and no ' + - no comments + - escape escape escape + + +