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.
Passed
Branch dev (d55b36)
by Liuta
03:22
created
restore/xcloner_restore.php 1 patch
Braces   +109 added lines, -85 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
 {
46 46
 	
47 47
 	require_once($file);
48
-}
49
-elseif (file_exists("vendor.phar") and extension_loaded('phar'))
48
+} elseif (file_exists("vendor.phar") and extension_loaded('phar'))
50 49
 {
51 50
 	require_once(__DIR__.DS."vendor.phar");
52 51
 } else {	
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
 try {
88 87
 	$return = $xcloner_restore->init();
89 88
 	$xcloner_restore->send_response(200, $return);
90
-}catch (Exception $e) {
89
+} catch (Exception $e) {
91 90
 	$xcloner_restore->send_response(417, $e->getMessage());
92 91
 }
93 92
 
@@ -231,13 +230,15 @@  discard block
 block discarded – undo
231 230
 		{
232 231
 			$target_file = filter_input(INPUT_POST, 'file', FILTER_SANITIZE_STRING);
233 232
 			
234
-			if (!$_POST['start'])
235
-				$fp = fopen($target_file, "wb+");
236
-			else
237
-				$fp = fopen($target_file, "ab+");	
233
+			if (!$_POST['start']) {
234
+							$fp = fopen($target_file, "wb+");
235
+			} else {
236
+							$fp = fopen($target_file, "ab+");
237
+			}
238 238
 			
239
-			if (!$fp)
240
-				throw new Exception("Unable to open $target_file file for writing");
239
+			if (!$fp) {
240
+							throw new Exception("Unable to open $target_file file for writing");
241
+			}
241 242
 			
242 243
 			fseek($fp, $_POST['start']);
243 244
 			
@@ -247,22 +248,24 @@  discard block
 block discarded – undo
247 248
 				
248 249
 				$blob = file_get_contents($_FILES['blob']['tmp_name']);
249 250
 				
250
-				if (!$bytes_written = fwrite($fp, $blob))
251
-					throw new Exception("Unable to write data to file $target_file");
251
+				if (!$bytes_written = fwrite($fp, $blob)) {
252
+									throw new Exception("Unable to write data to file $target_file");
253
+				}
252 254
 
253 255
 				try {
254 256
 					unlink($_FILES['blob']['tmp_name']);
255
-				}catch (Exception $e) {
257
+				} catch (Exception $e) {
256 258
 					//silent message
257 259
 				}
258 260
 
259
-			}elseif (isset($_POST['blob'])) {
261
+			} elseif (isset($_POST['blob'])) {
260 262
 				$this->logger->debug(sprintf('Writing %s bytes to file %s starting position %s using POST blob', strlen($_POST['blob']), $target_file, $_POST['start']));
261 263
 				
262 264
 				$blob = $_POST['blob'];
263 265
 
264
-				if (!$bytes_written = fwrite($fp, $blob))
265
-					throw new Exception("Unable to write data to file $target_file");
266
+				if (!$bytes_written = fwrite($fp, $blob)) {
267
+									throw new Exception("Unable to write data to file $target_file");
268
+				}
266 269
 			} else {
267 270
 				throw new Exception("Upload failed, did not receive any binary data");
268 271
 			}
@@ -297,10 +300,11 @@  discard block
 block discarded – undo
297 300
 		
298 301
 		$mysqli->query("SET sql_mode='';");
299 302
 		$mysqli->query("SET foreign_key_checks = 0;");
300
-		if (isset($_REQUEST['charset_of_file']) and $_REQUEST['charset_of_file'])
301
-			$mysqli->query("SET NAMES ".$_REQUEST['charset_of_file']."");
302
-		else
303
-			$mysqli->query("SET NAMES utf8;");
303
+		if (isset($_REQUEST['charset_of_file']) and $_REQUEST['charset_of_file']) {
304
+					$mysqli->query("SET NAMES ".$_REQUEST['charset_of_file']."");
305
+		} else {
306
+					$mysqli->query("SET NAMES utf8;");
307
+		}
304 308
 			
305 309
 		return $mysqli;	
306 310
 	}
