-1;$i--) { $w[$i] = intval($secondsLeft/$d[$i][0]); $secondsLeft -= ($w[$i]*$d[$i][0]); if($w[$i]!=0) { //$return.= abs($w[$i]). " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." "; $return.= $w[$i]. " " . $d[$i][1] . (($w[$i]>1)?'s':'') ." "; } } //$return .= ($diff>0)?"ago":"left"; return $return; } function get_color() { $from = 1; $to = 231; $exceptions = array( 4, 8, 16, 17, 18, 19, 52, 53, 59, 60, 67 ); sort($exceptions); // lets us use break; in the foreach reliably $number = mt_rand($from, $to - count($exceptions)); // or mt_rand() foreach ($exceptions as $exception) { if ($number >= $exception) { $number++; // make up for the gap } else /*if ($number < $exception)*/ { break; } } return $number; } $_date = $array['KEVIN_DATE']; $_parts = $array['KEVIN_PARTS']; $color = get_color(); $db = new DB; $query1 = $db->queryOneRow("select name from groups WHERE (first_record_postdate BETWEEN '$_date' and now()) and (active = 1) order by name ASC limit 1"); $query2 = $db->queryOneRow("select first_record_postdate from groups WHERE (first_record_postdate BETWEEN '$_date' and now()) and (active = 1) order by name ASC limit 1"); $groups = $db->query("select name from groups WHERE (first_record_postdate NOT BETWEEN '$_date' and now()) and (active = 1) order by name ASC"); foreach($groups as $row) { $tbl = $row['name']; echo "\033[1;33m$tbl Completed\n\033[0m"; } $groupPost = $_parts; $groupName = $query1['name']; $groupDate = $query2['first_record_postdate']; if($query1){ echo "\n\033[1;33mStarting kevin123's safer backfill process on $groupName ==> $_date ==> $groupDate\n\033[38;5;${color}m\n\n"; sleep(3); $backfill = new Backfill(); $backfill->backfillPostAllGroups($groupName, $groupPost); } echo "\n\033[1;33mKevin123's safer backfill process completed in: " .relativeTime($time). "\n\033[0m\n"; ?>