mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2021-06-30 16:02:14 +02:00
Add a lot of docs
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Shikiryu\Backup\Backup;
|
||||
|
||||
abstract class BackupAbstract
|
||||
{
|
||||
|
||||
/** @var array */
|
||||
protected $options;
|
||||
/** @var string[] */
|
||||
protected $_filesToBackup = [];
|
||||
@@ -75,6 +75,9 @@ abstract class BackupAbstract
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize everything
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$this->preBuild();
|
||||
@@ -82,10 +85,24 @@ abstract class BackupAbstract
|
||||
$this->postBuild();
|
||||
$this->applyOptions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that can be used to initialize the backup
|
||||
*/
|
||||
abstract protected function preBuild();
|
||||
/**
|
||||
* Function that can be used after the backup
|
||||
*/
|
||||
abstract protected function postBuild();
|
||||
/**
|
||||
* Mandatory function doing the backup
|
||||
*/
|
||||
abstract protected function build();
|
||||
/**
|
||||
* Check if the backup is valid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function isValid();
|
||||
|
||||
/**
|
||||
@@ -204,7 +221,10 @@ abstract class BackupAbstract
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @SuppressWarnings("unused")
|
||||
*/
|
||||
protected function setOptionName($name)
|
||||
{
|
||||
@@ -214,5 +234,3 @@ abstract class BackupAbstract
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -21,6 +21,13 @@ class Files extends BackupAbstract
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the backup is valid
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @SuppressWarnings("unused")
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
$result = true;
|
||||
@@ -32,17 +39,26 @@ class Files extends BackupAbstract
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that can be used to initialize the backup
|
||||
*/
|
||||
protected function preBuild()
|
||||
{
|
||||
// TODO: Implement preBuild() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be used after the backup
|
||||
*/
|
||||
protected function postBuild()
|
||||
{
|
||||
// TODO: Implement postBuild() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Mandatory function doing the backup
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
// TODO: Implement build() method.
|
||||
|
@@ -18,16 +18,25 @@ class Folder extends BackupAbstract
|
||||
// TODO: Implement isValid() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be used to initialize the backup
|
||||
*/
|
||||
protected function preBuild()
|
||||
{
|
||||
// TODO: Implement preBuild() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be used after the backup
|
||||
*/
|
||||
protected function postBuild()
|
||||
{
|
||||
// TODO: Implement postBuild() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Mandatory function doing the backup
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
// TODO: Implement build() method.
|
||||
|
@@ -100,16 +100,25 @@ class Mysql extends BackupAbstract
|
||||
return !empty($this->_streamsToBackup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be used to initialize the backup
|
||||
*/
|
||||
protected function preBuild()
|
||||
{
|
||||
$this->pdo = new \PDO('mysql:host='.$this->host.';dbname='.$this->database, $this->login, $this->pwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be used after the backup
|
||||
*/
|
||||
protected function postBuild()
|
||||
{
|
||||
// TODO: Implement postBuild() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Mandatory function doing the backup
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
empty($this->tables) || $this->tables == '*' ? $this->everything() : $this->fromTables($this->tables);
|
||||
|
Reference in New Issue
Block a user