Passed
Push — master ( ee38c6...9c0cb8 )
by CodexShaper
02:59 queued 11s
created
demos/backup.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
demos/index.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,9 +77,12 @@
 block discarded – undo
77 77
     <?php endforeach;?>
78 78
      </tbody>
79 79
    </table>
80
-   <?php else: ?>
80
+   <?php else {
81
+    : ?>
81 82
     <p class="alert alert-danger">There is no backup</p>
82
-   <?php endif;?>
83
+   <?php endif;
84
+}
85
+?>
83 86
     </div>
84 87
   </div>
85 88
  </div>
Please login to merge, or discard this patch.
demos/restore.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
demos/remove.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.