@@ -330,8 +334,9 @@  discard block
 block discarded – undo
330 334
 		
331 335
 		$mysql_backup_file = $remote_path.DS.$mysqldump_file;
332 336
 		
333
-		if (!file_exists($mysql_backup_file))
334
-			throw new Exception(sprintf("Mysql backup file %s does not exists", $mysql_backup_file));
337
+		if (!file_exists($mysql_backup_file)) {
338
+					throw new Exception(sprintf("Mysql backup file %s does not exists", $mysql_backup_file));
339
+		}
335 340
 		
336 341
 		
337 342
 		/*if(defined('XCLONER_PLUGIN_ACCESS') && XCLONER_PLUGIN_ACCESS)
@@ -364,16 +369,18 @@  discard block
 block discarded – undo
364 369
 			// process the line read.
365 370
 									
366 371
 				//check if line is comment
367
-				if (substr($line, 0, 1) == "#")
368
-					continue;
372
+				if (substr($line, 0, 1) == "#") {
373
+									continue;
374
+				}
369 375
 				
370 376
 				//check if line is empty	
371
-				if ($line == "\n" or trim($line) == "")
372
-					continue;
377
+				if ($line == "\n" or trim($line) == "") {
378
+									continue;
379
+				}
373 380
 					
374
-				if (substr($line, strlen($line) - 2, strlen($line)) == ";\n")
375
-					$query .= $line;
376
-				else {
381
+				if (substr($line, strlen($line) - 2, strlen($line)) == ";\n") {
382
+									$query .= $line;
383
+				} else {
377 384
 					$query .= $line;
378 385
 					continue;
379 386
 				}
@@ -497,7 +504,7 @@  discard block
 block discarded – undo
497 504
 			$tar->open($this->backup_storage_dir.DS.$backup_file, $start);
498 505
 		
499 506
 			$data = $tar->contents($this->process_files_limit_list);
500
-		}catch (Exception $e)
507
+		} catch (Exception $e)
501 508
 		{
502 509
 			$return['error'] = true;
503 510
 			$return['message'] = $e->getMessage();
@@ -532,8 +539,9 @@  discard block
 block discarded – undo
532 539
 				
533 540
 				++$return['part'];
534 541
 			
535
-				if ($return['part'] < sizeof($backup_parts))	
536
-					$return['finished'] = 0;
542
+				if ($return['part'] < sizeof($backup_parts)) {
543
+									$return['finished'] = 0;
544
+				}
537 545
 				
538 546
 			}
539 547
 		}	
@@ -674,19 +682,22 @@  discard block
 block discarded – undo
674 682
 		{
675 683
 			$config = file_get_contents($wp_config);
676 684
 			preg_match("/.*table_prefix.*=.*'(.*)'/i", $config, $matches);
677
-			if (isset($matches[1]))
678
-				$table_prefix = $matches[1];
679
-			else
680
-				throw new Exception("Could not load wordpress table prefix from wp-config.php file.");
685
+			if (isset($matches[1])) {
686
+							$table_prefix = $matches[1];
687
+			} else {
688
+							throw new Exception("Could not load wordpress table prefix from wp-config.php file.");
689
+			}
690
+		} else {
691
+					throw new Exception("Could not update the SITEURL and HOME, wp-config.php file not found");
681 692
 		}
682
-		else
683
-			throw new Exception("Could not update the SITEURL and HOME, wp-config.php file not found");
684 693
 			
685
-		if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='home'"))
686
-			throw new Exception(sprintf("Could not update the HOME option, error: %s\n", $mysqli->error));
694
+		if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='home'")) {
695
+					throw new Exception(sprintf("Could not update the HOME option, error: %s\n", $mysqli->error));
696
+		}
687 697
 		
688
-		if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='siteurl'"))
689
-			throw new Exception(sprintf("Could not update the SITEURL option, error: %s\n", $mysqli->error));
698
+		if (!$mysqli->query("update ".$table_prefix."options set option_value='".($url)."' where option_name='siteurl'")) {
699
+					throw new Exception(sprintf("Could not update the SITEURL option, error: %s\n", $mysqli->error));
700
+		}
690 701
 		
691 702
 		return true;
692 703
 	}
@@ -724,8 +735,9 @@  discard block
 block discarded – undo
724 735
 		
725 736
 		$this->logger->info(sprintf('Updating wp-config.php file with the new mysql details'));
726 737
 		
727
-		if (!file_put_contents($wp_config, $content))
728
-			throw new Exception("Could not write updated config data to ".$wp_config);
738
+		if (!file_put_contents($wp_config, $content)) {
739
+					throw new Exception("Could not write updated config data to ".$wp_config);
740
+		}
729 741
 		
730 742
 		chmod($wp_config, $file_perms);
731 743
 		
@@ -770,10 +782,11 @@  discard block
 block discarded – undo
770 782
 							$mysqldump_list[$file['path']]['size'] = $file['size'];
771 783
 							$mysqldump_list[$file['path']]['timestamp'] = date("d M,Y H:i", $file['timestamp']);
772 784
 							
773
-							if ($hash and $hash == $matches[1])
774
-								$mysqldump_list[$file['path']]['selected'] = "selected";
775
-							else
776
-								$mysqldump_list[$file['path']]['selected'] = "";	
785
+							if ($hash and $hash == $matches[1]) {
786
+															$mysqldump_list[$file['path']]['selected'] = "selected";
787
+							} else {
788
+															$mysqldump_list[$file['path']]['selected'] = "";
789
+							}
777 790
 						}
778 791
 					}
779 792
 				}
@@ -794,13 +807,15 @@  discard block
 block discarded – undo
794 807
 	 */
