@@ -27,7 +27,7 @@ |
||
27 | 27 | $tables = $pdo->query($sql); |
28 | 28 | foreach ($tables as $row) { |
29 | 29 | $tbl = $row['name']; |
30 | - if (preg_match('/collections_\d+/', $tbl) || preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
|
30 | + if (preg_match('/collections_\d+/', $tbl) || preg_match('/binaries_\d+/', $tbl) || preg_match('/parts_\d+/', $tbl) || preg_match('/partrepair_\d+/', $tbl) || preg_match('/\d+_collections/', $tbl) || preg_match('/\d+_binaries/', $tbl) || preg_match('/\d+_parts/', $tbl) || preg_match('/\d+_partrepair_\d+/', $tbl)) { |
|
31 | 31 | if ($argv[1] == "drop") { |
32 | 32 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
33 | 33 | if ($rel !== false) { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | foreach ($arr as &$value) { |
14 | 14 | $rel = $pdo->queryExec("TRUNCATE TABLE $value"); |
15 | 15 | if ($rel !== false) { |
16 | - echo $pdo->log->primary("Truncating ${value} completed."); |
|
16 | + echo $pdo->log->primary("truncating ${value} completed."); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | unset($value); |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | if ($argv[1] == "drop") { |
32 | 32 | $rel = $pdo->queryDirect(sprintf('DROP TABLE %s', $tbl)); |
33 | 33 | if ($rel !== false) { |
34 | - echo $pdo->log->primary("Dropping ${tbl} completed."); |
|
34 | + echo $pdo->log->primary("dropping ${tbl} completed."); |
|
35 | 35 | } |
36 | 36 | } else { |
37 | 37 | $rel = $pdo->queryDirect(sprintf('TRUNCATE TABLE %s', $tbl)); |
38 | 38 | if ($rel !== false) { |
39 | - echo $pdo->log->primary("Truncating ${tbl} completed."); |
|
39 | + echo $pdo->log->primary("truncating ${tbl} completed."); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "dump") && (isset($argv[3]) && file_exists($argv[3]))) { |
71 | 71 | $filename = $argv[3]."/".$dbname.".gz"; |
72 | - echo $pdo->log->header("Dumping $dbname."); |
|
72 | + echo $pdo->log->header("dumping $dbname."); |
|
73 | 73 | if (file_exists($filename)) { |
74 | 74 | newname($filename); |
75 | 75 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } else if((isset($argv[1]) && $argv[1] == "db") && (isset($argv[2]) && $argv[2] == "restore") && (isset($argv[3]) && file_exists($argv[3]))) { |
79 | 79 | $filename = $argv[3]."/".$dbname.".gz"; |
80 | 80 | if (file_exists($filename)) { |
81 | - echo $pdo->log->header("Restoring $dbname."); |
|
81 | + echo $pdo->log->header("restoring $dbname."); |
|
82 | 82 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
83 | 83 | $pdo->queryExec("SET FOREIGN_KEY_CHECKS=0"); |
84 | 84 | system($command); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | foreach($tables as $row) { |
91 | 91 | $tbl = $row['Tables_in_'.DB_NAME]; |
92 | 92 | $filename = $argv[3]."/".$tbl.".gz"; |
93 | - echo $pdo->log->header("Dumping $tbl."); |
|
93 | + echo $pdo->log->header("dumping $tbl."); |
|
94 | 94 | if (file_exists($filename)) { |
95 | 95 | newname($filename); |
96 | 96 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $tbl = $row['Tables_in_'.DB_NAME]; |
106 | 106 | $filename = $argv[3]."/".$tbl.".gz"; |
107 | 107 | if (file_exists($filename)) { |
108 | - echo $pdo->log->header("Restoring $tbl."); |
|
108 | + echo $pdo->log->header("restoring $tbl."); |
|
109 | 109 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
110 | 110 | system($command); |
111 | 111 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $arr = array("parts", "binaries", "missed_parts", "groups"); |
116 | 116 | foreach ($arr as &$tbl) { |
117 | 117 | $filename = $argv[3]."/".$tbl.".gz"; |
118 | - echo $pdo->log->header("Dumping $tbl.."); |
|
118 | + echo $pdo->log->header("dumping $tbl.."); |
|
119 | 119 | if (file_exists($filename)) { |
120 | 120 | newname($filename); |
121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | foreach ($arr as &$tbl) { |
129 | 129 | $filename = $argv[3]."/".$tbl.".gz"; |
130 | 130 | if (file_exists($filename)) { |
131 | - echo $pdo->log->header("Restoring $tbl."); |
|
131 | + echo $pdo->log->header("restoring $tbl."); |
|
132 | 132 | $command = "zcat < $filename | mysql --defaults-file=mysql-defaults.txt -h$dbhost $use $dbname"; |
133 | 133 | system($command); |
134 | 134 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | foreach($tables as $row) { |
141 | 141 | $tbl = $row['Tables_in_'.DB_NAME]; |
142 | 142 | $filename = $argv[3].$tbl.".csv"; |
143 | - echo $pdo->log->header("Dumping $tbl."); |
|
143 | + echo $pdo->log->header("dumping $tbl."); |
|
144 | 144 | if (file_exists($filename)) { |
145 | 145 | newname($filename); |
146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $tbl = $row['Tables_in_'.DB_NAME]; |
155 | 155 | $filename = $argv[3].$tbl.".csv"; |
156 | 156 | if (file_exists($filename)) { |
157 | - echo $pdo->log->header("Restoring $tbl."); |
|
157 | + echo $pdo->log->header("restoring $tbl."); |
|
158 | 158 | $pdo->queryExec(sprintf("LOAD DATA INFILE %s INTO TABLE %s", $pdo->escapeString($filename), $tbl)); |
159 | 159 | } |
160 | 160 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $covers = $updated = $deleted = 0; |
9 | 9 | |
10 | 10 | if ($argc == 1 || $argv[1] != 'true') { |
11 | - exit($pdo->log->error("\nThis script will check all images in covers/music and compare to db->musicinfo.\nTo run:\nphp $argv[0] true\n")); |
|
11 | + exit($pdo->log->error("\nThis script will check all images in covers/music and compare to db->musicinfo.\nTo run:\nphp $argv[0] true\n")); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $path2covers = NN_COVERS . 'music' . DS; |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | $dirItr = new \RecursiveDirectoryIterator($path2covers); |
17 | 17 | $itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY); |
18 | 18 | foreach ($itr as $filePath) { |
19 | - if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
20 | - preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
21 | - if (isset($match[1])) { |
|
22 | - $run = $pdo->queryDirect("UPDATE musicinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
23 | - if ($run->rowCount() >= 1) { |
|
24 | - $covers++; |
|
25 | - } else { |
|
26 | - $run = $pdo->queryDirect("SELECT id FROM musicinfo WHERE id = " . $match[1]); |
|
27 | - if ($run->rowCount() == 0) { |
|
28 | - echo $pdo->log->info($filePath . " not found in db."); |
|
29 | - } |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
19 | + if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
20 | + preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
21 | + if (isset($match[1])) { |
|
22 | + $run = $pdo->queryDirect("UPDATE musicinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
23 | + if ($run->rowCount() >= 1) { |
|
24 | + $covers++; |
|
25 | + } else { |
|
26 | + $run = $pdo->queryDirect("SELECT id FROM musicinfo WHERE id = " . $match[1]); |
|
27 | + if ($run->rowCount() == 0) { |
|
28 | + echo $pdo->log->info($filePath . " not found in db."); |
|
29 | + } |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $qry = $pdo->queryDirect("SELECT id FROM musicinfo WHERE cover = 1"); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $covers = $updated = $deleted = 0; |
9 | 9 | |
10 | 10 | if ($argc == 1 || $argv[1] != 'true') { |
11 | - exit($pdo->log->error("\nThis script will check all images in covers/book and compare to db->bookinfo.\nTo run:\nphp $argv[0] true\n")); |
|
11 | + exit($pdo->log->error("\nThis script will check all images in covers/book and compare to db->bookinfo.\nTo run:\nphp $argv[0] true\n")); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | $dirItr = new \RecursiveDirectoryIterator($path2covers); |
18 | 18 | $itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY); |
19 | 19 | foreach ($itr as $filePath) { |
20 | - if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
21 | - preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
22 | - if (isset($match[1])) { |
|
23 | - $run = $pdo->queryDirect("UPDATE bookinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
24 | - if ($run->rowCount() >= 1) { |
|
25 | - $covers++; |
|
26 | - } else { |
|
27 | - $run = $pdo->queryDirect("SELECT id FROM bookinfo WHERE id = " . $match[1]); |
|
28 | - if ($run->rowCount() == 0) { |
|
29 | - echo $pdo->log->info($filePath . " not found in db."); |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - } |
|
20 | + if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
21 | + preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
22 | + if (isset($match[1])) { |
|
23 | + $run = $pdo->queryDirect("UPDATE bookinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
24 | + if ($run->rowCount() >= 1) { |
|
25 | + $covers++; |
|
26 | + } else { |
|
27 | + $run = $pdo->queryDirect("SELECT id FROM bookinfo WHERE id = " . $match[1]); |
|
28 | + if ($run->rowCount() == 0) { |
|
29 | + echo $pdo->log->info($filePath . " not found in db."); |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $qry = $pdo->queryDirect("SELECT id FROM bookinfo WHERE cover = 1"); |
@@ -27,7 +27,7 @@ |
||
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 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $covers = $updated = $deleted = 0; |
9 | 9 | |
10 | 10 | if ($argc == 1 || $argv[1] != 'true') { |
11 | - exit($pdo->log->error("\nThis script will check all images in covers/console and compare to db->consoleinfo.\nTo run:\nphp $argv[0] true\n")); |
|
11 | + exit($pdo->log->error("\nThis script will check all images in covers/console and compare to db->consoleinfo.\nTo run:\nphp $argv[0] true\n")); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | $dirItr = new \RecursiveDirectoryIterator($path2covers); |
18 | 18 | $itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY); |
19 | 19 | foreach ($itr as $filePath) { |
20 | - if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
21 | - preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
22 | - if (isset($match[1])) { |
|
23 | - $run = $pdo->queryDirect("UPDATE consoleinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
24 | - if ($run->rowCount() >= 1) { |
|
25 | - $covers++; |
|
26 | - } else { |
|
27 | - $run = $pdo->queryDirect("SELECT id FROM consoleinfo WHERE id = " . $match[1]); |
|
28 | - if ($run->rowCount() == 0) { |
|
29 | - echo $pdo->log->info($filePath . " not found in db."); |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - } |
|
20 | + if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) { |
|
21 | + preg_match('/(\d+)\.jpg/', basename($filePath), $match); |
|
22 | + if (isset($match[1])) { |
|
23 | + $run = $pdo->queryDirect("UPDATE consoleinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); |
|
24 | + if ($run->rowCount() >= 1) { |
|
25 | + $covers++; |
|
26 | + } else { |
|
27 | + $run = $pdo->queryDirect("SELECT id FROM consoleinfo WHERE id = " . $match[1]); |
|
28 | + if ($run->rowCount() == 0) { |
|
29 | + echo $pdo->log->info($filePath . " not found in db."); |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $qry = $pdo->queryDirect("SELECT id FROM consoleinfo WHERE cover = 1"); |
@@ -39,5 +39,5 @@ |
||
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 | } |
@@ -19,8 +19,7 @@ |
||
19 | 19 | $compl = 0; |
20 | 20 | echo "Updating file size for " . count($items) . " release(s)\n"; |
21 | 21 | |
22 | -while ($item = array_pop($items)) |
|
23 | -{ |
|
22 | +while ($item = array_pop($items)) { |
|
24 | 23 | $nzbpath = $nzb->getNZBPath($item['guid'], $pdo->getSetting('nzbpath')); |
25 | 24 | |
26 | 25 | ob_start(); |
@@ -16,7 +16,7 @@ discard block |
||
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 |
||
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)); |
@@ -54,7 +54,7 @@ |
||
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) { |