diff -u -r -N yasuck-0.0.6.orig/docs/ChangeLog yasuck-0.0.6/docs/ChangeLog --- yasuck-0.0.6.orig/docs/ChangeLog 2004-09-29 18:15:22.000000000 -0500 +++ yasuck-0.0.6/docs/ChangeLog 2004-09-29 19:13:18.267803328 -0500 @@ -4,7 +4,14 @@ *yasuck-0.0.6 (29 Sep 2004) - 29 Sep 2004: Mike green docs/ChangeLog, + 29 Sep 2004: Mike Green docs/ChangeLog, + includes/app.functions.php, yasuck, patch-0.0.6-02: + + Added --plugholes argument, to fetch messages in the database that + are blank. Basically to fix the results of the bug that was patched + by patch-0.0.6-01. + + 29 Sep 2004: Mike Green docs/ChangeLog, include/apps.functions.php, patch-0.0.6-01: Fixed bug that was skipping message text entries. diff -u -r -N yasuck-0.0.6.orig/includes/app.functions.php yasuck-0.0.6/includes/app.functions.php --- yasuck-0.0.6.orig/includes/app.functions.php 2004-09-29 18:15:22.000000000 -0500 +++ yasuck-0.0.6/includes/app.functions.php 2004-09-29 18:45:58.476089560 -0500 @@ -92,6 +92,16 @@ define(BOARD,$board); define(MERGEDB,$mergedb); break; + case "--plugholes": + if (defined('ACTION')) { return false; } + if (defined('BOARD')) { return false; } + $j++; + $board = $args[$j]; + if (empty($board)) { return false; } + if (substr($board,0,2) == "--") { return false; } + define(ACTION,"resuck"); + define(BOARD,$board); + break; case "--poster": $j++; $text = $args[$j]; @@ -506,6 +516,7 @@ --init Initialize database (destructive) --listgaps BOARD List possible missing messages --merge BOARD DB merge all database entries from DB into database + --plugholes BOARD Resuck blank messages --poster POSTER Only retrieve messages posted by POSTER --quiet No non-error messages displayed while running --recs BOARD [all] Update recommendation counters only @@ -1663,6 +1674,135 @@ /***************************************************************************** * * *****************************************************************************/ +function resuckMessages($board_name='',$start='',$end='') { + +if ($board_name == '') { + echo "What board do you want to suck?\n"; + return false; + } +if (!checkDatabase()) { + echo "checkDatabase() failure\n"; + return false; + } +// create the board if it does not exist +$info_ar = queryBoardInfo($board_name,false); +if ($info_ar === false or !is_array($info_ar)) { + echo "queryBoardInfo() failed\n"; + return false; + } else { + $board_id = $info_ar['board_id']; + $ticker_id = $info_ar['ticker_id']; + } +if (checkLock($board_id)) { + echo "ABORT: board $board_name is locked\n"; + return false; + } + + +// Figure out where to start/end if it was not specified on command line. +$sql = "select message_id from message_ids "; +$sql .= "where board_id=$board_id and message_text='' "; +if (is_numeric($start)) { + $sql .= "and message_id >= $start "; + } +if (is_numeric($end)) { + $sql .= "and message_id <= $end "; + } +$sql .= "order by message_id"; +if (!$qid = db_query($sql)) { + echo "ABORT: cannot retrieve message list\n"; + return false; + } +$num = db_num_rows($qid); +if ($num < 1) { + echo "No messages to resuck\n"; + return true; + } +$msg_ar = array(); +for($j=0; $j < $num; $j++) { + $msg_ar[] = db_result($qid,$j,0); + } +db_free_result($qid); + +// Lock and load! +if (!toggleLock($board_id,1)) { + echo "ABORT: cannot lock board $board.\n"; + return false; + } +$start = $msg_ar[0]; +$end = $msg_ar[(count($msg_ar) - 1)]; + +echo "Retrieving messages: Board($board_name) Start($start) End($end)\n"; +foreach($msg_ar as $j) { + if (!$page = retrieveMsg($board_id,$ticker_id,$j)) { + echo "WARNING: ID: $j retrieval failure\n"; + continue; + } + if (DUMPHTML === true) { + if (!$fd = fopen("$j.html","w")) { + echo "WARNING: cannot open file: $j.html\n"; + } else { + foreach($page as $line) { + if (!fwrite($fd,$line . "\n")) { + echo "WARNING: could not write to file: $j.html\n"; + fclose($fd); + break; + } + } + fclose($fd); + if (QUIET !== true) { + echo "INFO: wrote $j.html\n"; + } + } + } + // account for yahoo outages + $maxunavail = 0; + $sleepmax = 3600; + $sleep = 10; + while (parseMsgUnavailable($page) === true) { + echo "WARNING: ID: $j unavailable\n"; + $maxunavail++; + if ($maxunavail > MAXMISSES) { + toggleLock($board_id,0); + echo "ABORT: Hit MAXMISSES: " . MAXMISSES . "\n"; + return false; + } + if ($sleep > $sleepmax) { + $sleep = 10; + } else { + $sleep = $sleep * 2; + } + if (QUIET !== true) { echo "INFO: Sleeping $sleep\n"; } + sleep($sleep); + } + if (!parseMsgExists($page)) { + echo "WARNING: ID: $j missing\n"; + $maxmisses++; + if ($maxmisses > MAXMISSES) { + toggleLock($board_id,0); + echo "ABORT: Hit MAXMISSES " . MAXMISSES . ".\n"; + return false; + } + continue; + } else { + $maxmisses = 0; + } + processMessage($board_id,$j,$page); + } + +if (DRYRUN !== true) { + if (!refreshStats($board_name)) { + echo "Failed to update stats\n"; + } + } + +return true; + +} + +/***************************************************************************** + * * + *****************************************************************************/ function retrieveList($board_name='',$start='') { if ($board_name == '') { return false; } diff -u -r -N yasuck-0.0.6.orig/yasuck yasuck-0.0.6/yasuck --- yasuck-0.0.6.orig/yasuck 2004-09-29 15:39:17.000000000 -0500 +++ yasuck-0.0.6/yasuck 2004-09-29 18:34:12.751376024 -0500 @@ -87,6 +87,17 @@ echo $status; exit(); break; + case "resuck": + $rc = resuckMessages(BOARD,START,END); + if ($rc === true) { + $status = "Done (success)\n"; + } else { + $status = "Done (failure)\n"; + } + toggleLock(BOARD,0); + echo $status; + exit(); + break; case "sanity": $rc = sanityCheck(); if ($rc === true) {