GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 07805d...9051f0 )
by Liuta
06:03 queued 03:27
created
phar-generate.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!isset($argv))
3
+if(!isset($argv)) {
4 4
 	die('Access denied from web.');
5
+}
5 6
 
6 7
 $file = 'restore/vendor.phar';	
7 8
 
8
-if(file_exists($file))
9
+if(file_exists($file)) {
9 10
 	unlink($file);
11
+}
10 12
 $phar2 = new Phar($file, 0, 'vendor.phar');
11 13
 
12 14
 // add all files in the project, only include php files
Please login to merge, or discard this patch.
includes/class-xcloner-sanitization.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 		
25 25
 		try{
26 26
 			$option = Util::normalizePath($path);
27
-		}catch(Exception $e){
27
+		} catch(Exception $e){
28 28
 			add_settings_error('xcloner_error_message', '', __($e->getMessage()), 'error');
29 29
 		}
30 30
 		
Please login to merge, or discard this patch.
includes/class-xcloner-activator.php 1 patch
Braces   +39 added lines, -26 removed lines patch added patch discarded remove patch
@@ -69,44 +69,57 @@
 block discarded – undo
69 69
 			update_option( "xcloner_db_version", $xcloner_db_version );
70 70
 		}
71 71
 	
72
-		if(!get_option('xcloner_backup_compression_level'))
73
-			update_option('xcloner_backup_compression_level', 0);
72
+		if(!get_option('xcloner_backup_compression_level')) {
73
+					update_option('xcloner_backup_compression_level', 0);
74
+		}
74 75
 		
75
-		if(!get_option('xcloner_enable_log'))
76
-			update_option('xcloner_enable_log', 1);
76
+		if(!get_option('xcloner_enable_log')) {
77
+					update_option('xcloner_enable_log', 1);
78
+		}
77 79
 			
78
-		if(!get_option('xcloner_enable_mysql_backup'))
79
-			update_option('xcloner_enable_mysql_backup', 1);
80
+		if(!get_option('xcloner_enable_mysql_backup')) {
81
+					update_option('xcloner_enable_mysql_backup', 1);
82
+		}
80 83
 		
81
-		if(!get_option('xcloner_system_settings_page'))
82
-			update_option('xcloner_system_settings_page', 100);
84
+		if(!get_option('xcloner_system_settings_page')) {
85
+					update_option('xcloner_system_settings_page', 100);
86
+		}
83 87
 			
84
-		if(!get_option('xcloner_files_to_process_per_request'))
85
-			update_option('xcloner_files_to_process_per_request', 250);
88
+		if(!get_option('xcloner_files_to_process_per_request')) {
89
+					update_option('xcloner_files_to_process_per_request', 250);
90
+		}
86 91
 
87
-		if(!get_option('xcloner_database_records_per_request'))
88
-			update_option('xcloner_database_records_per_request', 10000);
92
+		if(!get_option('xcloner_database_records_per_request')) {
93
+					update_option('xcloner_database_records_per_request', 10000);
94
+		}
89 95
 
90
-		if(!get_option('xcloner_exclude_files_larger_than_mb'))
91
-			update_option('xcloner_exclude_files_larger_than_mb', 0);
96
+		if(!get_option('xcloner_exclude_files_larger_than_mb')) {
97
+					update_option('xcloner_exclude_files_larger_than_mb', 0);
98
+		}
92 99
 		
93
-		if(!get_option('xcloner_split_backup_limit'))
94
-			update_option('xcloner_split_backup_limit', 2048);
100
+		if(!get_option('xcloner_split_backup_limit')) {
101
+					update_option('xcloner_split_backup_limit', 2048);
102
+		}
95 103
 			
96
-		if(!get_option('xcloner_size_limit_per_request'))
97
-			update_option('xcloner_size_limit_per_request', 50);
104
+		if(!get_option('xcloner_size_limit_per_request')) {
105
+					update_option('xcloner_size_limit_per_request', 50);
106
+		}
98 107
 			
