@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $previewcat="-1"; |
| 17 | 17 | if (isset($_REQUEST["previewcat"])) |
| 18 | - $previewcat = $_REQUEST["previewcat"]; |
|
| 18 | + $previewcat = $_REQUEST["previewcat"]; |
|
| 19 | 19 | |
| 20 | 20 | $catarray = []; |
| 21 | 21 | $catarray[] = $previewcat; |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | switch($action) |
| 18 | 18 | { |
| 19 | - case 'submit': |
|
| 20 | - if ($_POST["id"] == "") |
|
| 21 | - { |
|
| 19 | + case 'submit': |
|
| 20 | + if ($_POST["id"] == "") |
|
| 21 | + { |
|
| 22 | 22 | $reg->add($_POST); |
| 23 | 23 | } |
| 24 | 24 | else |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | header("Location:".WWW_TOP."/regex-list.php"); |
| 29 | 29 | break; |
| 30 | - case 'addtest': |
|
| 31 | - if (isset($_GET['regex']) && isset($_GET['groupname'])) { |
|
| 32 | - $r = array('groupname'=>$_GET['groupname'], 'regex'=>$_GET['regex'], 'ordinal'=>'1', 'status'=>'1'); |
|
| 33 | - $page->smarty->assign('regex', $r); |
|
| 34 | - } |
|
| 35 | - break; |
|
| 36 | - case 'view': |
|
| 37 | - default: |
|
| 30 | + case 'addtest': |
|
| 31 | + if (isset($_GET['regex']) && isset($_GET['groupname'])) { |
|
| 32 | + $r = array('groupname'=>$_GET['groupname'], 'regex'=>$_GET['regex'], 'ordinal'=>'1', 'status'=>'1'); |
|
| 33 | + $page->smarty->assign('regex', $r); |
|
| 34 | + } |
|
| 35 | + break; |
|
| 36 | + case 'view': |
|
| 37 | + default: |
|
| 38 | 38 | |
| 39 | 39 | $page->title = "Release Regex Add"; |
| 40 | 40 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | $page->smarty->assign('regex', $r); |
| 55 | 55 | |
| 56 | - break; |
|
| 56 | + break; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $page->smarty->assign('status_ids', array(Category::STATUS_ACTIVE,Category::STATUS_INACTIVE)); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | echo '.'; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $nntp->doQuit(); |
|
| 86 | + $nntp->doQuit(); |
|
| 87 | 87 | |
| 88 | 88 | } else if (isset($pieces[1]) && $pieces[0] == 'predbft') { |
| 89 | 89 | $pre = $pieces[1]; |
@@ -26,15 +26,15 @@ |
||
| 26 | 26 | $time = 0; |
| 27 | 27 | |
| 28 | 28 | if (isset($argv[1])) |
| 29 | - $time = strtotime($argv[1]); |
|
| 29 | + $time = strtotime($argv[1]); |
|
| 30 | 30 | |
| 31 | 31 | if (($time > 1) && ($time < time())) { |
| 32 | - $groupName = (isset($argv[2]) ? $argv[2] : ''); |
|
| 32 | + $groupName = (isset($argv[2]) ? $argv[2] : ''); |
|
| 33 | 33 | |
| 34 | - if (isset($argv[3]) && $argv[3] == true) |
|
| 35 | - $regexOnly = true; |
|
| 36 | - else |
|
| 37 | - $regexOnly = false; |
|
| 34 | + if (isset($argv[3]) && $argv[3] == true) |
|
| 35 | + $regexOnly = true; |
|
| 36 | + else |
|
| 37 | + $regexOnly = false; |
|
| 38 | 38 | |
| 39 | 39 | $backfill = new Backfill(); |
| 40 | 40 | $backfill->backfillAllGroups($groupName, strtotime($argv[1]), $regexOnly); |
@@ -32,13 +32,13 @@ |
||
| 32 | 32 | |
| 33 | 33 | if (count($movies) == 0) |
| 34 | 34 | { |
| 35 | - echo "No records selected to update - either uncomment case or no matches found.\n"; |
|
| 36 | - die(); |
|
| 35 | + echo "No records selected to update - either uncomment case or no matches found.\n"; |
|
| 36 | + die(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | echo "Updating ".count($movies)." records - Sleep interval ".$sleepsecsbetweenscrape." second(s)\n"; |
| 40 | 40 | foreach ($movies as $mov) { |
| 41 | - echo "Updating ".$mov['imdbid']." (".$counter++."/".count($movies).")\n"; |
|
| 41 | + echo "Updating ".$mov['imdbid']." (".$counter++."/".count($movies).")\n"; |
|
| 42 | 42 | $mov = $movie->updateMovieInfo($mov['imdbid']); |
| 43 | 43 | sleep($sleepsecsbetweenscrape); |
| 44 | 44 | } |
@@ -2,43 +2,43 @@ |
||
| 2 | 2 | use nntmux\db\Settings; |
| 3 | 3 | |
| 4 | 4 | try { |
| 5 | - // Create the first database class instance (which will initialize the PDO connection) |
|
| 6 | - $db = new Settings(); |
|
| 5 | + // Create the first database class instance (which will initialize the PDO connection) |
|
| 6 | + $db = new Settings(); |
|
| 7 | 7 | |
| 8 | - // For debug set the error mode |
|
| 9 | - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
| 8 | + // For debug set the error mode |
|
| 9 | + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
| 10 | 10 | |
| 11 | - // Start the transaction |
|
| 12 | - if( $db->beginTransaction() ) |
|
| 13 | - { |
|
| 14 | - // Loop 20 times |
|
| 15 | - for($i=1 ; $i<=20 ; $i++ ) |
|
| 16 | - { |
|
| 17 | - // Header |
|
| 18 | - echo "--[ Insert run: {$i} ]----------------------------------------". PHP_EOL; |
|
| 11 | + // Start the transaction |
|
| 12 | + if( $db->beginTransaction() ) |
|
| 13 | + { |
|
| 14 | + // Loop 20 times |
|
| 15 | + for($i=1 ; $i<=20 ; $i++ ) |
|
| 16 | + { |
|
| 17 | + // Header |
|
| 18 | + echo "--[ Insert run: {$i} ]----------------------------------------". PHP_EOL; |
|
| 19 | 19 | |
| 20 | - // Create a new db class instance (multiple can exist) |
|
| 21 | - $newDb = new Settings(); |
|
| 20 | + // Create a new db class instance (multiple can exist) |
|
| 21 | + $newDb = new Settings(); |
|
| 22 | 22 | |
| 23 | - // Check that there is a new db class instance, but no new PDO instance |
|
| 24 | - var_dump( $newDb, $newDb->getPDO() ); |
|
| 23 | + // Check that there is a new db class instance, but no new PDO instance |
|
| 24 | + var_dump( $newDb, $newDb->getPDO() ); |
|
| 25 | 25 | |
| 26 | - // Insert some data |
|
| 27 | - $sql = sprintf(" |
|
| 26 | + // Insert some data |
|
| 27 | + $sql = sprintf(" |
|
| 28 | 28 | INSERT INTO `testdata` |
| 29 | 29 | (`id` ,`field1` ,`field2` ,`field3` ,`field4`) |
| 30 | 30 | VALUES |
| 31 | 31 | ('%s', '%s', '%s', '%s', '%s')", $i, $i, $i, $i, $i |
| 32 | - ); |
|
| 33 | - $newDb->exec( $sql ); |
|
| 32 | + ); |
|
| 33 | + $newDb->exec( $sql ); |
|
| 34 | 34 | |
| 35 | - // Check for inserted data |
|
| 36 | - var_dump( $newDb->query( sprintf( "SELECT * FROM `testdata` WHERE id = %d", $i ) ) ); |
|
| 37 | - } |
|
| 35 | + // Check for inserted data |
|
| 36 | + var_dump( $newDb->query( sprintf( "SELECT * FROM `testdata` WHERE id = %d", $i ) ) ); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - // Now rollback using the last db class instance |
|
| 40 | - var_dump( $newDb->rollback() ); |
|
| 41 | - } |
|
| 39 | + // Now rollback using the last db class instance |
|
| 40 | + var_dump( $newDb->rollback() ); |
|
| 41 | + } |
|
| 42 | 42 | } catch(PDOException $e) { |
| 43 | - var_dump( $e ); |
|
| 43 | + var_dump( $e ); |
|
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -7,9 +7,9 @@ |
||
| 7 | 7 | $memcache_enabled = extension_loaded("memcached"); |
| 8 | 8 | |
| 9 | 9 | if ($memcache_enabled) |
| 10 | - echo "extension loaded"; |
|
| 10 | + echo "extension loaded"; |
|
| 11 | 11 | else |
| 12 | - echo "extension not loaded"; |
|
| 12 | + echo "extension not loaded"; |
|
| 13 | 13 | |
| 14 | 14 | $mc = new Memcached(); |
| 15 | 15 | $mc->connect("localhost", 11211) ; |
@@ -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"; |
@@ -324,17 +324,17 @@ |
||
| 324 | 324 | if(array_key_exists("F", $options) || |
| 325 | 325 | array_key_exists("fetch-backfill", $options)){ |
| 326 | 326 | $days = array_key_exists("F", $options)?$options["F"]:$options["fetch-backfill"]; |
| 327 | - try{ |
|
| 328 | - $days = abs(intval($days)); |
|
| 329 | - }catch(Exception $e){ |
|
| 327 | + try{ |
|
| 328 | + $days = abs(intval($days)); |
|
| 329 | + }catch(Exception $e){ |
|
| 330 | 330 | $days = -1; |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - if($days <= 0){ |
|
| 334 | - echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
|
| 335 | - echo "Syntax: php spontnab.php -F=<days>\n"; |
|
| 336 | - exit(1); |
|
| 337 | - } |
|
| 333 | + if($days <= 0){ |
|
| 334 | + echo "Error: A SpotNab fetch backfill requires you specify the number of days to look back.\n"; |
|
| 335 | + echo "Syntax: php spontnab.php -F=<days>\n"; |
|
| 336 | + exit(1); |
|
| 337 | + } |
|
| 338 | 338 | echo "Fetching $days day(s) back ... "; |
| 339 | 339 | $spotnab = new SpotNab(); |
| 340 | 340 | $spotnab->fetch(time()-($days*86400)); |