From 09ef51996a37fc34a70ab560fa5a97b1490da588 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 13 Sep 2014 16:36:16 +0000 Subject: [PATCH] Protect some boards --- expire.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/expire.php b/expire.php index f702fbcb..5c3a9d35 100644 --- a/expire.php +++ b/expire.php @@ -4,7 +4,7 @@ include "inc/functions.php"; if (!(php_sapi_name() == "cli")) { die('nope'); } - +$protected = array('burgers', 'cow', 'wilno'); $q = query("SELECT uri FROM boards"); $boards = $q->fetchAll(PDO::FETCH_COLUMN); $now = new DateTime(); @@ -14,6 +14,10 @@ $mod_ago = (new DateTime)->sub(new DateInterval('P14D')); // Find out the last activity for our board $delete = array(); foreach($boards as $board) { + if (in_array($board, $protected)) { + continue; + } + // last post $query = prepare(sprintf("SELECT MAX(time) AS time FROM posts_%s", $board)); $query->execute(); @@ -125,6 +129,7 @@ foreach($delete as $i => $d){ // Delete entire board directory rrmdir($board['uri'] . '/'); + rrmdir('static/banners/' . $board['uri']); cache::delete('board_' . $board['uri']); _syslog(LOG_NOTICE, "Board deleted: {$board['uri']}"); @@ -140,3 +145,4 @@ cache::delete('all_boards_uri'); cache::delete('all_boards'); rebuildThemes('boards'); $query = query('DELETE FROM board_create WHERE uri NOT IN (SELECT uri FROM boards);') or error(db_error()); +file_get_contents('https://8chan.co/listboards.php');