99
-		if(!get_option('xcloner_cleanup_retention_limit_days'))
100
-			update_option('xcloner_cleanup_retention_limit_days', 60);
108
+		if(!get_option('xcloner_cleanup_retention_limit_days')) {
109
+					update_option('xcloner_cleanup_retention_limit_days', 60);
110
+		}
101 111
 			
102
-		if(!get_option('xcloner_cleanup_retention_limit_archives'))
103
-			update_option('xcloner_cleanup_retention_limit_archives', 100);
112
+		if(!get_option('xcloner_cleanup_retention_limit_archives')) {
113
+					update_option('xcloner_cleanup_retention_limit_archives', 100);
114
+		}
104 115
 			
105
-		if(!get_option('xcloner_directories_to_scan_per_request'))
106
-			update_option('xcloner_directories_to_scan_per_request', 25);
116
+		if(!get_option('xcloner_directories_to_scan_per_request')) {
117
+					update_option('xcloner_directories_to_scan_per_request', 25);
118
+		}
107 119
 			
108
-		if(!get_option('xcloner_regex_exclude'))
109
-			update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$");
120
+		if(!get_option('xcloner_regex_exclude')) {
121
+					update_option('xcloner_regex_exclude', "(wp-content\/updraft|wp-content\/uploads\/wp_all_backup)(.*)$".PHP_EOL."(.*)\.(svn|git)(.*)$".PHP_EOL."wp-content\/cache(.*)$");
122
+		}
110 123
 
111 124
 	}
112 125
 	
Please login to merge, or discard this patch.
includes/class-xcloner-settings.php 1 patch
Braces   +80 added lines, -56 removed lines patch added patch discarded remove patch
@@ -8,26 +8,29 @@  discard block
 block discarded – undo
8 8
 	
9 9
 	public function __construct($hash = "")
10 10
 	{
11
-		if(isset($hash))
12
-			$this->set_hash($hash);
11
+		if(isset($hash)) {
12
+					$this->set_hash($hash);
13
+		}
13 14
 	}
14 15
 	
15 16
 	public function get_logger_filename($include_hash = 0)
16 17
 	{
17
-		if($include_hash)
18
-			$filename = sprintf($this->logger_file_hash, $this->get_hash()); 
19
-		else
20
-			$filename = sprintf($this->logger_file, $this->get_server_unique_hash(5));
18
+		if($include_hash) {
19
+					$filename = sprintf($this->logger_file_hash, $this->get_hash());
20
+		} else {
21
+					$filename = sprintf($this->logger_file, $this->get_server_unique_hash(5));
22
+		}
21 23
 		
22 24
 		return $filename;
23 25
 	}
24 26
 	
25 27
 	public function get_xcloner_start_path()
26 28
 	{
27
-		if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path')))
28
-			$path = realpath(ABSPATH);
29
-		else
30
-			$path = get_option('xcloner_start_path');
29
+		if(!get_option('xcloner_start_path') or !is_dir(get_option('xcloner_start_path'))) {
30
+					$path = realpath(ABSPATH);
31
+		} else {
32
+					$path = get_option('xcloner_start_path');
33
+		}
31 34
 		
32 35
 		return $path;
33 36
 	}
@@ -41,10 +44,11 @@  discard block
 block discarded – undo
41 44
 	
42 45
 	public function get_xcloner_store_path()
43 46
 	{
44
-		if(!get_option('xcloner_store_path')  or !is_dir(get_option('xcloner_store_path')))
45
-			$path = realpath(XCLONER_STORAGE_PATH);
46
-		else
47
-			$path = get_option('xcloner_store_path');
47
+		if(!get_option('xcloner_store_path')  or !is_dir(get_option('xcloner_store_path'))) {
48
+					$path = realpath(XCLONER_STORAGE_PATH);
49
+		} else {
50
+					$path = get_option('xcloner_store_path');
51
+		}
48 52
 		
49 53
 		return $path;
50 54
 	}
@@ -64,16 +68,18 @@  discard block
 block discarded – undo
64 68
 			@chmod($path, 0777);
65 69
 		}
66 70
 		
