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 ( 75d1fa...e41d1f )
by Liuta
03:16
created
includes/class-xcloner-database.php 1 patch
Braces   +75 added lines, -52 removed lines patch added patch discarded remove patch
@@ -44,11 +44,13 @@  discard block
 block discarded – undo
44 44
 		$this->xcloner_settings 		= new Xcloner_Settings($hash);
45 45
 		$this->fs 						= new Xcloner_File_System($hash);
46 46
 		
47
-		if($this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request'))
48
-			$this->recordsPerSession		= $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request');
47
+		if($this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request')) {
48
+					$this->recordsPerSession		= $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request');
49
+		}
49 50
 		
50
-		if(!$this->recordsPerSession)
51
-			$this->recordsPerSession = 100;
51
+		if(!$this->recordsPerSession) {
52
+					$this->recordsPerSession = 100;
53
+		}
52 54
 		
53 55
 		$wp_host 	= $this->xcloner_settings->get_db_hostname();
54 56
 		$wp_user 	= $this->xcloner_settings->get_db_username();
@@ -105,37 +107,43 @@  discard block
 block discarded – undo
105 107
 			{
106 108
 				foreach($params['#'] as $database)
107 109
 				{
108
-					if(!isset($params[$database]) or !is_array($params[$database]))
109
-						$params[$database] = array();
110
+					if(!isset($params[$database]) or !is_array($params[$database])) {
111
+											$params[$database] = array();
112
+					}
110 113
 				}
111 114
 				$db_count = -1;
112 115
 			}
113 116
 			
114
-			if(isset($params) and is_array($params))
115
-				foreach($params as $database=>$tables)
117
+			if(isset($params) and is_array($params)) {
118
+							foreach($params as $database=>$tables)
116 119
 				{	
117 120
 					if($database != "#")
118 121
 					{
119
-						$stats = $this->write_backup_process_list($database, $tables);	
122
+						$stats = $this->write_backup_process_list($database, $tables);
123
+			}
120 124
 						$return['stats']['tables_count'] 	+= $stats['tables_count'];
121 125
 						$return['stats']['total_records'] 	+= $stats['total_records'];
122 126
 					}
123 127
 				}
124 128
 
125
-			if(sizeof($params))
126
-				$return['stats']['database_count'] = sizeof($params)+$db_count;
127
-			else	
128
-				$return['stats']['database_count'] = 0;
129
+			if(sizeof($params)) {
130
+							$return['stats']['database_count'] = sizeof($params)+$db_count;
131
+			} else {
132
+							$return['stats']['database_count'] = 0;
133
+			}
129 134
 				
130 135
 			return $return;
131 136
 		}
132 137
 		
133
-		if(!isset($extra_params['startAtLine']))
134
-			$extra_params['startAtLine'] = 0;
135
-		if(!isset($extra_params['startAtRecord']))
136
-			$extra_params['startAtRecord'] = 0;
137
-		if(!isset($extra_params['dumpfile']))
138
-			$extra_params['dumpfile'] = "";
138
+		if(!isset($extra_params['startAtLine'])) {
139
+					$extra_params['startAtLine'] = 0;
140
+		}
141
+		if(!isset($extra_params['startAtRecord'])) {
142
+					$extra_params['startAtRecord'] = 0;
143
+		}
144
+		if(!isset($extra_params['dumpfile'])) {
145
+					$extra_params['dumpfile'] = "";
146
+		}
139 147
 		
140 148
 		$return = $this->process_incremental($extra_params['startAtLine'], $extra_params['startAtRecord'], $extra_params['dumpfile']);
141 149
 		
@@ -147,11 +155,13 @@  discard block
 block discarded – undo
147 155
 		
148 156
 		if($message){
149 157
 			$this->logger->info( $message, array(""));
150
-		}else{	
151
-			if($this->last_query)
152
-				$this->logger->debug( $this->last_query, array(""));
153
-			if($this->last_error)
154
-				$this->logger->error( $this->last_error, array(""));
158
+		} else{	
159
+			if($this->last_query) {
160
+							$this->logger->debug( $this->last_query, array(""));
161
+			}
162
+			if($this->last_error) {
163
+							$this->logger->error( $this->last_error, array(""));
164
+			}
155 165
 		}
156 166
 		
157 167
 		return;
@@ -222,11 +232,12 @@  discard block
 block discarded – undo
222 232
 		$databases_list[$i]['num_tables'] = $this->get_database_num_tables($this->dbname);
223 233
 		$i++;
224 234
 		