795 808
 	private function get_hash_from_backup($backup_file)
796 809
 	{
797
-		if (!$backup_file)
798
-			return false;
810
+		if (!$backup_file) {
811
+					return false;
812
+		}
799 813
 			
800 814
 		$result = preg_match("/-(\w*)./", substr($backup_file, strlen($backup_file) - 10, strlen($backup_file)), $matches);
801 815
 		
802
-		if ($result and isset($matches[1]))
803
-			return ($matches[1]);
816
+		if ($result and isset($matches[1])) {
817
+					return ($matches[1]);
818
+		}
804 819
 		
805 820
 		return false;
806 821
 	}
@@ -825,10 +840,11 @@  discard block
 block discarded – undo
825 840
 			if (isset($file_info['extension']) and $file_info['extension'] == "csv")
826 841
 			{
827 842
 				$lines = explode(PHP_EOL, $this->filesystem->read($file_info['path']));
828
-				foreach ($lines as $line)
829
-					if ($line)
843
+				foreach ($lines as $line) {
844
+									if ($line)
830 845
 					{
831 846
 						$data = str_getcsv($line);
847
+				}
832 848
 						if (is_array($data)) {
833 849
 							$parents[$data[0]] = $file_info['path'];
834 850
 							$file_info['childs'][] = $data;
@@ -838,20 +854,22 @@  discard block
 block discarded – undo
838 854
 						
839 855
 			}
840 856
 			
841
-			if ($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions))
842
-				$backup_files[$file_info['path']] = $file_info;
857
+			if ($file_info['type'] == 'file' and isset($file_info['extension']) and in_array($file_info['extension'], $this->backup_archive_extensions)) {
858
+							$backup_files[$file_info['path']] = $file_info;
859
+			}
843 860
 		}
844 861
 		
845 862
 		$new_list = array();
846 863
 		
847 864
 		foreach ($backup_files as $key=>$file_info)