67
-		if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root'))
68
-			$path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix();
71
+		if(!is_dir($path) or !is_writeable($path) or get_option('xcloner_force_tmp_path_site_root')) {
72
+					$path = $this->get_xcloner_store_path().DS.".".$this->get_xcloner_tmp_path_suffix();
73
+		}
69 74
 		
70 75
 		return $path;
71 76
 	}
72 77
 	
73 78
 	public function get_enable_mysql_backup()
74 79
 	{
75
-		if(get_option('xcloner_enable_mysql_backup'))
76
-			return true;
80
+		if(get_option('xcloner_enable_mysql_backup')) {
81
+					return true;
82
+		}
77 83
 		
78 84
 		return false;	
79 85
 	}
@@ -82,10 +88,11 @@  discard block
 block discarded – undo
82 88
 	{
83 89
 		if(!$ext)
84 90
 		{
85
-			if(get_option('xcloner_backup_compression_level'))
86
-				$ext = ".tgz";
87
-			else
88
-				$ext = ".tar";
91
+			if(get_option('xcloner_backup_compression_level')) {
92
+							$ext = ".tgz";
93
+			} else {
94
+							$ext = ".tar";
95
+			}
89 96
 		}	
90 97
 		return ($this->get_hash()).$ext;	
91 98
 	}
@@ -111,8 +118,9 @@  discard block
 block discarded – undo
111 118
 	
112 119
 	public function set_hash($hash = "")
