mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2021-06-30 16:02:14 +02:00
Abstraction and factorization
This commit is contained in:
40
Abstract.php
40
Abstract.php
@@ -18,6 +18,22 @@ class Shikiryu_Backup_Abstract
|
||||
$this->_streamsToBackup = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFilesToBackup()
|
||||
{
|
||||
return $this->_filesToBackup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getStreamsToBackup()
|
||||
{
|
||||
return $this->_streamsToBackup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the current date with the given format into the files names
|
||||
*
|
||||
@@ -78,17 +94,32 @@ class Shikiryu_Backup_Abstract
|
||||
return $this;
|
||||
}
|
||||
|
||||
function backupToEmail($to, $from, $objet, $mes)
|
||||
/**
|
||||
*
|
||||
* @param $name string
|
||||
* @param $args mixed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
if (substr($name,0,8) == 'backupTo') {
|
||||
$type = substr($name, 8);
|
||||
return Shikiryu_Backup_Transport_Factory::getAndSend($type, $this, $args);
|
||||
}
|
||||
}
|
||||
|
||||
/*function backupToEmail($to, $from, $object, $mes)
|
||||
{
|
||||
$email = new Shikiryu_Backup_Email();
|
||||
$email->addTo($to)
|
||||
->setFrom($from)
|
||||
->setSubject($objet)
|
||||
->setSubject($object)
|
||||
->setMessage($mes)
|
||||
->setFiles($this->_filesToBackup)
|
||||
->setStreams($this->_streamsToBackup);
|
||||
return $email->send();
|
||||
}
|
||||
}*/
|
||||
|
||||
function backupToDropbox()
|
||||
{
|
||||
@@ -103,6 +134,9 @@ class Shikiryu_Backup_Abstract
|
||||
->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $folder
|
||||
*/
|
||||
function backupToFolder($folder)
|
||||
{
|
||||
if (!empty($folder)) {
|
||||
|
Reference in New Issue
Block a user