848 865
 		{
849
-			if (isset($parents[$file_info['path']]))
850
-				$backup_files[$key]['parent'] = $parents[$file_info['path']];
851
-			else {
866
+			if (isset($parents[$file_info['path']])) {
867
+							$backup_files[$key]['parent'] = $parents[$file_info['path']];
868
+			} else {
852 869
 				
853
-				if ($local_backup_file and ($file_info['basename'] == $local_backup_file))
854
-					$file_info['selected'] = 'selected';
870
+				if ($local_backup_file and ($file_info['basename'] == $local_backup_file)) {
871
+									$file_info['selected'] = 'selected';
872
+				}
855 873
 				
856 874
 				$this->logger->info(sprintf('Found %s backup file', $file_info['path']));
857 875
 					
@@ -898,8 +916,9 @@  discard block
 block discarded – undo
898 916
 		$backup_archive = new Tar();
899 917
 		if ($this->is_multipart($backup_file))
900 918
 		{
901
-			if (!$return['part'])
902
-				$return['processed'] += $this->filesystem->getSize($backup_file);
919
+			if (!$return['part']) {
920
+							$return['processed'] += $this->filesystem->getSize($backup_file);
921
+			}
903 922
 				
904 923
 			$backup_parts = $this->get_multipart_files($backup_file);
905 924
 			$backup_file = $backup_parts[$return['part']];	
@@ -919,10 +938,11 @@  discard block
 block discarded – undo
919 938
 			}
920 939
 		}
921 940
 		
922
-		if (isset($data['start']))
923
-		//if(isset($data['start']) and $data['start'] <= $this->filesystem->getSize($backup_file))
941
+		if (isset($data['start'])) {
942
+				//if(isset($data['start']) and $data['start'] <= $this->filesystem->getSize($backup_file))
924 943
 		{
925 944
 			$return['finished'] = 0;
945
+		}
926 946
 			$return['start'] = $data['start'];
927 947
 		} else {
928 948
 			
@@ -934,14 +954,16 @@  discard block
 block discarded – undo
934 954
 				
935 955
 				++$return['part'];
936 956
 			
937
-				if ($return['part'] < sizeof($backup_parts))	
938
-					$return['finished'] = 0;
957
+				if ($return['part'] < sizeof($backup_parts)) {
958
+									$return['finished'] = 0;
959
+				}
939 960
 				
940 961
 			}
941 962
 		}
942 963
 		
943
-		if ($return['finished'])
944
-			$this->logger->info(sprintf('Done extracting %s', $source_backup_file));
964
+		if ($return['finished']) {
965
+					$this->logger->info(sprintf('Done extracting %s', $source_backup_file));
966
+		}
945 967
 		
946 968
 		$return['backup_file'] = $backup_file;
947 969
 		
@@ -973,8 +995,7 @@  discard block
 block discarded – undo
973 995
 			$return['remote_mysql_user'] 	= $wpdb->dbuser;
974 996
 			$return['remote_mysql_pass'] 	= $wpdb->dbpassword;
975 997
 			$return['remote_mysql_db'] = $wpdb->dbname;
976
-		}
977
-		else {
998
+		} else {
978 999
 			$return['dir'] = ($pathinfo['dirname']).DS.$suffix;
979 1000
 			$return['restore_script_url'] = str_replace($pathinfo['basename'], "", $restore_script_url).$suffix;
980 1001
 		}	
@@ -993,11 +1014,13 @@  discard block
 block discarded – undo
