@@ -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"); |
@@ -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"); |