113 120
 	{
114
-		if(substr($hash, 0, 1) != "-" and strlen($hash))
115
-			$hash = "-".$hash;
121
+		if(substr($hash, 0, 1) != "-" and strlen($hash)) {
122
+					$hash = "-".$hash;
123
+		}
116 124
 			
117 125
 		$this->hash = substr( $hash, 0, 6);
118 126
 		
@@ -132,8 +140,9 @@  discard block
 block discarded – undo
132 140
 	{
133 141
 		global $wpdb;
134 142
 		
135
-		if(!$data = get_option('xcloner_mysql_hostname'))
136
-			$data = $wpdb->dbhost;
143
+		if(!$data = get_option('xcloner_mysql_hostname')) {
144
+					$data = $wpdb->dbhost;
145
+		}
137 146
 		
138 147
 		return $data;
139 148
 	}
@@ -142,8 +151,9 @@  discard block
 block discarded – undo
142 151
 	{
143 152
 		global $wpdb;
144 153
 		
145
-		if(!$data = get_option('xcloner_mysql_username'))
146
-			$data = $wpdb->dbuser;
154
+		if(!$data = get_option('xcloner_mysql_username')) {
155
+					$data = $wpdb->dbuser;
156
+		}
147 157
 		
148 158
 		return $data;
149 159
 	}
@@ -152,8 +162,9 @@  discard block
 block discarded – undo
152 162
 	{
153 163
 		global $wpdb;
154 164
 		
155
-		if(!$data = get_option('xcloner_mysql_password'))
156
-			$data = $wpdb->dbpassword;
165
+		if(!$data = get_option('xcloner_mysql_password')) {
166
+					$data = $wpdb->dbpassword;
167
+		}
157 168
 		
158 169
 		return $data;
159 170
 	}
@@ -162,8 +173,9 @@  discard block
 block discarded – undo
162 173
 	{
163 174
 		global $wpdb;
164 175
 		
165
-		if(!$data = get_option('xcloner_mysql_database'))
166
-			$data = $wpdb->dbname;
176
+		if(!$data = get_option('xcloner_mysql_database')) {
177
+					$data = $wpdb->dbname;
178
+		}
167 179
 		
168 180
 		return $data;
169 181
 	}
@@ -186,8 +198,9 @@  discard block
 block discarded – undo
186 198
 	{
187 199
 		$hash = md5(get_home_url().__DIR__);
188 200
 		
189
-		if($strlen)
190
-			$hash = substr($hash, 0, $strlen);
201
+		if($strlen) {
202
+					$hash = substr($hash, 0, $strlen);
203
+		}
191 204
 			
192 205
 		return $hash;
193 206
 	}
@@ -554,15 +567,18 @@  discard block
 block discarded – undo
554 567
 	// text field content cb
555 568
 	public function do_form_text_field($params)
556 569
 	{
557
-		if(!isset($params['3']))
558
-			$params[3] = 0;
559
-		if(!isset($params['2']))
560
-			$params[2] = 0;	
570
+		if(!isset($params['3'])) {
571
+					$params[3] = 0;
572
+		}
573
+		if(!isset($params['2'])) {
574
+					$params[2] = 0;
575
+		}
561 576
 			
562 577
 		list($fieldname, $label, $value, $disabled) = $params;
563 578
 		
564
-		if(!$value)
565
-			$value = get_option($fieldname);
579
+		if(!$value) {
580
+					$value = get_option($fieldname);
581
+		}
566 582
 	    // output the field
567 583
 	    ?>
568 584
 	    <div class="row">
@@ -581,15 +597,18 @@  discard block
 block discarded – undo
581 597
 	// textarea field content cb
582 598
 	public function do_form_textarea_field($params)
583 599
 	{
584
-		if(!isset($params['3']))
585
-			$params[3] = 0;
586
-		if(!isset($params['2']))
587
-			$params[2] = 0;	
600
+		if(!isset($params['3'])) {
601
+					$params[3] = 0;
602
+		}
603
+		if(!isset($params['2'])) {
604
+					$params[2] = 0;
605
+		}
588 606
 			
589 607
 		list($fieldname, $label, $value, $disabled) = $params;
590 608
 		
591
-		if(!$value)
592
-			$value = get_option($fieldname);
609
+		if(!$value) {
610
+					$value = get_option($fieldname);
611
+		}
593 612
 	    // output the field
594 613
 	    ?>
595 614
 	    <div class="row">
@@ -624,15 +643,18 @@  discard block
 block discarded – undo
624 643
 	// number field content cb
625 644
 	public function do_form_number_field($params)
626 645
 	{
627
-		if(!isset($params['3']))
628
-			$params[3] = 0;
629
-		if(!isset($params['2']))
630
-			$params[2] = 0;	
646
+		if(!isset($params['3'])) {
647
+					$params[3] = 0;
648
+		}
649
+		if(!isset($params['2'])) {
650
+					$params[2] = 0;
651
+		}
631 652
 			
632 653
 		list($fieldname, $label, $value, $disabled) = $params;
633 654
 		
634
-		if(!$value)
635
-			$value = get_option($fieldname);
655
+		if(!$value) {
656
+					$value = get_option($fieldname);
657
+		}
636 658
 	    // output the field
637 659
 	    ?>
638 660
 	    <div class="row">
@@ -650,8 +672,9 @@  discard block
 block discarded – undo
650 672
 	
651 673
 	public function do_form_range_field($params)
652 674
 	{
653
-		if(!isset($params['4']))
654
-			$params[4] = 0;
675
+		if(!isset($params['4'])) {
676
+					$params[4] = 0;
677
+		}
655 678
 			
656 679
 		list($fieldname, $label, $range_start, $range_end, $disabled) = $params;
657 680
 		$value = get_option($fieldname);
@@ -672,8 +695,9 @@  discard block
 block discarded – undo
672 695
 	
673 696
 	public function do_form_switch_field($params)
674 697
 	{
675
-		if(!isset($params['2']))
676
-			$params[2] = 0;
698
+		if(!isset($params['2'])) {
699
+					$params[2] = 0;
700
+		}
677 701
 		list($fieldname, $label, $disabled) = $params;
678 702
 		$value = get_option($fieldname);
679 703
 	?>
Please login to merge, or discard this patch.
includes/class-xcloner-requirements.php 1 patch
Braces   +49 added lines, -34 removed lines patch added patch discarded remove patch
@@ -13,20 +13,25 @@  discard block
 block discarded – undo
13 13
 	
14 14
 	public function check_backup_ready_status()
15 15
 	{
16
-		if(!$this->check_min_php_version(1))
17
-			return false;
16
+		if(!$this->check_min_php_version(1)) {
17
+					return false;
18
+		}
18 19
 		
19
-		if(!$this->check_safe_mode(1))
20
-			return false;
20
+		if(!$this->check_safe_mode(1)) {
21
+					return false;
22
+		}
21 23
 		
22
-		if(!$this->check_xcloner_start_path(1))
23
-			return false;
24
+		if(!$this->check_xcloner_start_path(1)) {
25
+					return false;
26
+		}
24 27
 		
25
-		if(!$this->check_xcloner_store_path(1))
26
-			return false;
28
+		if(!$this->check_xcloner_store_path(1)) {
29
+					return false;
30
+		}
27 31
 		
28
-		if(!$this->check_xcloner_tmp_path(1))
29
-			return false;
32
+		if(!$this->check_xcloner_tmp_path(1)) {
33
+					return false;
34
+		}
30 35
 			
31 36
 		return true;	
32 37
 	}
@@ -41,10 +46,11 @@  discard block
 block discarded – undo
41 46
 		
42 47
 		if($return_bool == 1)
43 48
 		{
44
-			if(version_compare(phpversion(), $this->min_php_version, '<'))
45
-				return false;
46
-			else
47
-				return true;
49
+			if(version_compare(phpversion(), $this->min_php_version, '<')) {
50
+							return false;
51
+			} else {
52
+							return true;
53
+			}
48 54
 		}
49 55
 		
50 56
 		return phpversion();
@@ -56,14 +62,16 @@  discard block
 block discarded – undo
56 62
 		
57 63
 		if($return_bool)
58 64
 		{
59
-			if( ini_get('safe_mode') )
60
-				return false;
61
-			else
62
-				return true;
65
+			if( ini_get('safe_mode') ) {
66
+							return false;
67
+			} else {
68
+							return true;
69
+			}
63 70
 		}
64 71
 		
65
-		if( ini_get('safe_mode') )
66
-			$safe_mode = "On";
72
+		if( ini_get('safe_mode') ) {
73
+					$safe_mode = "On";
74
+		}
67 75
 			
68 76
 		return $safe_mode;
69 77
 	}
@@ -74,8 +82,9 @@  discard block
 block discarded – undo
74 82
 		
75 83
 		if($return_bool)
76 84
 		{
77
-			if(!file_exists($path))
78
-				return false;
85
+			if(!file_exists($path)) {
86
+							return false;
87
+			}
79 88
 				
80 89
 			return is_readable($path);
81 90
 		}
@@ -89,11 +98,13 @@  discard block
 block discarded – undo
89 98
 		
90 99
 		if($return_bool)
91 100
 		{
92
-			if(!file_exists($path))
93
-				return false;
101
+			if(!file_exists($path)) {
102
+							return false;
103
+			}
94 104
 			
95
-			if(!is_writeable($path))	
96
-				@chmod($path, 0777);
105
+			if(!is_writeable($path)) {
106
+							@chmod($path, 0777);
107
+			}
97 108
 					
98 109
 			return is_writeable($path);
99 110
 		}
@@ -107,11 +118,13 @@  discard block
 block discarded – undo
107 118
 		
108 119
 		if($return_bool)
109 120
 		{
110
-			if(!file_exists($path))
111
-				return false;
121
+			if(!file_exists($path)) {
122
+							return false;
123
+			}
112 124
 			
113
-			if(!is_writeable($path))	
114
-				@chmod($path, 0777);
125
+			if(!is_writeable($path)) {
126
+							@chmod($path, 0777);
127
+			}
115 128
 				
116 129
 			return is_writeable($path);
117 130
 		}
@@ -133,8 +146,9 @@  discard block
 block discarded – undo
133 146
 	{
134 147
 		$open_basedir =  ini_get('open_basedir');
135 148
 		
136
-		if(!$open_basedir)
137
-			$open_basedir = "none";
149
+		if(!$open_basedir) {
150
+					$open_basedir = "none";
151
+		}
138 152
 		return $open_basedir;	
139 153
 	}
140 154
 	
@@ -153,8 +167,9 @@  discard block
 block discarded – undo
153 167
 	  $unit_count = count($unit_list);
154 168
 	  for ($i = $unit_count - 1; $i >= 0; $i--) {
155 169
 	    $power = $i * 10;
156
-	    if (($bytes >> $power) >= 1)
157
-	      return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i];
170
+	    if (($bytes >> $power) >= 1) {
171
+	    	      return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i];
172
+	    }
158 173
 	  }
159 174
 	}
160 175
 }
Please login to merge, or discard this patch.
includes/class-xcloner-file-transfer.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	
20 20
 	public function transfer_file($file, $start = 0, $hash = "")
21 21
 	{
22
-		if(!$this->target_url)
23
-			throw new Exception("Please setup a target url for upload");
22
+		if(!$this->target_url) {
23
+					throw new Exception("Please setup a target url for upload");
24
+		}
24 25
 
25 26
 		
26 27
 		$fp = $this->get_storage_filesystem()->readStream($file);
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 		
69 70
 		$result = json_decode($original_result);
70 71
 				
71
-		if(!$result)
72
-			throw new Exception("We have received no valid response from the remote host, original message: ". $original_result);
72
+		if(!$result) {
73
+					throw new Exception("We have received no valid response from the remote host, original message: ". $original_result);
74
+		}
73 75
 			
74 76
 		if($result->status != 200)
75 77
 		{
@@ -94,7 +96,7 @@  discard block
 block discarded – undo
94 96
 	            . ($postname ?: basename($filename))
95 97
 	            . ($mimetype ? ";type=$mimetype" : '');
96 98
 		
97
-		}else{
99
+		} else{
98 100
 			
99 101
 			return curl_file_create($filename, $mimetype, $postname);	
100 102
 				
Please login to merge, or discard this patch.
includes/class-xcloner-remote-storage.php 1 patch
Braces   +37 added lines, -25 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@  discard block
 block discarded – undo
97 97
 		foreach($this->storage_fields as $storage=>$data)
98 98
 		{
99 99
 			$check_field = $this->storage_fields["option_prefix"].$storage."_enable";
100
-			if(get_option($check_field))
101
-				$return[$storage] = $data['text'];
100
+			if(get_option($check_field)) {
101
+							$return[$storage] = $data['text'];
102
+			}
102 103
 		}
103 104
 		
104 105
 		return $return;
@@ -116,11 +117,13 @@  discard block
 block discarded – undo
116 117
 				$check_field = $this->storage_fields["option_prefix"].$field;
117 118
 				$sanitize_method = "sanitize_input_as_".$validation;
118 119
 				
119
-				if(!isset($_POST[$check_field]))
120
-					$_POST[$check_field] = 0;
120
+				if(!isset($_POST[$check_field])) {
121
+									$_POST[$check_field] = 0;
122
+				}
121 123
 				
122
-				if(!method_exists($this->xcloner_sanitization, $sanitize_method))
123
-					$sanitize_method = "sanitize_input_as_string";
124
+				if(!method_exists($this->xcloner_sanitization, $sanitize_method)) {
125
+									$sanitize_method = "sanitize_input_as_string";
126
+				}
124 127
 					
125 128
 				$sanitized_value = $this->xcloner_sanitization->$sanitize_method($_POST[$check_field]);
126 129
 				update_option($check_field, $sanitized_value);
@@ -135,7 +138,7 @@  discard block
 block discarded – undo
135 138
 				$this->verify_filesystem($action);
136 139
 				$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action));
137 140
 				$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));	
