} } if ($clear == 1) { clean_resource($result, '01'); } } if (!isset($in)) { $in = ""; } if (!isset($out)) { $out = ""; } $started = time(); index_site($url, $reindex, $maxlevel, $soption, $in, $out, $can_leave, $use_robot, $use_nofollow, $cl, $all, $use_pref); $ended = time(); $consumed = $ended - $started; printConsumedReport('consumed', $cl, '0', $consumed); printStandardReport('ReindexFinish', $command_line, '0'); } printStandardReport('quit', $command_line, '0'); if ($email_log) { $indexed = $all == 1 ? 'ALL' : $url; $log_report = ""; if ($log_handle) { $log_report = "Log saved into {$log_file}"; } mail($admin_email, "Sphider indexing report", "Sphider has finished indexing {$indexed} at " . date("y-m-d H:i:s") . ". " . $log_report); } if ($log_handle) { fclose($log_handle); }
function index_suspended() { global $db_con, $mysql_table_prefix, $command_line, $debug, $use_robot, $use_nofollow, $no_log, $clear, $started, $cl; $started = time(); $reindex = 0; printStandardReport('SuspendedStart', $command_line, $no_log); // get ID and URL of all sites $sql_query = "SELECT site_id, url from " . $mysql_table_prefix . "sites ORDER by url"; $result1 = $db_con->query($sql_query); if ($debug && $db_con->errno) { $err_row = __LINE__ - 2; printf("<p><span class='red'> MySQL failure: %s \n<br /></span></p>", $db_con->error); if (__FUNCTION__) { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} in function(): " . __FUNCTION__ . " <br /></span></p>"); } else { printf("<p><span class='red'> Found in script: " . __FILE__ . " row: {$err_row} <br /></span></p>"); } printf("<p><span class='red'> Script execution aborted. <br /></span>"); printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>"); echo "<p> {$sql_query} </p>"; exit; } while ($row1 = $result1->fetch_array(MYSQLI_NUM)) { $url = $row1[1]; $site_id = $row1[0]; // check whether this site is pending $sql_query = "SELECT site_id from " . $mysql_table_prefix . "pending where site_id ={$site_id}"; $result2 = $db_con->query($sql_query); $row2 = $result2->fetch_array(MYSQLI_ASSOC); // if pending, continue indexing this URL if ($row2['site_id'] == $site_id) { // fetch all important data of this site $sql_query = "SELECT url, spider_depth, required, disallowed, can_leave_domain, use_prefcharset from " . $mysql_table_prefix . "sites where url='{$url}'"; $result = $db_con->query($sql_query); if ($row = $result->fetch_array(MYSQLI_NUM)) { $maxlevel = $row[1]; $in = $row[2]; $out = $row[3]; $domaincb = $row[4]; $use_prefcharset = $row[5]; if ($domaincb == '') { $domaincb = 0; } if ($maxlevel == -1) { $soption = 'full'; } else { $soption = 'level'; } } if ($clear == 1) { clean_resource($result, '21'); } if (!isset($in)) { $in = ""; } if (!isset($out)) { $out = ""; } // now indnex the rest of this site index_site($url, $reindex, $maxlevel, $soption, $in, $out, $domaincb, $use_robot, $use_nofollow, $cl, $all, $use_prefcharset); } } if ($clear == 1) { clean_resource($result, '20'); } $ended = time(); $consumed = $ended - $started; printConsumedReport('consumed', $cl, '0', $consumed); printStandardReport('SuspendedFinish', $command_line, '0'); create_footer(); }