Example #1
0
function refresh_cache($log = true)
{
    // 	$cache_files = array('list_articles');
    // 	for($n=0; $n < count($cache_files); $n++) {
    // 		$file = CACHE_DIR.'/'.$cache_files[$n].'.spc';
    if (file_exists(CACHE_DIR . '/list_articles.spc')) {
        //			unlink($file);
        touch($file, time() - 44444);
    }
    // 	}
    sleep(1);
    $start = time();
    // 	$feeds = list_feeds();
    $articles = list_articles();
    if ($log) {
        log_cache_refresh($start, time());
    }
    return true;
}
Example #2
0
        $feeds = array();
        $feeds_d = array();
        $feeds_q = sql_get_array("SELECT * FROM feeds;");
        for ($n = 0; $n < count($feeds_q); $n++) {
            $feed = $feeds_q[$n];
            if ($feed['approved'] == 1) {
                $feeds[] = $feed['url'];
            }
            $feeds_d[] = $feed;
        }
        cache(serialize($feeds), $feeds_ch);
        cache(serialize($feeds_d), $feeds_d_ch);
        sleep(1);
        refresh_cache(false);
        sql_close();
        log_cache_refresh($start_caching, time());
        /* We have been working hard, we should sleep now :)  */
        if (!isset($_GET['force'])) {
            sleep(3600);
            $n++;
        } else {
            die;
        }
    } while (true);
}
?>
<html>
	<head>
		<title>Planetoid cron</title>
		<style>
			body {padding:50px;background:#fff;font-size:1em;}