225
-		if(is_array($databases))
226
-		foreach( $databases as $db){
235
+		if(is_array($databases)) {
236
+				foreach( $databases as $db){
227 237
 			if($db->Database != $this->dbname)
228 238
 			{
229 239
 				$databases_list[$i]['name'] = $db->Database;
240
+		}
230 241
 				$databases_list[$i]['num_tables'] = $this->get_database_num_tables($db->Database);
231 242
 				$i++;
232 243
 			}
@@ -247,8 +258,9 @@  discard block
 block discarded – undo
247 258
 		$tablesList[0] = array( );
248 259
 		$inc = 0;
249 260
 
250
-		if(!$database)
251
-			$database = $this->dbname;
261
+		if(!$database) {
262
+					$database = $this->dbname;
263
+		}
252 264
 		
253 265
 		$this->logger->debug(sprintf(("Listing tables in %s database"), $database));
254 266
 		
@@ -272,10 +284,11 @@  discard block
 block discarded – undo
272 284
 			
273 285
 			$tablesList[$inc]['excluded'] = 0;
274 286
 						
275
-			if(sizeof($included) and is_array($included))
276
-				if(!in_array($table, $included) )
287
+			if(sizeof($included) and is_array($included)) {
288
+							if(!in_array($table, $included) )
277 289
 				{
278 290
 					$tablesList[$inc]['excluded'] = 1;
291
+			}
279 292
 					$this->log(sprintf(__("Excluding table %s.%s from backup"), $table, $database));
280 293
 				}
281 294
 			$inc++;
@@ -294,19 +307,21 @@  discard block
 block discarded – undo
294 307
 		
295 308
 		$tables = $this->list_tables($dbname, $incl_tables, 1);
296 309
 		
297
-		if($this->dbname != $dbname)
298
-			$dumpfile = $dbname."-backup.sql";
299
-		else
300
-			$dumpfile = $this->TEMP_DUMP_FILE;
310
+		if($this->dbname != $dbname) {
311
+					$dumpfile = $dbname."-backup.sql";
312
+		} else {
313
+					$dumpfile = $this->TEMP_DUMP_FILE;
314
+		}
301 315
 		
302 316
 		$line = sprintf("###newdump###\t%s\t%s\n", $dbname, $dumpfile);
303 317
 		$this->fs->get_tmp_filesystem_append()->write($this->TEMP_DBPROCESS_FILE, $line);
304 318
 			
305 319
 		// write this to the class and write to $TEMP_DBPROCESS_FILE file as database.table records
306
-		foreach($tables as $key=>$table) 
307
-		if($table!= "" and !$tables[$key]['excluded']){
320
+		foreach($tables as $key=>$table) {
321
+				if($table!= "" and !$tables[$key]['excluded']){
308 322
 
309 323
 			$line = sprintf("`%s`.`%s`\t%s\t%s\n", $dbname, $tables[$key]['name'], $tables[$key]['records'], $tables[$key]['excluded']);
324
+		}
310 325
 			$this->fs->get_tmp_filesystem_append()->write($this->TEMP_DBPROCESS_FILE, $line);
311 326
 			$return['tables_count']++;
312 327
 			$return['total_records'] += $tables[$key]['records'];
@@ -354,8 +369,9 @@  discard block
 block discarded – undo
354 369
 		$return['finished'] = 0;
355 370
 		$lines = array();
356 371
 		
357
-		if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE))
358
-			$lines = array_filter(explode("\n",$this->fs->get_tmp_filesystem()->read($this->TEMP_DBPROCESS_FILE)));
372
+		if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) {
373
+					$lines = array_filter(explode("\n",$this->fs->get_tmp_filesystem()->read($this->TEMP_DBPROCESS_FILE)));
374
+		}
359 375
 	
360 376
 		foreach ($lines as $buffer){
361 377
 			
@@ -380,14 +396,16 @@  discard block
 block discarded – undo
380 396
 						$startAtLine++;
381 397
 						$return['new_dump'] = 1;
382 398
 						//break;
383
-				}else{
399
+				} else{
384 400
 						//we export the table
385
-						if($tableInfo[0] == "###enddump###")
386
-							$return['endDump'] = 1;
401
+						if($tableInfo[0] == "###enddump###") {
402
+													$return['endDump'] = 1;
403
+						}
387 404
 	
388 405
 						//table is excluded
389
-						if($tableInfo[2])
390
-							continue;
406
+						if($tableInfo[2]) {
407
+													continue;
408
+						}
391 409
 							
392 410
 						$next = $startAtRecord + $this->recordsPerSession;
393 411
 						
@@ -403,16 +421,19 @@  discard block
 block discarded – undo
403 421
 
404 422
 						$processed_records = 0;
405 423
 						
406
-						if(trim($tableName) !=""  and !$tableInfo[2])
407
-							$processed_records = $this->export_table($databaseName, $tableName, $startAtRecord, $this->recordsPerSession, $dumpfile);
424
+						if(trim($tableName) !=""  and !$tableInfo[2]) {
425
+													$processed_records = $this->export_table($databaseName, $tableName, $startAtRecord, $this->recordsPerSession, $dumpfile);
426
+						}
408 427
 						
409 428
 						$return['processedRecords'] = $startAtRecord+$processed_records;
410 429
 						
411
-						if($next >= $tableInfo[1]) //we finished loading the records for next sessions, will go to the new record
430
+						if($next >= $tableInfo[1]) {
431
+							//we finished loading the records for next sessions, will go to the new record
412 432
 						{
413 433
 								$startAtLine ++;
434
+						}
414 435
 								$startAtRecord = 0;
415
-						}else{
436
+						} else{
416 437
 								$startAtRecord = $startAtRecord + $this->recordsPerSession;
417 438
 							}
418 439
 
@@ -445,8 +466,9 @@  discard block
 block discarded – undo
445 466
 		$return['finished'] = 1;
446 467
 		$return['startAtLine']	= $startAtLine;
447 468
 		
448
-		if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE))
449
-			$this->fs->get_tmp_filesystem()->delete($this->TEMP_DBPROCESS_FILE);
469
+		if($this->fs->get_tmp_filesystem()->has($this->TEMP_DBPROCESS_FILE)) {
470
+					$this->fs->get_tmp_filesystem()->delete($this->TEMP_DBPROCESS_FILE);
471
+		}
450 472
 		