993 1014
 	{
994 1015
 		//check if i can write
995 1016
 		$tmp_file = md5(time());
996
-		if (!file_put_contents($tmp_file, "++"))
997
-			throw new Exception("Could not write to new host");
1017
+		if (!file_put_contents($tmp_file, "++")) {
1018
+					throw new Exception("Could not write to new host");
1019
+		}
998 1020
 		
999
-		if (!unlink($tmp_file))
1000
-			throw new Exception("Could not delete temporary file from new host");
1021
+		if (!unlink($tmp_file)) {
1022
+					throw new Exception("Could not delete temporary file from new host");
1023
+		}
1001 1024
 		
1002 1025
 		$max_upload      = $this->return_bytes((ini_get('upload_max_filesize')));
1003 1026
 		$max_post        = $this->return_bytes((ini_get('post_max_size')));
@@ -1044,8 +1067,9 @@  discard block
 block discarded – undo
1044 1067
 	 */
1045 1068
 	public function is_multipart($backup_name)
1046 1069
 	{
1047
-		if (stristr($backup_name, "-multipart"))
1048
-			return true;
1070
+		if (stristr($backup_name, "-multipart")) {
1071
+					return true;
1072
+		}
1049 1073
 		
1050 1074
 		return false;	
1051 1075
 	}
@@ -1063,8 +1087,9 @@  discard block
 block discarded – undo
1063 1087
 		if ($this->is_multipart($backup_name))
1064 1088
 		{
1065 1089
 			$backup_parts = $this->get_multipart_files($backup_name);
1066
-			foreach ($backup_parts as $part_file)
1067
-				$backup_size += $this->filesystem->getSize($part_file);
1090
+			foreach ($backup_parts as $part_file) {
1091
+							$backup_size += $this->filesystem->getSize($part_file);
1092
+			}
1068 1093
 		}
1069 1094
 		
1070 1095
 		return $backup_size;
@@ -1126,15 +1151,13 @@  discard block
 block discarded – undo
1126 1151
 				if ($direction == 'desc') {
1127 1152
 					if ($a > $b) {
1128 1153
 						return -1;
1129
-					}
1130
-					else {
1154
+					} else {
1131 1155
 						return 1;
1132 1156
 					}
1133 1157
 				} else {
1134 1158
 					if ($a < $b) {
1135 1159
 						return -1;
1136
-					}
1137
-					else {
1160
+					} else {
1138 1161
 						return 1;
1139 1162
 					}
1140 1163
 				}
@@ -1164,7 +1187,7 @@  discard block
 block discarded – undo
1164 1187
 		{
1165 1188
 			$return['statusText'] = $response['message'];
1166 1189
 			$return['error'] = true;
1167
-		}elseif ($status != 200 and $status != 418)
1190
+		} elseif ($status != 200 and $status != 418)
1168 1191
 		{
1169 1192
 			$return['error'] = true;
1170 1193
 			$return['message'] = $response;
@@ -1188,8 +1211,9 @@  discard block
 block discarded – undo
1188 1211
 		return preg_replace_callback('!s:(\d+):([\\\\]?"[\\\\]?"|[\\\\]?"((.*?)[^\\\\])[\\\\]?");!', function($m) {
1189 1212
 				  $data = "";
1190 1213
 				  	
1191
-				  if (!isset($m[3]))
1192
-					$m[3] = "";
1214
+				  if (!isset($m[3])) {
1215
+				  					$m[3] = "";
1216
+				  }
1193 1217
 					
1194 1218
 					$data = 's:'.strlen(($m[3])).':\"'.($m[3]).'\";';
1195 1219
 				  //return $this->unescape_quotes($data);
Please login to merge, or discard this patch.
includes/class-xcloner-file-system.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             $this->storage_filesystem_append = new Filesystem($this->storage_adapter, new Config([
103 103
                 'disable_asserts' => true,
104 104
             ]));
105
-        }catch (Exception $e) {
105
+        } catch (Exception $e) {
106 106
             $this->logger->error("Filesystem Initialization Error: ".$e->getMessage());
107 107
         }
108 108
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
         try{
512 512
             rmdir($this->xcloner_settings->get_xcloner_tmp_path());
513
-        }catch(Exception $e){
513
+        } catch(Exception $e){
514 514
             //silent continue
515 515
         }
516 516
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                 }
650 650
             }
651 651
 
