mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2021-06-30 16:02:14 +02:00
adding docs
This commit is contained in:
parent
8426972504
commit
085f9ae152
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
22
app/code/backup/Folder.php
Normal file
22
app/code/backup/Folder.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Shikiryu\Backup\Backup;
|
||||
|
||||
class Folder extends BackupAbstract
|
||||
{
|
||||
|
||||
public function __construct(array $config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
// TODO: Implement isValid() method.
|
||||
}
|
||||
}
|
@ -90,6 +90,13 @@ class Mysql extends BackupAbstract
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
// TODO: Implement isValid() method.
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,14 +0,0 @@
|
||||
<!--
|
||||
To change this template, choose Tools | Templates
|
||||
and open the template in the editor.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div>TODO write content</div>
|
||||
</body>
|
||||
</html>
|
@ -1 +1,27 @@
|
||||
TODO
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user