Passed
Push — dev ( 36ac9d...273395 )
by Darko
08:47
created
misc/testing/DB/mysqldump_tables.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 function newname($filename)
26 26
 {
27
-	rename($filename, dirname($filename)."/".basename($filename,".gz")."_".date("Y_m_d_His", filemtime($filename)).".gz");
27
+	rename($filename, dirname($filename) . "/" . basename($filename, ".gz") . "_" . date("Y_m_d_His", filemtime($filename)) . ".gz");
28 28
 }
29 29
 
30 30
 function builddefaultsfile()
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				."password = " . DB_PASSWORD;
43 43
 
44 44
 	$filehandle = fopen("mysql-defaults.txt", "w+");
45
-	if(!$filehandle) {
45
+	if (!$filehandle) {
46 46
 		exit("Unable to write mysql defaults file! Exiting");
47 47
 	} else {
48 48
 		fwrite($filehandle, $filetext);
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 //generate defaults file used to store database login information so it is not in cleartext in ps command for mysqldump
68 68
 builddefaultsfile();
69 69
 
70
-if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
71
-	$filename = $argv[3]."/".$dbname.".gz";
70
+if ((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
71
+	$filename = $argv[3] . "/" . $dbname . ".gz";
72 72
 	echo $pdo->log->header("Dumping $dbname.");
73 73
 	if (file_exists($filename)) {
74 74
 		newname($filename);
75 75
 	}
76
-	$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname | gzip -9 > $filename";
76
+	$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname | gzip -9 > $filename";
77 77
 	system($command);
78
-} else if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
79
-	$filename = $argv[3]."/".$dbname.".gz";
78
+} else if ((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
79
+	$filename = $argv[3] . "/" . $dbname . ".gz";
80 80
 	if (file_exists($filename)) {
81 81
 		echo $pdo->log->header("Restoring $dbname.");
82 82
 		$command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname";
@@ -84,26 +84,26 @@  discard block
 block discarded – undo
84 84
 		system($command);
85 85
 		$pdo->queryExec("SET FOREIGN_KEY_CHECKS=1");
86 86
 	}
87
-} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
87
+} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
88 88
 	$sql = "SHOW tables";
89 89
 	$tables = $pdo->query($sql);
90
-	foreach($tables as $row) {
91
-		$tbl = $row['Tables_in_'.DB_NAME];
92
-		$filename = $argv[3]."/".$tbl.".gz";
90
+	foreach ($tables as $row) {
91
+		$tbl = $row['Tables_in_' . DB_NAME];
92
+		$filename = $argv[3] . "/" . $tbl . ".gz";
93 93
 		echo $pdo->log->header("Dumping $tbl.");
94 94
 		if (file_exists($filename)) {
95 95
 			newname($filename);
96 96
 		}
97
-		$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname $tbl | gzip -9 > $filename";
97
+		$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname $tbl | gzip -9 > $filename";
98 98
 		system($command);
99 99
 	}
100
-} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
100
+} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
101 101
 	$sql = "SHOW tables";
102 102
 	$tables = $pdo->query($sql);
103 103
 	$pdo->queryExec("SET FOREIGN_KEY_CHECKS=0");
104
-	foreach($tables as $row) {
105
-		$tbl = $row['Tables_in_'.DB_NAME];
106
-		$filename = $argv[3]."/".$tbl.".gz";
104
+	foreach ($tables as $row) {
105
+		$tbl = $row['Tables_in_' . DB_NAME];
106
+		$filename = $argv[3] . "/" . $tbl . ".gz";
107 107
 		if (file_exists($filename)) {
108 108
 			echo $pdo->log->header("Restoring $tbl.");
109 109
 			$command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname";
@@ -111,22 +111,22 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 	}
113 113
 	$pdo->queryExec("SET FOREIGN_KEY_CHECKS=1");
114
-} else if((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
114
+} else if ((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) {
115 115
 	$arr = array("parts", "binaries", "missed_parts", "groups");
116 116
 	foreach ($arr as &$tbl) {
117
-		$filename = $argv[3]."/".$tbl.".gz";
117
+		$filename = $argv[3] . "/" . $tbl . ".gz";
118 118
 		echo $pdo->log->header("Dumping $tbl..");
119 119
 		if (file_exists($filename)) {
120 120
 			newname($filename);
121 121
 		}
122
-		$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use "."$dbname $tbl | gzip -9 > $filename";
122
+		$command = "mysqldump --defaults-file=mysql-defaults.txt $exportopts -h$dbhost $use " . "$dbname $tbl | gzip -9 > $filename";
123 123
 		system($command);
124 124
 	}
125
-} else if((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
125
+} else if ((isset($argv[1]) && $argv[1] == "test") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) {
126 126
 	$arr = array("parts", "binaries", "missed_parts", "groups");
127 127
 	$pdo->queryExec("SET FOREIGN_KEY_CHECKS=0");
128 128
 	foreach ($arr as &$tbl) {
129
-		$filename = $argv[3]."/".$tbl.".gz";
129
+		$filename = $argv[3] . "/" . $tbl . ".gz";
130 130
 		if (file_exists($filename)) {
131 131
 			echo $pdo->log->header("Restoring $tbl.");
132 132
 			$command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname";
@@ -134,25 +134,25 @@  discard block
 block discarded – undo
134 134
 		}
135 135
 	}
136 136
 	$pdo->queryExec("SET FOREIGN_KEY_CHECKS=1");
137
-} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "outfile") && (isset($argv[3]) && file_exists($argv[3]))) {
137
+} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "outfile") && (isset($argv[3]) && file_exists($argv[3]))) {
138 138
 	$sql = "SHOW tables";
139 139
 	$tables = $pdo->query($sql);
140
-	foreach($tables as $row) {
141
-		$tbl = $row['Tables_in_'.DB_NAME];
142
-		$filename = $argv[3].$tbl.".csv";
140
+	foreach ($tables as $row) {
141
+		$tbl = $row['Tables_in_' . DB_NAME];
142
+		$filename = $argv[3] . $tbl . ".csv";
143 143
 		echo $pdo->log->header("Dumping $tbl.");
144 144
 		if (file_exists($filename)) {
145 145
 			newname($filename);
146 146
 		}
147 147
 		$pdo->queryDirect(sprintf("SELECT * INTO OUTFILE %s FROM %s", $pdo->escapeString($filename), $tbl));
148 148
 	}
149
-} else if((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "infile") && (isset($argv[3]) && is_dir($argv[3]))) {
149
+} else if ((isset($argv[1]) && $argv[1] == "all") && (isset($argv[2]) && $argv[2] == "infile") && (isset($argv[3]) && is_dir($argv[3]))) {
150 150
 	$sql = "SHOW tables";
151 151
 	$tables = $pdo->query($sql);
152 152
 	$pdo->queryExec("SET FOREIGN_KEY_CHECKS=0");
153
-	foreach($tables as $row) {
154
-		$tbl = $row['Tables_in_'.DB_NAME];
155
-		$filename = $argv[3].$tbl.".csv";
153
+	foreach ($tables as $row) {
154
+		$tbl = $row['Tables_in_' . DB_NAME];
155
+		$filename = $argv[3] . $tbl . ".csv";
156 156
 		if (file_exists($filename)) {
157 157
 			echo $pdo->log->header("Restoring $tbl.");
158 158
 			$pdo->queryExec(sprintf("LOAD DATA INFILE %s INTO TABLE %s", $pdo->escapeString($filename), $tbl));
@@ -177,6 +177,6 @@  discard block
 block discarded – undo
177 177
 	. "php $argv[0] all infile /path/to/restore/from      ...: To restore all tables, using INFILE.\n\n");
178 178
 }
179 179
 
180
-if(file_exists("mysql-defaults.txt")) {
180
+if (file_exists("mysql-defaults.txt")) {
181 181
 	@unlink("mysql-defaults.txt");
182 182
 }
Please login to merge, or discard this patch.
misc/testing/PostProc/getGameCovers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 				echo $pdo->log->primary($gameInfo['release'] . ' not found');
28 28
 			} else {
29 29
 				if (file_exists(NN_COVERS . 'games' . DS . $gameData . '.jpg')) {
30
-					$pdo->queryExec(sprintf('UPDATE gamesinfo SET cover = 1 WHERE id = %d',	$arr['id']));
30
+					$pdo->queryExec(sprintf('UPDATE gamesinfo SET cover = 1 WHERE id = %d', $arr['id']));
31 31
 				}
32 32
 			}
33 33
 		}
Please login to merge, or discard this patch.
misc/testing/fix_filesize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,5 +39,5 @@
 block discarded – undo
39 39
 	$pdo->queryExec("UPDATE releases SET size = '{$filesize}' WHERE id = '{$item['id']}' LIMIT 1");
40 40
 
41 41
 	$compl++;
42
-	echo sprintf("[%6d / %6d] %0.2f",$compl, $total, ($compl/$total) * 100) . '%' . "\n";
42
+	echo sprintf("[%6d / %6d] %0.2f", $compl, $total, ($compl / $total) * 100) . '%' . "\n";
43 43
 }
Please login to merge, or discard this patch.
misc/testing/Releases/delete_releases.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 if ($totalArgs < 2) {
17 17
 	exit($cli->info($n .
18 18
 		'This deletes releases based on a list of criteria you pass.' . $n .
19
-		'Usage:' . $n . $n.
19
+		'Usage:' . $n . $n .
20 20
 		'List of supported criteria:' . $n .
21 21
 		'fromname   : Look for names of people who posted releases (the poster name). (modifiers: equals, like)' . $n .
22 22
 		'groupname  : Look in groups. (modifiers: equals, like)' . $n .
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 		$_SERVER['_'] . ' ' . $argv[0] . ' groupname=equals="alt.binaries.teevee" searchname=like="olympics 2014" postdate=bigger="5"' . $n .
45 45
 		$_SERVER['_'] . ' ' . $argv[0] . ' guid=equals="8fb5956bae3de4fb94edcc69da44d6883d586fd0"' . $n .
46 46
 		$_SERVER['_'] . ' ' . $argv[0] . ' size=smaller="104857600" size=bigger="2048" groupname=like="movies"' . $n .
47
-		$_SERVER['_'] . ' ' . $argv[0] . ' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore' .$n .
47
+		$_SERVER['_'] . ' ' . $argv[0] . ' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore' . $n .
48 48
 		$_SERVER['_'] . ' ' . $argv[0] . ' imdbid=equals=NULL categories_id=equals=2999 nzbstatus=equals=1 adddate=bigger=2880 # Remove other movie releases with non-cleaned names added > 120 days ago'
49 49
 	));
50 50
 }
51 51
 
52 52
 $RR = new ReleaseRemover();
53 53
 // Remove argv[0] and send the array.
54
-$RR->removeByCriteria(array_slice($argv, 1, $totalArgs-1));
54
+$RR->removeByCriteria(array_slice($argv, 1, $totalArgs - 1));
Please login to merge, or discard this patch.
misc/sphinxsearch/populate_rt_indexes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 
55 55
 	$lastId = $minId - 1;
56 56
 	echo "[Starting to populate sphinx RT index $table with $total releases.]\n";
57
-	for ($i = $minId; $i <= ($total + $max + $minId) ; $i += $max) {
57
+	for ($i = $minId; $i <= ($total + $max + $minId); $i += $max) {
58 58
 
59 59
 		$rows = $pdo->queryDirect(sprintf($query, $lastId, $max));
60 60
 		if (!$rows) {
Please login to merge, or discard this patch.
app/extensions/console/Response.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -309,7 +309,7 @@
 block discarded – undo
309 309
 		'gray'			=> "\033[37m",
310 310
 		'grey'			=> "\033[37m",
311 311
 		'hidden'		=> "\033[8m",
312
-		'info'			=> "\033[35m",	// replace with updated version of:
312
+		'info'			=> "\033[35m", // replace with updated version of:
313 313
 		// "\033[" . self::coloursForeground['purple'] . "mInfo: $text\033[0m"
314 314
 		// when we switch to PHP 5.6
315 315
 		'normal'		=> "\033[0m",
Please login to merge, or discard this patch.
app/extensions/util/Versions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * These constants are bitwise for checking what has changed.
28 28
 	 */
29
-	const UPDATED_GIT_TAG		= 1;
30
-	const UPDATED_SQL_DB_PATCH	= 2;
31
-	const UPDATED_SQL_FILE_LAST	= 4;
29
+	const UPDATED_GIT_TAG = 1;
30
+	const UPDATED_SQL_DB_PATCH = 2;
31
+	const UPDATED_SQL_FILE_LAST = 4;
32 32
 
33 33
 	/**
34 34
 	 * @var integer Bitwise mask of elements that have been changed.
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		parent::_init();
306 306
 
307 307
 		if ($this->_config['git'] instanceof \app\extensions\util\Git) {
308
-			$this->git =& $this->_config['git'];
308
+			$this->git = & $this->_config['git'];
309 309
 		}
310 310
 	}
311 311
 
Please login to merge, or discard this patch.
app/extensions/util/yenc/adapter/Php.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
 		for ($chr = 0; $chr < $encodedLength; $chr++) {
66 66
 			$decoded .= (
67 67
 				$encoded[$chr] == '=' ?
68
-					chr((ord($encoded[$chr]) - 42) % 256) :
69
-					chr((((ord($encoded[++$chr]) - 64) % 256) - 42) % 256)
68
+					chr((ord($encoded[$chr]) - 42) % 256) : chr((((ord($encoded[++$chr]) - 64) % 256) - 42) % 256)
70 69
 			);
71 70
 		}
72 71
 
@@ -129,8 +128,7 @@  discard block
 block discarded – undo
129 128
 			for ($chr = 0; $chr < $length; $chr++) {
130 129
 				$text .= (
131 130
 					$input[$chr] == '=' ?
132
-						chr((((ord($input[++$chr]) - 64) % 256) - 42) % 256) :
133
-						chr((ord($input[$chr]) - 42) % 256)
131
+						chr((((ord($input[++$chr]) - 64) % 256) - 42) % 256) : chr((ord($input[$chr]) - 42) % 256)
134 132
 				);
135 133
 			}
136 134
 		}
Please login to merge, or discard this patch.
app/extensions/command/Version.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 	{
151 151
 		parent::_init();
152 152
 
153
-		$this->request->params['args'] += ['sqlcheck' => 'all'];    // Default to all versions/
153
+		$this->request->params['args'] += ['sqlcheck' => 'all']; // Default to all versions/
154 154
 		$this->versions = new Versions();
155 155
 	}
156 156
 }
Please login to merge, or discard this patch.