mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2021-06-30 16:02:14 +02:00
42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
namespace Shikiryu\Backup\Backup;
|
|
|
|
class Files extends BackupAbstract
|
|
{
|
|
|
|
/**
|
|
* @param array $config
|
|
* @throws \Exception
|
|
*/
|
|
function __construct($config = array())
|
|
{
|
|
parent::__construct();
|
|
if (!isset($config['files'])) {
|
|
throw new \Exception('Files needs a "files" configuration.');
|
|
}
|
|
$filesToBackup = $config['files'];
|
|
if(!empty($filesToBackup) && is_array($filesToBackup)){
|
|
$names = array_map("basename",$filesToBackup);
|
|
$this->_filesToBackup = array_combine($filesToBackup,$names);
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @param string[] $filestobackup a list of file path
|
|
*
|
|
* @return $this
|
|
*/
|
|
function setFilePath($filesToBackup = array())
|
|
{
|
|
if(!empty($filesToBackup) && is_array($filesToBackup))
|
|
{
|
|
$names = array_map("basename",$filesToBackup);
|
|
$this->_filesToBackup = array_combine($filesToBackup,$names);
|
|
}
|
|
return $this;
|
|
}
|
|
}
|
|
?>
|