mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2021-06-30 16:02:14 +02:00
🎨 Reformat some code
This commit is contained in:
@@ -151,7 +151,7 @@ abstract class BackupAbstract
|
||||
foreach ($this->options as $name => $value) {
|
||||
$method = sprintf('setOption%s', ucfirst($name));
|
||||
if (method_exists($this, $method)) {
|
||||
call_user_func([$this, $method], $value);
|
||||
$this->$method($value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ abstract class BackupAbstract
|
||||
if (touch(TEMP_DIR . $zip_name) === false) {
|
||||
throw new \Exception('Backup::Zip::Permission denied.');
|
||||
}
|
||||
if ($zip->open(TEMP_DIR . $zip_name, \ZipArchive::OVERWRITE) == true) {
|
||||
if ($zip->open(TEMP_DIR . $zip_name, \ZipArchive::OVERWRITE) === true) {
|
||||
foreach ($this->files_to_backup as $file => $name) {
|
||||
$zip->addFile($file, $name); // Adding files into zip
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class Files extends BackupAbstract
|
||||
}
|
||||
$filesToBackup = $config['files'];
|
||||
if (!empty($filesToBackup) && is_array($filesToBackup)) {
|
||||
$names = array_map("basename", $filesToBackup);
|
||||
$names = array_map('basename', $filesToBackup);
|
||||
$this->files_to_backup = array_combine($filesToBackup, $names);
|
||||
}
|
||||
parent::__construct($config);
|
||||
|
@@ -60,17 +60,15 @@ class Mysql extends BackupAbstract
|
||||
*/
|
||||
private function getFromTables()
|
||||
{
|
||||
$return = "";
|
||||
$return = '';
|
||||
foreach ($this->tables as $table) {
|
||||
if (is_array($table)) {
|
||||
$table = $table[0];
|
||||
}
|
||||
$result = $this->pdo->prepare('SELECT * FROM ' . $table);
|
||||
$result->execute();
|
||||
$result = $this->pdo->query('SELECT * FROM ' . $table);
|
||||
$num_fields = $result->columnCount();
|
||||
$return .= 'DROP TABLE IF EXISTS ' . $table . ';';
|
||||
$result2 = $this->pdo->prepare('SHOW CREATE TABLE ' . $table);
|
||||
$result2->execute();
|
||||
$result2 = $this->pdo->query('SHOW CREATE TABLE ' . $table);
|
||||
$row2 = $result2->fetch();
|
||||
$return.= "\n\n" . $row2[1] . ";\n\n";
|
||||
foreach ($result as $row) {
|
||||
@@ -123,6 +121,6 @@ class Mysql extends BackupAbstract
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
empty($this->tables) || $this->tables == '*' ? $this->everything() : $this->fromTables($this->tables);
|
||||
empty($this->tables) || $this->tables === '*' ? $this->everything() : $this->fromTables($this->tables);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user