@@ -85,7 +85,7 @@ |
||
| 85 | 85 | $this->tempFile = tempnam(sys_get_temp_dir(), 'pgsqlpass'); |
| 86 | 86 | $handler = fopen($this->tempFile, 'r+'); |
| 87 | 87 | fwrite($handler, $credentials); |
| 88 | - $env = ['PGPASSFILE' => $this->tempFile]; |
|
| 88 | + $env = [ 'PGPASSFILE' => $this->tempFile ]; |
|
| 89 | 89 | $process = $this->prepareProcessCommand($this->command); |
| 90 | 90 | if ($this->debug) { |
| 91 | 91 | $process->mustRun(null, $env); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | use DumperTrait, PrepareOptionsTrait; |
| 14 | 14 | |
| 15 | - public function __construct(array $options = []) |
|
| 15 | + public function __construct(array $options = [ ]) |
|
| 16 | 16 | { |
| 17 | 17 | foreach ($options as $option => $value) { |
| 18 | 18 | if (property_exists($this, $option)) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @return $this |
| 25 | 25 | */ |
| 26 | - public static function create(array $options = []) |
|
| 26 | + public static function create(array $options = [ ]) |
|
| 27 | 27 | { |
| 28 | 28 | return new static($options); |
| 29 | 29 | } |
@@ -68,9 +68,9 @@ |
||
| 68 | 68 | { |
| 69 | 69 | switch (strtolower($this->getDumperClassName())) { |
| 70 | 70 | case 'mysqldumper': |
| 71 | - $ignoreTablesArgs = []; |
|
| 71 | + $ignoreTablesArgs = [ ]; |
|
| 72 | 72 | foreach ($this->ignoreTables as $tableName) { |
| 73 | - $ignoreTablesArgs[] = "--ignore-table={$this->dbName}.{$tableName}"; |
|
| 73 | + $ignoreTablesArgs[ ] = "--ignore-table={$this->dbName}.{$tableName}"; |
|
| 74 | 74 | } |
| 75 | 75 | return (count($ignoreTablesArgs) > 0) ? implode(' ', $ignoreTablesArgs) : ''; |
| 76 | 76 | case 'pgsqldumper'; |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | /*@var int*/ |
| 22 | 22 | protected $timeout = 0; |
| 23 | 23 | /*@var array*/ |
| 24 | - protected $tables = []; |
|
| 24 | + protected $tables = [ ]; |
|
| 25 | 25 | /*@var array*/ |
| 26 | - protected $ignoreTables = []; |
|
| 26 | + protected $ignoreTables = [ ]; |
|
| 27 | 27 | /*@var string*/ |
| 28 | 28 | protected $destinationPath = 'dump.sql'; |
| 29 | 29 | /*@var string*/ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | throw new \Exception("You can choose only once between tables and ignoreTables at a time"); |
| 93 | 93 | } |
| 94 | 94 | if (is_string($tables)) { |
| 95 | - $tables = [$tables]; |
|
| 95 | + $tables = [ $tables ]; |
|
| 96 | 96 | } |
| 97 | 97 | $this->tables = $tables; |
| 98 | 98 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | throw new \Exception("You can choose only once between tables and ignoreTables at a time"); |
| 108 | 108 | } |
| 109 | 109 | if (is_string($tables)) { |
| 110 | - $tables = [$tables]; |
|
| 110 | + $tables = [ $tables ]; |
|
| 111 | 111 | } |
| 112 | 112 | $this->ignoreTables = $tables; |
| 113 | 113 | return $this; |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once 'vendor/autoload.php'; |
| 3 | -if (isset($_POST['backup'])) { |
|
| 3 | +if (isset($_POST[ 'backup' ])) { |
|
| 4 | 4 | $filename = 'backup_' . date('G_a_m_d_y_h_i_s') . ".sql"; |
| 5 | - $directory = $_POST['destination'] ?? ''; |
|
| 5 | + $directory = $_POST[ 'destination' ] ?? ''; |
|
| 6 | 6 | $destinationPath = $directory . DIRECTORY_SEPARATOR . $filename; |
| 7 | 7 | $options = [ |
| 8 | - 'host' => $_POST['host'], |
|
| 9 | - 'port' => $_POST['port'], |
|
| 10 | - 'dbName' => $_POST['dbname'], |
|
| 11 | - 'username' => $_POST['username'], |
|
| 12 | - 'password' => $_POST['password'], |
|
| 8 | + 'host' => $_POST[ 'host' ], |
|
| 9 | + 'port' => $_POST[ 'port' ], |
|
| 10 | + 'dbName' => $_POST[ 'dbname' ], |
|
| 11 | + 'username' => $_POST[ 'username' ], |
|
| 12 | + 'password' => $_POST[ 'password' ], |
|
| 13 | 13 | 'destinationPath' => $destinationPath, // /path/to/backups/mysql/dump |
| 14 | 14 | ]; |
| 15 | 15 | try { |
@@ -3,24 +3,24 @@ discard block |
||
| 3 | 3 | $successMsg = false; |
| 4 | 4 | $errorMsg = false; |
| 5 | 5 | $message = ""; |
| 6 | -if (isset($_GET['backup']) && $_GET['backup'] == 'success') { |
|
| 6 | +if (isset($_GET[ 'backup' ]) && $_GET[ 'backup' ] == 'success') { |
|
| 7 | 7 | $successMsg = true; |
| 8 | 8 | $message = "Database backedup successfully"; |
| 9 | 9 | } |
| 10 | -if (isset($_GET['backup']) && $_GET['backup'] == 'fail') { |
|
| 10 | +if (isset($_GET[ 'backup' ]) && $_GET[ 'backup' ] == 'fail') { |
|
| 11 | 11 | $errorMsg = true; |
| 12 | 12 | $message = "Database backedup failed"; |
| 13 | 13 | } |
| 14 | -if (isset($_GET['restore']) && $_GET['restore'] == 'success') { |
|
| 14 | +if (isset($_GET[ 'restore' ]) && $_GET[ 'restore' ] == 'success') { |
|
| 15 | 15 | $successMsg = true; |
| 16 | 16 | $message = "Database restored successfully"; |
| 17 | 17 | } |
| 18 | -if (isset($_GET['restore']) && $_GET['restore'] == 'fail') { |
|
| 18 | +if (isset($_GET[ 'restore' ]) && $_GET[ 'restore' ] == 'fail') { |
|
| 19 | 19 | $errorMsg = true; |
| 20 | 20 | $message = "Database restored failed"; |
| 21 | 21 | } |
| 22 | -if (isset($_GET['message'])) { |
|
| 23 | - $message = $_GET['message']; |
|
| 22 | +if (isset($_GET[ 'message' ])) { |
|
| 23 | + $message = $_GET[ 'message' ]; |
|
| 24 | 24 | } |
| 25 | 25 | ?> |
| 26 | 26 | <!DOCTYPE html> |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | <div class="success"> |
| 37 | 37 | <?php if ($successMsg): ?> |
| 38 | 38 | <p class="alert alert-success"><?php echo $message; ?></p> |
| 39 | - <?php endif;?> |
|
| 39 | + <?php endif; ?> |
|
| 40 | 40 | </div> |
| 41 | 41 | <div class="error"> |
| 42 | 42 | <?php if ($errorMsg): ?> |
| 43 | 43 | <p class="alert alert-danger"><?php echo $message; ?></p> |
| 44 | - <?php endif;?> |
|
| 44 | + <?php endif; ?> |
|
| 45 | 45 | </div> |
| 46 | 46 | <a href="backup.php" class="btn btn-success my-3">Create a new backup</a> |
| 47 | 47 | <a href="index.php" class="btn btn-info my-3">Reload</a> |
| 48 | -<?php $files = glob(__DIR__ . '/backups/*');?> |
|
| 48 | +<?php $files = glob(__DIR__ . '/backups/*'); ?> |
|
| 49 | 49 | <?php if (count($files)): ?> |
| 50 | 50 | <table class="table table-bordered"> |
| 51 | 51 | <thead> |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | </thead> |
| 59 | 59 | <tbody> |
| 60 | 60 | <?php foreach ($files as $key => $file): ?> |
| 61 | - <?php $info = pathinfo($file);?> |
|
| 61 | + <?php $info = pathinfo($file); ?> |
|
| 62 | 62 | <tr> |
| 63 | 63 | <th scope="row"><?php echo $key + 1 ?></th> |
| 64 | - <td><?php echo $info['basename'] ?></td> |
|
| 65 | - <td><?php echo $info['dirname'] ?></td> |
|
| 64 | + <td><?php echo $info[ 'basename' ] ?></td> |
|
| 65 | + <td><?php echo $info[ 'dirname' ] ?></td> |
|
| 66 | 66 | <td class="d-flex"> |
| 67 | 67 | <form action="restore.php" method="GET" class="inline-flex mr-2"> |
| 68 | 68 | <input type="hidden" name="restore_path" value="<?php echo $file ?>"> |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | </form> |
| 75 | 75 | </td> |
| 76 | 76 | </tr> |
| 77 | - <?php endforeach;?> |
|
| 77 | + <?php endforeach; ?> |
|
| 78 | 78 | </tbody> |
| 79 | 79 | </table> |
| 80 | 80 | <?php else: ?> |
| 81 | 81 | <p class="alert alert-danger">There is no backup</p> |
| 82 | - <?php endif;?> |
|
| 82 | + <?php endif; ?> |
|
| 83 | 83 | </div> |
| 84 | 84 | </div> |
| 85 | 85 | </div> |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require 'vendor/autoload.php'; |
| 3 | 3 | $restore_path = ""; |
| 4 | -if (isset($_GET['restore_path'])) { |
|
| 5 | - $restore_path = $_GET['restore_path']; |
|
| 4 | +if (isset($_GET[ 'restore_path' ])) { |
|
| 5 | + $restore_path = $_GET[ 'restore_path' ]; |
|
| 6 | 6 | } |
| 7 | -if (isset($_POST['restore'])) { |
|
| 7 | +if (isset($_POST[ 'restore' ])) { |
|
| 8 | 8 | $options = [ |
| 9 | - 'host' => $_POST['host'], |
|
| 10 | - 'port' => $_POST['port'], |
|
| 11 | - 'dbName' => $_POST['dbname'], |
|
| 12 | - 'username' => $_POST['username'], |
|
| 13 | - 'password' => $_POST['password'], |
|
| 14 | - 'restorePath' => $_POST['restore_path'], // /path/to/restores/mysql/dump |
|
| 9 | + 'host' => $_POST[ 'host' ], |
|
| 10 | + 'port' => $_POST[ 'port' ], |
|
| 11 | + 'dbName' => $_POST[ 'dbname' ], |
|
| 12 | + 'username' => $_POST[ 'username' ], |
|
| 13 | + 'password' => $_POST[ 'password' ], |
|
| 14 | + 'restorePath' => $_POST[ 'restore_path' ], // /path/to/restores/mysql/dump |
|
| 15 | 15 | ]; |
| 16 | 16 | try { |
| 17 | 17 | $dumper = new \CodexShaper\Dumper\Drivers\MysqlDumper($options); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require 'vendor/autoload.php'; |
| 3 | -if (isset($_POST['remove'])) { |
|
| 4 | - $file = $_POST['restore_path'] ?? ""; |
|
| 3 | +if (isset($_POST[ 'remove' ])) { |
|
| 4 | + $file = $_POST[ 'restore_path' ] ?? ""; |
|
| 5 | 5 | try { |
| 6 | 6 | if (file_exists($file)) { |
| 7 | 7 | unlink($file); |