138
-			}catch(Exception $e){
141
+			} catch(Exception $e){
139 142
 				$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action));
140 143
 			}
141 144
 		}
@@ -148,38 +151,44 @@  discard block
 block discarded – undo
148 151
 		
149 152
 		$this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type)));	
150 153
 		
151
-		if(!method_exists($this, $method))
152
-			return false;
154
+		if(!method_exists($this, $method)) {
155
+					return false;
156
+		}
153 157
 		
154 158
 		list($adapter, $filesystem) = $this->$method();
155 159
 		
156 160
 		$test_file = substr(".xcloner_".md5(time()), 0, 15);
157 161
 			
158 162
 		//testing write access
159
-		if(!$filesystem->write($test_file, "data"))
160
-			throw new Exception(__("Could not write data",'xcloner-backup-and-restore'));
163
+		if(!$filesystem->write($test_file, "data")) {
164
+					throw new Exception(__("Could not write data",'xcloner-backup-and-restore'));
165
+		}
161 166
 		$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));	
162 167
 		
163 168
 		//testing read access
164
-		if(!$filesystem->read($test_file))
165
-			throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
169
+		if(!$filesystem->read($test_file)) {
170
+					throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
171
+		}
166 172
 		$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));		
167 173
 		
168 174
 		//delete test file