652
-        }catch (Exception $e) {
652
+        } catch (Exception $e) {
653 653
 
654 654
             $this->logger->error($e->getMessage());
655 655
 
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 
677 677
             $this->tmp_filesystem->delete($tmp_file);
678 678
 
679
-        }catch (Exception $e) {
679
+        } catch (Exception $e) {
680 680
 
681 681
             $this->logger->error($e->getMessage());
682 682
 
@@ -714,9 +714,11 @@  discard block
 block discarded – undo
714 714
         foreach ($_backup_files_list as $file) {
715 715
             //processing rule folder capacity
716 716
             if ($this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit') &&
717
-                $_storage_size >= ($set_storage_limit = 1024 * 1024 * $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit')))    //bytes
717
+                $_storage_size >= ($set_storage_limit = 1024 * 1024 * $this->xcloner_settings->get_xcloner_option('xcloner_cleanup_capacity_limit'))) {
718
+            	//bytes
718 719
             {
719 720
                 $this->storage_filesystem->delete($file['path']);
721
+            }
720 722
                 $_storage_size -= $file['size'];
721 723
                 $this->logger->info("Deleting backup ".$file['path']." matching rule", array(
722 724
                     "STORAGE SIZE LIMIT",
@@ -983,7 +985,7 @@  discard block
 block discarded – undo
983 985
 		if ($file['type'] == "dir") {
984 986
 			try {
985 987
 				$this->tmp_filesystem_append->write($this->get_temp_dir_handler(), $file['path']."\n");
986
-			}catch (Exception $e) {
988
+			} catch (Exception $e) {
987 989
 				$this->logger->error($e->getMessage());
988 990
 			}
989 991
 		}
@@ -1009,7 +1011,7 @@  discard block
 block discarded – undo
1009 1011
 
1010 1012
 			$this->tmp_filesystem_append->write($this->get_included_files_handler(), $line);
1011 1013
 
1012
-		}catch (Exception $e) {
1014
+		} catch (Exception $e) {
1013 1015
 
1014 1016
 			$this->logger->error($e->getMessage());
1015 1017
 		}
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
@@ -489,7 +489,7 @@
 block discarded – undo
489 489
 
490 490
 		try {
491 491
 			$this->xcloner_scheduler->xcloner_scheduler_callback(0, $schedule);
492
-		}catch (Exception $e) {
492
+		} catch (Exception $e) {
493 493
 			$this->get_xcloner_logger()->error($e->getMessage());
494 494
 		}
495 495
 
Please login to merge, or discard this patch.
includes/class-xcloner-api.php 1 patch
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		try {
138 138
 			$this->xcloner_database->init($data);
139 139
 
140
-		}catch (Exception $e) {
140
+		} catch (Exception $e) {
141 141
 
142 142
 			$this->send_response($e->getMessage());
143 143
 			$this->logger->error($e->getMessage());
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		try {
313 313
 			$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'],
314 314
 				$this->form_params['extra'], $init);
315
-		}catch (Exception $e) {
315
+		} catch (Exception $e) {
316 316
 			$return = array();
317 317
 			$return['error'] = true;
318 318
 			$return['status'] = 500;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 					$additional['lines_total'] = $return['extra']['lines_total'];
340 340
 					$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'],
341 341
 						$this->form_params, "", $additional);
342
-				}catch (Exception $e) {
342
+				} catch (Exception $e) {
343 343
 					$this->logger->error($e->getMessage());
344 344
 				}
345 345
 			}
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
 		try {
524 524
 			$files = $this->xcloner_file_system->list_directory($folder);
525
-		}catch (Exception $e) {
525
+		} catch (Exception $e) {
526 526
 
527 527
 			print $e->getMessage();
528 528
 			$this->logger->error($e->getMessage());
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		if ($database == "#") {
587 587
 			try {
588 588
 				$return = $this->xcloner_database->get_all_databases();
589
-			}catch (Exception $e) {
589
+			} catch (Exception $e) {
590 590
 				$this->logger->error($e->getMessage());
591 591
 			}
592 592
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 			try {
620 620
 				$return = $this->xcloner_database->list_tables($database, "", 1);
621
-			}catch (Exception $e) {
621
+			} catch (Exception $e) {
622 622
 				$this->logger->error($e->getMessage());
623 623
 			}
624 624
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			$this->logger->info($iv);
849 849
 			$return = array_merge($return,
850 850
 				$this->xcloner_encryption->encrypt_file($backup_file, "", "", $start, base64_decode($iv)));
851
-		}catch (\Exception $e) {
851
+		} catch (\Exception $e) {
852 852
 			$return['error'] = true;
853 853
 			$return['message'] = $e->getMessage();
854 854
 			$return['error_message'] = $e->getMessage();
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 		try {
906 906
 			$return = array_merge($return,
907 907
 				$this->xcloner_encryption->decrypt_file($backup_file, "", $decryption_key, $start, base64_decode($iv)));
908
-		}catch (\Exception $e) {
908
+		} catch (\Exception $e) {
909 909
 			$return['error'] = true;
910 910
 			$return['message'] = $e->getMessage();
911 911
 		}
@@ -1009,7 +1009,8 @@  discard block
 block discarded – undo
1009 1009
                                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1010 1010
                                                     <i class="material-icons">enhanced_encryption</i>
1011 1011
                                                 </a>
1012
-                                            <?php else: ?>
1012
+                                            <?php else {
1013
+	: ?>
1013 1014
                                                 <a href="#<?php echo $child[0] ?>" class="list-backup-content"
1014 1015
                                                    title="<?php echo __('List Backup Content',
1015 1016
 													   'xcloner-backup-and-restore') ?>"><i
@@ -1028,7 +1029,9 @@  discard block
 block discarded – undo
1028 1029
                                                         class="material-icons">file_upload</i></a>
1029 1030
                                         <?php endif ?>
1030 1031
                                     </li>
1031
-                                <?php endforeach; ?>
1032
+                                <?php endforeach;
1033
+}
1034
+?>
1032 1035
                             </ul>
1033 1036
                         <?php endif; ?>
1034 1037
                 <?php
@@ -1036,11 +1039,12 @@  discard block
 block discarded – undo
1036 1039
 				ob_end_clean();
1037 1040
 				?>
1038 1041
                     <?php ob_start(); ?>
1039
-                        <?php if (isset($file_info['timestamp']))
1042
+                        <?php if (isset($file_info['timestamp'])) {
1040 1043
 							echo date("Y-m-d H:i", $file_info['timestamp'])
1041 1044
 						?>
1042 1045
                     <?php
1043 1046
 						$return['data'][$i][] = ob_get_contents();
1047
+}
1044 1048
 						ob_end_clean();
1045 1049
 						?>
1046 1050
 
@@ -1065,15 +1069,17 @@  discard block
 block discarded – undo
1065 1069
                             <?php endif ?>
1066 1070
                             <?php
1067 1071
 							$basename = $file_info['basename'];
1068
-							if (isset($file_info['childs']) and sizeof($file_info['childs']))
1069
-								$basename = $file_info['childs'][0][0];
1072
+							if (isset($file_info['childs']) and sizeof($file_info['childs'])) {
1073
+															$basename = $file_info['childs'][0][0];
1074
+							}
1070 1075
 							?>
1071 1076
                             <?php if ($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1072 1077
                                 <a href="#<?php echo $file_info['basename'] ?>" class="backup-decryption"
1073 1078
                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1074 1079
                                     <i class="material-icons">enhanced_encryption</i>
1075 1080
                                 </a>
1076
-                            <?php else: ?>
1081
+                            <?php else {
1082
+	: ?>
1077 1083
                                 <a href="#<?php echo $file_info['basename'] ?>" class="list-backup-content"
1078 1084
                                     title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore') ?>"><i
1079 1085
                                     class="material-icons">folder_open</i></a>
@@ -1083,7 +1089,9 @@  discard block
 block discarded – undo
1083 1089
                                     <i class="material-icons">no_encryption</i>
1084 1090
                                 </a>
1085 1091
                             <?php endif?>
1086
-                        <?php endif; ?>
1092
+                        <?php endif;
1093
+}
1094
+?>
1087 1095
 
1088 1096
                         <a href="#<?php echo $file_info['basename'] ?>" class="delete"
1089 1097
                            title="<?php echo __('Delete Backup', 'xcloner-backup-and-restore') ?>">
@@ -1137,7 +1145,7 @@  discard block
 block discarded – undo
1137 1145
 			$tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start);
1138 1146
 
1139 1147
 			$data = $tar->contents(get_option('xcloner_files_to_process_per_request'));
1140
-		}catch (Exception $e) {
1148
+		} catch (Exception $e) {
1141 1149
 			$return['error'] = true;
1142 1150
 			$return['message'] = $e->getMessage();
1143 1151
 			$this->send_response($return, 0);
@@ -1200,7 +1208,7 @@  discard block
 block discarded – undo
1200 1208
 					"copy_backup_remote_to_local"
1201 1209
 				), array($backup_file, $storage_type));
1202 1210
 			}
1203
-		}catch (Exception $e) {
1211
+		} catch (Exception $e) {
1204 1212
 
1205 1213
 			$return['error'] = 1;
1206 1214
 			$return['message'] = $e->getMessage();
@@ -1239,7 +1247,7 @@  discard block
 block discarded – undo
1239 1247
 					"upload_backup_to_storage"
1240 1248
 				), array($backup_file, $storage_type));
