mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
fix fatal errors. works with v0.9.6
This commit is contained in:
parent
1758f750fd
commit
e056b1eb70
@ -5,21 +5,21 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require dirname(__FILE__) . '/inc/cli.php';
|
require dirname(__FILE__) . '/inc/cli.php';
|
||||||
require 'inc/image.php';
|
require 'inc/image.php';
|
||||||
|
|
||||||
// move back to this directory
|
// move back to this directory
|
||||||
chdir(dirname(__FILE__));
|
chdir(dirname(__FILE__));
|
||||||
|
|
||||||
if(count($argv) != 2)
|
if(count($argv) != 2)
|
||||||
die("Usage: {$argv[0]} [file]\n");
|
die("Usage: {$argv[0]} [file]\n");
|
||||||
|
|
||||||
$file = $argv[1];
|
$file = $argv[1];
|
||||||
$extension = strtolower(substr($file, strrpos($file, '.') + 1));
|
$extension = strtolower(substr($file, strrpos($file, '.') + 1));
|
||||||
$out = tempnam($config['tmp'], 'thumb');
|
$out = tempnam($config['tmp'], 'thumb');
|
||||||
$count = 300;
|
$count = 300;
|
||||||
|
|
||||||
function benchmark($method) {
|
function benchmark($method) {
|
||||||
global $config, $file, $extension, $out, $count;
|
global $config, $file, $extension, $out, $count;
|
||||||
|
|
||||||
$config['thumb_method'] = $method;
|
$config['thumb_method'] = $method;
|
||||||
@ -44,9 +44,9 @@
|
|||||||
printf("Took %.2f seconds (%.2f/second; %.2f ms)\n", $end - $start, $rate = ($count / ($end - $start)), 1000 / $rate);
|
printf("Took %.2f seconds (%.2f/second; %.2f ms)\n", $end - $start, $rate = ($count / ($end - $start)), 1000 / $rate);
|
||||||
|
|
||||||
unlink($out);
|
unlink($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
benchmark('gd');
|
benchmark('gd');
|
||||||
benchmark('imagick');
|
benchmark('imagick');
|
||||||
benchmark('convert');
|
benchmark('convert');
|
||||||
|
|
||||||
|
@ -33,10 +33,6 @@ if(!getenv('TINYBOARD_PATH')) {
|
|||||||
putenv('TINYBOARD_PATH=' . getcwd());
|
putenv('TINYBOARD_PATH=' . getcwd());
|
||||||
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
|
||||||
require 'inc/template.php';
|
|
||||||
require 'inc/database.php';
|
|
||||||
require 'inc/user.php';
|
|
||||||
require 'inc/mod.php';
|
require 'inc/mod.php';
|
||||||
|
|
||||||
$mod = Array(
|
$mod = Array(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/php
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rebuild.php - rebuilds all static files
|
* 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();
|
get_httpd_privileges();
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
|
|
||||||
// parse command line
|
// parse command line
|
||||||
$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet'));
|
$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet'));
|
||||||
$options = Array();
|
$options = Array();
|
||||||
|
|
||||||
$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false);
|
$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false);
|
||||||
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']);
|
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']);
|
||||||
$options['quick'] = isset($opts['quick']);
|
$options['quick'] = isset($opts['quick']);
|
||||||
$options['full'] = isset($opts['full']) || isset($opts['f']);
|
$options['full'] = isset($opts['full']) || isset($opts['f']);
|
||||||
|
|
||||||
if(!$options['quiet'])
|
if(!$options['quiet'])
|
||||||
echo "== Tinyboard {$config['version']} ==\n";
|
echo "== Tinyboard {$config['version']} ==\n";
|
||||||
|
|
||||||
if(!$options['quiet'])
|
if(!$options['quiet'])
|
||||||
echo "Clearing template cache...\n";
|
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";
|
echo "Regenerating theme files...\n";
|
||||||
rebuildThemes('all');
|
rebuildThemes('all');
|
||||||
|
|
||||||
if(!$options['quiet'])
|
if(!$options['quiet'])
|
||||||
echo "Generating Javascript file...\n";
|
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'])
|
if($options['board'] && $board['uri'] != $options['board'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -95,11 +95,11 @@
|
|||||||
echo "Rebuilding #{$post['id']}...\n";
|
echo "Rebuilding #{$post['id']}...\n";
|
||||||
buildThread($post['id']);
|
buildThread($post['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$options['quiet'])
|
if(!$options['quiet'])
|
||||||
printf("Complete! Took %g seconds\n", microtime(true) - $start);
|
printf("Complete! Took %g seconds\n", microtime(true) - $start);
|
||||||
|
|
||||||
unset($board);
|
unset($board);
|
||||||
modLog('Rebuilt everything using tools/rebuild.php');
|
modLog('Rebuilt everything using tools/rebuild.php');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user