169
-		if(!$filesystem->delete($test_file))
170
-			throw new Exception(__("Could not delete data",'xcloner-backup-and-restore'));
175
+		if(!$filesystem->delete($test_file)) {
176
+					throw new Exception(__("Could not delete data",'xcloner-backup-and-restore'));
177
+		}
171 178
 		$this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type)));		
172 179
 	}
173 180
 	
174 181
 	public function upload_backup_to_storage($file, $storage)
175 182
 	{
176
-		if(!$this->xcloner_file_system->get_storage_filesystem()->has($file))
177
-			return false;
183
+		if(!$this->xcloner_file_system->get_storage_filesystem()->has($file)) {
184
+					return false;
185
+		}
178 186
 			
179 187
 		$method = "get_".$storage."_filesystem";	
180 188
 		
181
-		if(!method_exists($this, $method))
182
-			return false;
189
+		if(!method_exists($this, $method)) {
190
+					return false;
191
+		}
183 192
 			
184 193
 		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
185 194
 		
@@ -205,14 +214,16 @@  discard block
 block discarded – undo
205 214
 		if($this->xcloner_file_system->is_multipart($file))
206 215
 		{
207 216
 			$parts = $this->xcloner_file_system->get_multipart_files($file);
208
-			if(is_array($parts))
209
-				foreach($parts as $part_file)
217
+			if(is_array($parts)) {
218
+							foreach($parts as $part_file)
210 219
 				{
211 220
 					$this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array(""));
221
+			}
212 222
 					
213 223
 					$backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file);
214
-					if(!$remote_storage_filesystem->updateStream($part_file, $backup_file_stream))
215
-						return false;
224
+					if(!$remote_storage_filesystem->updateStream($part_file, $backup_file_stream)) {
225
+											return false;
226
+					}
216 227
 				}
