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 ( e65d67...dc9fa8 )
by Liuta
03:08
created
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-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.
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.
admin/class-xcloner-admin.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function enqueue_styles($hook) {
63 63
 		
64
-		if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner"))
65
-			return;
64
+		if(!stristr($hook, "page_".$this->plugin_name) || (isset($_GET['option']) and $_GET['option']=="com_cloner")) {
65
+					return;
66
+		}
66 67
 
67 68
 		/**
68 69
 		 * This function is provided for demonstration purposes only.
@@ -93,8 +94,9 @@  discard block
 block discarded – undo
93 94
 	 */
94 95
 	public function enqueue_scripts($hook) {
95 96
 
96
-		if(!stristr($hook, "page_".$this->plugin_name))
97
-			return;
97
+		if(!stristr($hook, "page_".$this->plugin_name)) {
98
+					return;
99
+		}
98 100
 			
99 101
 		/**
100 102
 		 * This function is provided for demonstration purposes only.
@@ -234,15 +236,15 @@  discard block
 block discarded – undo
234 236
 					settings_fields('xcloner_general_settings_group');
235 237
 					do_settings_sections('xcloner_settings_page');
236 238
 					
237
-				}elseif( $active_tab == 'mysql_options' ) {
239
+				} elseif( $active_tab == 'mysql_options' ) {
238 240
 					
239 241
 					settings_fields('xcloner_mysql_settings_group');
240 242
 					do_settings_sections('xcloner_mysql_settings_page');
241
-				}elseif( $active_tab == 'system_options' ) {
243
+				} elseif( $active_tab == 'system_options' ) {
242 244
 					
243 245
 					settings_fields('xcloner_system_settings_group');
244 246
 					do_settings_sections('xcloner_system_settings_page');
245
-				}elseif( $active_tab == 'cleanup_options' ) {
247
+				} elseif( $active_tab == 'cleanup_options' ) {
246 248
 					
247 249
 					settings_fields('xcloner_cleanup_settings_group');
248 250
 					do_settings_sections('xcloner_cleanup_settings_page');
Please login to merge, or discard this patch.
admin/partials/xcloner_remote_storage_page.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,9 @@  discard block
 block discarded – undo
3 3
 
4 4
 $gdrive_auth_url = "";
5 5
 
6
-if(method_exists($remote_storage, "get_gdrive_auth_url"))
6
+if(method_exists($remote_storage, "get_gdrive_auth_url")) {
7 7
 	$gdrive_auth_url = $remote_storage->get_gdrive_auth_url();
8
+}
8 9
 
9 10
 $gdrive_construct = $remote_storage->gdrive_construct();
10 11
 ?>
@@ -25,7 +26,8 @@  discard block
 block discarded – undo
25 26
 						<div class="switch">
26 27
 							<label>
27 28
 							Off
28
-							<input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) echo "checked"?> \>
29
+							<input type="checkbox" name="xcloner_ftp_enable" class="status" value="1" <?php if(get_option("xcloner_ftp_enable")) {
30
+	echo "checked"?> \>
29 31
 							<span class="lever"></span>
30 32
 							On
31 33
 							</label>
@@ -286,6 +288,7 @@  discard block
 block discarded – undo
286 288
 							<option readonly value=""><?php echo __("Please Select AWS Region")?></option>
287 289
 							<?php 							
288 290
 							$aws_regions = $remote_storage->get_aws_regions();
291
+}
289 292
 							
290 293
 							foreach($aws_regions as $key=>$region){
291 294
 								?>
@@ -339,7 +342,8 @@  discard block
 block discarded – undo
339 342
 						<div class="switch">
340 343
 							<label>
341 344
 							Off
342
-							<input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) echo "checked"?> \>
345
+							<input type="checkbox" name="xcloner_dropbox_enable" class="status" value="1" <?php if(get_option("xcloner_dropbox_enable")) {
346
+	echo "checked"?> \>
343 347
 							<span class="lever"></span>
344 348
 							On
345 349
 							</label>
@@ -767,6 +771,7 @@  discard block
 block discarded – undo
767 771
 								<div class="center">
768 772
 									<?php 
769 773
 										$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=xcloner-google-drive'), 'install-plugin_xcloner-google-drive');
774
+}
770 775
 									?>
771 776
 									<h6><?php echo __("This storage option requires the XCloner-Google-Drive Wordpress Plugin to be installed and activated.")?></h6>
772 777
 									<h6><?php echo __("PHP 5.5 minimum version is required.")?></h6>
Please login to merge, or discard this patch.
includes/class-xcloner-remote-storage.php 1 patch
Braces   +50 added lines, -34 removed lines patch added patch discarded remove patch
@@ -148,8 +148,9 @@  discard block
 block discarded – undo
148 148
 		foreach($this->storage_fields as $storage=>$data)
149 149
 		{
150 150
 			$check_field = $this->storage_fields["option_prefix"].$storage."_enable";
151
-			if(get_option($check_field))
152
-				$return[$storage] = $data['text'];
151
+			if(get_option($check_field)) {
152
+							$return[$storage] = $data['text'];
153
+			}
153 154
 		}
154 155
 		
155 156
 		return $return;
@@ -172,11 +173,13 @@  discard block
 block discarded – undo
172 173
 				$check_field = $this->storage_fields["option_prefix"].$field;
173 174
 				$sanitize_method = "sanitize_input_as_".$validation;
174 175
 				
175
-				if(!isset($_POST[$check_field]))
176
-					$_POST[$check_field] = 0;
176
+				if(!isset($_POST[$check_field])) {
177
+									$_POST[$check_field] = 0;
178
+				}
177 179
 				
178
-				if(!method_exists($this->xcloner_sanitization, $sanitize_method))
179
-					$sanitize_method = "sanitize_input_as_string";
180
+				if(!method_exists($this->xcloner_sanitization, $sanitize_method)) {
181
+									$sanitize_method = "sanitize_input_as_string";
182
+				}
180 183
 					
181 184
 				$sanitized_value = $this->xcloner_sanitization->$sanitize_method($_POST[$check_field]);
182 185
 				update_option($check_field, $sanitized_value);
@@ -193,7 +196,7 @@  discard block
 block discarded – undo
193 196
 			$this->verify_filesystem($action);
194 197
 			$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", ucfirst($action));
195 198
 			$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));	
196
-		}catch(Exception $e){
199
+		} catch(Exception $e){
197 200
 			$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", ucfirst($action));
198 201
 		}
199 202
 	}
@@ -204,8 +207,9 @@  discard block
 block discarded – undo
204 207
 		
205 208
 		$this->logger->info(sprintf("Checking validity of the remote storage %s filesystem", strtoupper($storage_type)));	
206 209
 		
207
-		if(!method_exists($this, $method))
208
-			return false;
210
+		if(!method_exists($this, $method)) {
211
+					return false;
212
+		}
209 213
 		
210 214
 		list($adapter, $filesystem) = $this->$method();
211 215
 		
@@ -213,26 +217,30 @@  discard block
 block discarded – undo
213 217
 		
214 218
 		if($storage_type == "gdrive")
215 219
 		{
216
-			if(!is_array($filesystem->listContents()))
217
-				throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
220
+			if(!is_array($filesystem->listContents())) {
221
+							throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
222
+			}
218 223
 			$this->logger->debug(sprintf("I can list data from remote storage %s", strtoupper($storage_type)));	
219 224
 			
220 225
 			return true;
221 226
 		}
222 227
 			
223 228
 		//testing write access
224
-		if(!$filesystem->write($test_file, "data"))
225
-			throw new Exception(__("Could not write data",'xcloner-backup-and-restore'));
229
+		if(!$filesystem->write($test_file, "data")) {
230
+					throw new Exception(__("Could not write data",'xcloner-backup-and-restore'));
231
+		}
226 232
 		$this->logger->debug(sprintf("I can write data to remote storage %s", strtoupper($storage_type)));	
227 233
 		
228 234
 		//testing read access
229
-		if(!$filesystem->read($test_file))
230
-			throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
235
+		if(!$filesystem->read($test_file)) {
236
+					throw new Exception(__("Could not read data",'xcloner-backup-and-restore'));
237
+		}
231 238
 		$this->logger->debug(sprintf("I can read data to remote storage %s", strtoupper($storage_type)));		
232 239
 		
233 240
 		//delete test file
234
-		if(!$filesystem->delete($test_file))
235
-			throw new Exception(__("Could not delete data",'xcloner-backup-and-restore'));
241
+		if(!$filesystem->delete($test_file)) {
242
+					throw new Exception(__("Could not delete data",'xcloner-backup-and-restore'));
243
+		}
236 244
 		$this->logger->debug(sprintf("I can delete data to remote storage %s", strtoupper($storage_type)));		
237 245
 		
238 246
 		return true;
@@ -248,8 +256,9 @@  discard block
 block discarded – undo
248 256
 			
249 257
 		$method = "get_".$storage."_filesystem";	
250 258
 		
251
-		if(!method_exists($this, $method))
252
-			return false;
259
+		if(!method_exists($this, $method)) {
260
+					return false;
261
+		}
253 262
 			
254 263
 		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
255 264
 		
@@ -275,14 +284,16 @@  discard block
 block discarded – undo
275 284
 		if($this->xcloner_file_system->is_multipart($file))
276 285
 		{
277 286
 			$parts = $this->xcloner_file_system->get_multipart_files($file);
278
-			if(is_array($parts))
279
-				foreach($parts as $part_file)
287
+			if(is_array($parts)) {
288
+							foreach($parts as $part_file)
280 289
 				{
281 290
 					$this->logger->info(sprintf("Transferring backup %s to remote storage %s", $part_file, strtoupper($storage)), array(""));
291
+			}
282 292
 					
283 293
 					$backup_file_stream = $this->xcloner_file_system->get_storage_filesystem()->readStream($part_file);
284
-					if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream))
285
-						return false;
294
+					if(!$remote_storage_filesystem->writeStream($part_file, $backup_file_stream)) {
295
+											return false;
296
+					}
286 297
 				}
287 298
 		}
288 299
 		
@@ -298,8 +309,9 @@  discard block
 block discarded – undo
298 309
 		
299 310
 		$target_filename = $file;
300 311
 		
301
-		if(!method_exists($this, $method))
302
-			return false;
312
+		if(!method_exists($this, $method)) {
313
+					return false;
314
+		}
303 315
 			
304 316
 		list($remote_storage_adapter, $remote_storage_filesystem) = $this->$method();
305 317
 		
@@ -328,14 +340,16 @@  discard block
 block discarded – undo
328 340
 		if($this->xcloner_file_system->is_multipart($target_filename))
329 341
 		{
330 342
 			$parts = $this->xcloner_file_system->get_multipart_files($file, $storage);
331
-			if(is_array($parts))
332
-				foreach($parts as $part_file)
343
+			if(is_array($parts)) {
344
+							foreach($parts as $part_file)
333 345
 				{
334 346
 					$this->logger->info(sprintf("Transferring backup %s to local storage from %s storage", $part_file, strtoupper($storage)), array(""));
347
+			}
335 348
 					
336 349
 					$backup_file_stream = $remote_storage_filesystem->readStream($part_file);
337
-					if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream))
338
-						return false;
350
+					if(!$this->xcloner_file_system->get_storage_filesystem()->writeStream($part_file, $backup_file_stream)) {
351
+											return false;
352
+					}
339 353
 				}
340 354
 		}
341 355
 		
@@ -355,10 +369,11 @@  discard block
 block discarded – undo
355 369
 			
356 370
 			$current_timestamp = strtotime("-".$expire_days." days");
357 371
 			
358
-			if(is_array($files))
359
-			foreach($files as $file)
372
+			if(is_array($files)) {
373
+						foreach($files as $file)
360 374
 			{
361 375
 				$file['timestamp'] = $remote_storage_filesystem->getTimestamp($file['path']);
376
+			}
362 377
 				
363 378
 				if($current_timestamp >= $file['timestamp'])
364 379
 				{
@@ -524,8 +539,9 @@  discard block
 block discarded – undo
524 539
 	{
525 540
 		$client = $this->gdrive_construct();
526 541
 		
527
-		if(!$client)
528
-			return false;
542
+		if(!$client) {
543
+					return false;
544
+		}
529 545
 			
530 546
 		return $authUrl = $client->createAuthUrl();
531 547
 	}
@@ -608,7 +624,7 @@  discard block
 block discarded – undo
608 624
 				foreach ($response as $obj) {
609 625
 					$folderID =  $obj->getId();
610 626
 				}
611
-			}else{
627
+			} else{
612 628
 				$this->xcloner->trigger_message(sprintf(__("Could not find folder ID by name %s", 'xcloner-backup-and-restore'), $folderID), "error");
613 629
 			}
614 630
 		}
Please login to merge, or discard this patch.
includes/class-xcloner.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@
 block discarded – undo
350 350
 			
351 351
 			if(defined('DOING_CRON') || $_POST['hash'] == "generate_hash"){
352 352
 				$this->xcloner_settings->generate_new_hash();
353
-			}else{
353
+			} else{
354 354
 				$this->xcloner_settings->set_hash($_POST['hash']);
355 355
 			}
356 356
 		}
Please login to merge, or discard this patch.
includes/class-xcloner-loader.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@
 block discarded – undo
58 58
 	
59 59
 	public function xcloner_backup_add_admin_menu()
60 60
 	{
61
-		if ( function_exists('add_menu_page') )
62
-			add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
61
+		if ( function_exists('add_menu_page') ) {
62
+					add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', array($this->xcloner_container, 'xcloner_display'), 'dashicons-backup');
63
+		}
63 64
 
64 65
 		if ( function_exists('add_submenu_page') )
65 66
 		{
Please login to merge, or discard this patch.