@@ -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"); |
@@ -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"); |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | |
14 | 14 | function handleError($errno, $errstr, $errfile, $errline, array $errcontext) |
15 | 15 | { |
16 | - // error was suppressed with the @-operator |
|
17 | - if (0 === error_reporting()) { |
|
18 | - return false; |
|
19 | - } |
|
16 | + // error was suppressed with the @-operator |
|
17 | + if (0 === error_reporting()) { |
|
18 | + return false; |
|
19 | + } |
|
20 | 20 | |
21 | - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
|
21 | + throw new ErrorException($errstr, 0, $errno, $errfile, $errline); |
|
22 | 22 | } |
23 | 23 | set_error_handler('handleError'); |
24 | 24 | |
25 | 25 | $regs = array( |
26 | - "empty" => "", |
|
27 | - "illformed" => "[](9()))))))))) [34543/34]", |
|
28 | - "simple" => '"data.mp3', |
|
26 | + "empty" => "", |
|
27 | + "illformed" => "[](9()))))))))) [34543/34]", |
|
28 | + "simple" => '"data.mp3', |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | $releases = new Releases(); |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | foreach ($res as $regexrow) |
41 | 41 | { |
42 | 42 | foreach ($regs as $regex){ |
43 | - try { |
|
44 | - $res=preg_match($regexrow["regex"], $regex); |
|
45 | - }catch(Exception $e){ |
|
46 | - $errcnt++; |
|
47 | - $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
|
48 | - echo "$strerr. id=".$regexrow["id"]. |
|
49 | - ", group=".$regexrow["groupname"]."\n"; |
|
50 | - echo " regex='".$regexrow["regex"]."'\n"; |
|
51 | - echo " error=".$e->getMessage()."\n\n"; |
|
52 | - break; |
|
53 | - } |
|
43 | + try { |
|
44 | + $res=preg_match($regexrow["regex"], $regex); |
|
45 | + }catch(Exception $e){ |
|
46 | + $errcnt++; |
|
47 | + $strerr=str_pad((int) $errcnt,2," ",STR_PAD_LEFT); |
|
48 | + echo "$strerr. id=".$regexrow["id"]. |
|
49 | + ", group=".$regexrow["groupname"]."\n"; |
|
50 | + echo " regex='".$regexrow["regex"]."'\n"; |
|
51 | + echo " error=".$e->getMessage()."\n\n"; |
|
52 | + break; |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | echo "Scanned $total record(s), $errcnt error(s) found.\n"; |