451 473
 		$this->logger->debug(sprintf(("Database backup finished!")));
452 474
 		
@@ -474,8 +496,9 @@  discard block
 block discarded – undo
474 496
 		
475 497
 		$records = 0;
476 498
 		
477
-		if($start == 0)
478
-			$this->dump_structure($databaseName, $tableName, $dumpfile);
499
+		if($start == 0) {
500
+					$this->dump_structure($databaseName, $tableName, $dumpfile);
501
+		}
479 502
 
480 503
 		$start = intval($start);
481 504
 		$limit = intval($limit);
@@ -487,7 +510,7 @@  discard block
 block discarded – undo
487 510
 			$result = mysqli_query($this->dbh, $query);
488 511
 			$mysql_fetch_function = "mysqli_fetch_array";
489 512
 		
490
-		}else{
513
+		} else{
491 514
 			$result = mysql_query($query, $this->dbh);
492 515
 			$mysql_fetch_function = "mysql_fetch_array";
493 516
 		}
Please login to merge, or discard this patch.
includes/class-xcloner-logger.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 		$logger_path 		= $xcloner_settings->get_xcloner_store_path().DS.$xcloner_settings->get_logger_filename();
17 17
 		$logger_path_tmp 	= "";
18 18
 		
19
-		if($hash)
20
-			$logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1);
19
+		if($hash) {
20
+					$logger_path_tmp = $xcloner_settings->get_xcloner_tmp_path().DS.$xcloner_settings->get_logger_filename(1);
21
+		}
21 22
 		
22 23
 		
23 24
 		$this->logger_path = $logger_path;
@@ -40,8 +41,9 @@  discard block
 block discarded – undo
40 41
 		
41 42
 		$debug_level = Logger::INFO;
42 43
 		
43
-		if(WP_DEBUG)
44
-			$debug_level = Logger::DEBUG;
44
+		if(WP_DEBUG) {
45
+					$debug_level = Logger::DEBUG;
46
+		}
45 47
 
46 48
 	
47 49
 		if($logger_path)
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
52 54
 			$this->main_logger_url =  $stream->getUrl();
53 55
 		}
54 56
 			
55
-		if($hash and $logger_path_tmp)
56
-			$this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level));
57
+		if($hash and $logger_path_tmp) {
58
+					$this->pushHandler(new StreamHandler($logger_path_tmp, $debug_level));
59
+		}
57 60
 		
58 61
 		//return $this;
59 62
 	}
@@ -68,8 +71,9 @@  discard block
 block discarded – undo
68 71
 		$lines = array();
69 72
 		
70 73
 		//if(!file_exists($this->logger_path) or !is_readable($this->logger_path))
71
-		if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url))
72
-			return false;
74
+		if(!file_exists($this->main_logger_url) or !is_readable($this->main_logger_url)) {
75
+					return false;
76
+		}
73 77
 		
74 78
 		//$fp = fopen($this->logger_path, 'r');
75 79
 		$fp = fopen($this->main_logger_url, 'r');
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
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
 	
56 56
 	public function xcloner_backup_add_admin_menu()
57 57
 	{
58
-		if ( function_exists('add_menu_page') )
59
-			add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', 'xcloner_display', 'dashicons-backup');
58
+		if ( function_exists('add_menu_page') ) {
59
+					add_menu_page( __('Site Backup','xcloner-backup-and-restore'), __('Site Backup','xcloner-backup-and-restore'), 'manage_options', 'xcloner_init_page', 'xcloner_display', 'dashicons-backup');
60
+		}
60 61
 
61 62
 		if ( function_exists('add_submenu_page') )
62 63
 		{
Please login to merge, or discard this patch.