|
|
@ -1,5 +1,6 @@ |
|
|
|
#!/usr/bin/php |
|
|
|
<?php |
|
|
|
|
|
|
|
/* |
|
|
|
* rebuild.php - rebuilds all static files |
|
|
|
* |
|
|
@ -18,46 +19,45 @@ |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
require dirname(__FILE__) . '/inc/cli.php'; |
|
|
|
require dirname(__FILE__) . '/inc/cli.php'; |
|
|
|
|
|
|
|
if(!is_writable($config['file_script'])) { |
|
|
|
if(!is_writable($config['file_script'])) { |
|
|
|
get_httpd_privileges(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$start = microtime(true); |
|
|
|
$start = microtime(true); |
|
|
|
|
|
|
|
// parse command line |
|
|
|
$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet')); |
|
|
|
$options = Array(); |
|
|
|
// parse command line |
|
|
|
$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet')); |
|
|
|
$options = Array(); |
|
|
|
|
|
|
|
$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false); |
|
|
|
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']); |
|
|
|
$options['quick'] = isset($opts['quick']); |
|
|
|
$options['full'] = isset($opts['full']) || isset($opts['f']); |
|
|
|
$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false); |
|
|
|
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']); |
|
|
|
$options['quick'] = isset($opts['quick']); |
|
|
|
$options['full'] = isset($opts['full']) || isset($opts['f']); |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
if(!$options['quiet']) |
|
|
|
echo "== Tinyboard {$config['version']} ==\n"; |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
if(!$options['quiet']) |
|
|
|
echo "Clearing template cache...\n"; |
|
|
|
$twig = new Twig_Environment($loader, Array( |
|
|
|
'cache' => "{$config['dir']['template']}/cache" |
|
|
|
)); |
|
|
|
$twig->clearCacheFiles(); |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
load_twig(); |
|
|
|
$twig->clearCacheFiles(); |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
echo "Regenerating theme files...\n"; |
|
|
|
rebuildThemes('all'); |
|
|
|
rebuildThemes('all'); |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
if(!$options['quiet']) |
|
|
|
echo "Generating Javascript file...\n"; |
|
|
|
buildJavascript(); |
|
|
|
buildJavascript(); |
|
|
|
|
|
|
|
$main_js = $config['file_script']; |
|
|
|
$main_js = $config['file_script']; |
|
|
|
|
|
|
|
$boards = listBoards(); |
|
|
|
$boards = listBoards(); |
|
|
|
|
|
|
|
foreach($boards as &$board) { |
|
|
|
foreach($boards as &$board) { |
|
|
|
if($options['board'] && $board['uri'] != $options['board']) |
|
|
|
continue; |
|
|
|
|
|
|
@ -95,11 +95,11 @@ |
|
|
|
echo "Rebuilding #{$post['id']}...\n"; |
|
|
|
buildThread($post['id']); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(!$options['quiet']) |
|
|
|
if(!$options['quiet']) |
|
|
|
printf("Complete! Took %g seconds\n", microtime(true) - $start); |
|
|
|
|
|
|
|
unset($board); |
|
|
|
modLog('Rebuilt everything using tools/rebuild.php'); |
|
|
|
unset($board); |
|
|
|
modLog('Rebuilt everything using tools/rebuild.php'); |
|
|
|
|
|
|
|