Example #1
0
}
if ($all == '20') {
    //  index all suspended sites
    index_suspended();
}
if ($all == '21') {
    //  index all sites shown on one page
    index_these();
}
if ($all == '22') {
    //  index only the prioritized sites
    index_prior($pref_level);
}
if ($all != '1' && $all != '2' && $all != '3' && $all != '4' && $all != '5' && $all != '20' && $all != '21' && $all != '22') {
    if ($reindex == 1 && $command_line == 1) {
        mysqltest();
        $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 ($debug && $db_con->errno) {
            $err_row = __LINE__ - 2;
            printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
            if (__FUNCTION__) {
                printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
            } else {
                printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
            }
            printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
            printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
            echo "<p> {$sql_query} </p>";
            exit;
        }
function index_erased()
{
    global $db_con, $mysql_table_prefix, $command_line, $debug, $use_robot, $use_nofollow, $no_log, $clear, $started, $cl;
    $started = time();
    $reindex == 0;
    printStandardReport('ErasedStart', $command_line, $no_log);
    mysqltest();
    $sql_query = "SELECT url, indexdate, spider_depth, required, disallowed, can_leave_domain, use_prefcharset from " . $mysql_table_prefix . "sites";
    $result = $db_con->query($sql_query);
    if ($debug && $db_con->errno) {
        $err_row = __LINE__ - 2;
        printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
        if (__FUNCTION__) {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
        } else {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
        }
        printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
        printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
        echo "<p> {$sql_query} </p>";
        exit;
    }
    while ($row = $result->fetch_array(MYSQLI_NUM)) {
        $url = $row[0];
        //  get actual status of indexdate, eventually other threads meanwhile indexed this URL
        $sql_query = "SELECT indexdate from " . $mysql_table_prefix . "sites where url='{$url}'";
        $res = $db_con->query($sql_query);
        $ind = $res->fetch_array(MYSQLI_NUM);
        if (strstr($ind[0], '0000')) {
            // immediately info for all other threads: now indexed by this thread
            $sql_query = "UPDATE " . $mysql_table_prefix . "sites set indexdate=now() where url='{$url}'";
            mysqltest();
            $db_con->query($sql_query);
            if ($debug > 0 && $db_con->errno) {
                printf("MySQL failure: %s\n", $db_con->error);
                echo "<br />Script aborted.";
                exit;
            }
            $depth = $row[2];
            $include = $row[3];
            $not_include = $row[4];
            $can_leave_domain = $row[5];
            $use_prefcharset = $row[6];
            if ($can_leave_domain == '') {
                $can_leave_domain = 0;
            }
            if ($depth == -1) {
                $soption = 'full';
            } else {
                $soption = 'level';
            }
            //  now index this erased site
            index_site($url, 1, $depth, $soption, $include, $not_include, $can_leave_domain, $use_robot, $use_nofollow, $cl, 1, $use_prefcharset);
        }
    }
    if ($clear == 1) {
        clean_resource($result, '19');
    }
    $ended = time();
    $consumed = $ended - $started;
    printConsumedReport('consumed', $cl, '0', $consumed);
    //printStandardReport('ErasedFinish',$command_line, '0');
    printStandardReport('ReindexFinish', $command_line, '0');
    create_footer();
}