1241 1249
 			}
1242
-		}catch (Exception $e) {
1250
+		} catch (Exception $e) {
1243 1251
 
1244 1252
 			$return['error'] = 1;
1245 1253
 			$return['message'] = $e->getMessage();
@@ -1335,7 +1343,7 @@  discard block
 block discarded – undo
1335 1343
 
1336 1344
 		try {
1337 1345
 			unlink($tmp_file);
1338
-		}catch(Exception $e) {
1346
+		} catch(Exception $e) {
1339 1347
 			//We are not interested in the error here
1340 1348
 		}
1341 1349
 
@@ -1430,7 +1438,7 @@  discard block
 block discarded – undo
1430 1438
 			$xcloner_file_transfer->set_target($target_url);
1431 1439
 			$return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash);
1432 1440
 
1433
-		}catch (Exception $e) {
1441
+		} catch (Exception $e) {
1434 1442
 
1435 1443
 			$return = array();
1436 1444
 			$return['error'] = true;
Please login to merge, or discard this patch.
includes/class-xcloner-scheduler.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
 				$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'], $schedule, "", $additional);
370 370
 
371
-			}catch (Exception $e) {
371
+			} catch (Exception $e) {
372 372
 				$this->logger->error($e->getMessage());
373 373
 			}
374 374
 		}
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			}
403 403
 			$this->_xcloner_scheduler_callback($id, $schedule);
