From ff697004b08630d16d55f699f353147dc7e60f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=81abanowski?= Date: Fri, 2 Mar 2012 22:41:04 +0100 Subject: [PATCH] a command-line tool for rebuilding js, html, etc.; based on mod.php; also introduced dynamic main.js names in order to prevent aggressive caching, based on filemtime of templates/main.js --- tools/rebuild.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tools/rebuild.php diff --git a/tools/rebuild.php b/tools/rebuild.php new file mode 100755 index 00000000..8be13f27 --- /dev/null +++ b/tools/rebuild.php @@ -0,0 +1,67 @@ +#!/usr/bin/php + "{$config['dir']['template']}/cache" + )); + $twig->clearCacheFiles(); + + echo 'Regenerating theme files...'."\n"; + rebuildThemes('all'); + + echo 'Generating Javascript file...'."\n"; + buildJavascript(); + + $boards = listBoards(); + + foreach($boards as &$board) { + echo "Opening board /{$board['uri']}/...\n"; + openBoard($board['uri']); + + echo 'Creating index pages...'+"\n"; + buildIndex(); + + $query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); + while($post = $query->fetch()) { + echo "Rebuilding #{$post['id']}...\n"; + buildThread($post['id']); + } + } + echo 'Complete!'."\n"; + + printf('Took %g seconds.'."\n", microtime(true) - $start); + + //modLog('Rebuilt everything using tools/rebuild.php'); +?>