217 228
 		}
218 229
 		
@@ -234,10 +245,11 @@  discard block
 block discarded – undo
234 245
 			
235 246
 			$current_timestamp = strtotime("-".$expire_days." days");
236 247
 			
237
-			if(is_array($files))
238
-			foreach($files as $file)
248
+			if(is_array($files)) {
249
+						foreach($files as $file)
239 250
 			{
240 251
 				$file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']);
252
+			}
241 253
 				
242 254
 				if($current_timestamp >= $file['timestamp'])
243 255
 				{
Please login to merge, or discard this patch.
xcloner.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 //i will not load the plugin outside admin or cron
34
-if(!is_admin() and !defined('DOING_CRON'))
34
+if(!is_admin() and !defined('DOING_CRON')) {
35 35
 	return;
36
+}
36 37
 
37 38
 define("DS", DIRECTORY_SEPARATOR);
38 39
 
@@ -135,7 +136,7 @@  discard block
 block discarded – undo
135 136
 
136 137
 try{
137 138
 	run_xcloner();
138
-}catch(Exception $e)
139
+} catch(Exception $e)
139 140
 {
140 141
 	echo $e->getMessage();
141 142
 }
Please login to merge, or discard this patch.
admin/partials/xcloner_console_page.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,10 @@
 block discarded – undo
33 33
 			<li class="active">
34 34
 				<div class="collapsible-header active"><i class="material-icons">bug_report</i>XCloner Debugger</div>
35 35
 				<div class="collapsible-body">
36
-					<div class="console" id="xcloner-console"><?php if(isset($logger_content)) echo implode("<br />\n", $logger_content); ?></div>
36
+					<div class="console" id="xcloner-console"><?php if(isset($logger_content)) {
37
+	echo implode("<br />\n", $logger_content);
38
+}
39
+?></div>
37 40
 				</div>
38 41
 			</li>
39 42
 		</ul>
Please login to merge, or discard this patch.