404 404
 
405
-		}catch (Exception $e) {
405
+		} catch (Exception $e) {
406 406
 
407 407
 			//send email to site admin if email notification is not set in the scheduler
408 408
 			if (!isset($schedule['backup_params']->email_notification) || !$schedule['backup_params']->email_notification) {
Please login to merge, or discard this patch.
includes/class-xcloner-remote-storage.php 1 patch
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -217,8 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
 		if ($action == 'e' && function_exists('openssl_encrypt')) {
219 219
 			$output = base64_encode(openssl_encrypt($string, $encrypt_method, $key, 0, $iv));
220
-		}
221
-		else if ($action == 'd' && function_exists('openssl_decrypt') && base64_decode($string)) {
220
+		} else if ($action == 'd' && function_exists('openssl_decrypt') && base64_decode($string)) {
222 221
 			$decrypt = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
223 222
 			if ($decrypt) {
224 223
 				//we check if decrypt was succesful
@@ -280,7 +279,7 @@  discard block
 block discarded – undo
280 279
 			$this->verify_filesystem($action);
281 280
 			$this->xcloner->trigger_message(__("%s connection is valid.", 'xcloner-backup-and-restore'), "success", $this->storage_fields[$action]['text']);
282 281
 			$this->logger->debug(sprintf("Connection to remote storage %s is valid", strtoupper($action)));
283
-		}catch (Exception $e) {
282
+		} catch (Exception $e) {
284 283
 			$this->xcloner->trigger_message("%s connection error: ".$e->getMessage(), "error", $this->storage_fields[$action]['text']);
285 284
 		}
286 285
 	}
Please login to merge, or discard this patch.