-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_db.php
55 lines (38 loc) · 1.24 KB
/
update_db.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?
require_once("keywords.php");
require_once("utf8.php");
require_once("string.php");
require_once("db.php");
require_once("xmlparse.php");
require_once("html_entities.php");
require_once("lemonad.php");
require_once("html.php");
require_once("date.php");
fetch_lemonad_changes();
# KOMPILERAR FÖRSTASIDAN
$fp = new FrontPageHtml();
$html = $fp->generate(20);
save_data($html, "cache/frontpage");
# HÄMTNING AV FLÖDE FRÅN DEV-BLOGG
$entries = parse_atom(file_get_contents("http://blogwalk-dev.blogspot.com/atom.xml"));
if($entries !== false)
save_data($entries, "cache/devblog");
else
echo "Error fetching blogwalk-dev entries\n";
# SPARAR DE NYASTE BLOGGARNA
save_data(generate_latestblogs_list(7), "cache/newestblogs");
# GENERERAR STATISTIK
require_once("generate_stats.php");
# CACHE-TÖMNING
# time är i dessa tabeller ett heltal, inte datetime
$time = time() - 3600 * 24 * 7;
query("DELETE FROM cache_similarposts WHERE time < $time");
query("OPTIMIZE TABLE cache_similarposts");
$time = time() - 3600 * 24 * 2;
query("DELETE FROM cache_locationblogs WHERE time < $time");
query("OPTIMIZE TABLE cache_locationblogs");
# LOG-TÖMNING
$time = time() - 3600 * 24 * 28;
query("DELETE FROM log WHERE time < $time");
query("OPTIMIZE TABLE log");
?>