rebuild.php revision
This commit is contained in:
parent
ff697004b0
commit
a2d29860e6
@ -1,47 +1,56 @@
|
|||||||
#!/usr/bin/php
|
#!/usr/bin/php
|
||||||
<?php
|
<?php
|
||||||
error_reporting(0);
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
require 'inc/display.php';
|
||||||
require 'inc/template.php';
|
require 'inc/template.php';
|
||||||
require 'inc/database.php';
|
require 'inc/database.php';
|
||||||
require 'inc/user.php';
|
require 'inc/user.php';
|
||||||
require 'inc/mod.php';
|
require 'inc/mod.php';
|
||||||
error_reporting(E_ALL ^ E_DEPRECATED);
|
|
||||||
|
|
||||||
set_time_limit($config['mod']['rebuild_timelimit']);
|
set_time_limit($config['mod']['rebuild_timelimit']);
|
||||||
|
|
||||||
echo '== Tinyboard '.$config['version'].' =='."\n";
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
echo 'Rebuilding...'."\n";
|
|
||||||
|
|
||||||
if (!is_writable ("main.js")) {
|
echo "== Tinyboard {$config['version']} ==\n";
|
||||||
echo 'Dropping priviledges... (I can\'t operate as user, I need httpd rights)'."\n";
|
|
||||||
$filename = ".".rand().".".rand().".php";
|
if(!is_writable($config['file_script'])) {
|
||||||
echo 'Copying rebuilder...'."\n";
|
echo "Dropping priviledges... (I can't operate as user; I need PHP's rights.)\n";
|
||||||
copy($_SERVER['PHP_SELF'], $filename);
|
|
||||||
|
$filename = '.' . md5(rand()) . '.php';
|
||||||
|
|
||||||
|
echo "Copying rebuilder to web directory...\n";
|
||||||
|
copy(__FILE__, $filename);
|
||||||
chmod($filename, 0666);
|
chmod($filename, 0666);
|
||||||
echo 'Connecting...!'."\n\n";
|
|
||||||
|
|
||||||
// REPLACE http://0/Tinyboard/ WITH YOUR OWN PATH
|
if(preg_match('/^https?:\/\//', $config['root'])) {
|
||||||
passthru("curl -s -N http://0/Tinyboard/$filename");
|
$url = $config['root'] . $filename;
|
||||||
|
} else {
|
||||||
|
// assume localhost
|
||||||
|
$url = 'http://localhost' . $config['root'] . $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Downloading $url\n";
|
||||||
|
|
||||||
|
passthru('curl -s -N ' . escapeshellarg($url));
|
||||||
|
|
||||||
echo "\n".'Cleaning up afterwards...'."\n";
|
echo "\n".'Cleaning up afterwards...'."\n";
|
||||||
|
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
|
|
||||||
echo "Bye!\n";
|
echo "Bye!\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'Clearing template cache...'."\n";
|
echo "Clearing template cache...\n";
|
||||||
$twig = new Twig_Environment($loader, Array(
|
$twig = new Twig_Environment($loader, Array(
|
||||||
'cache' => "{$config['dir']['template']}/cache"
|
'cache' => "{$config['dir']['template']}/cache"
|
||||||
));
|
));
|
||||||
$twig->clearCacheFiles();
|
$twig->clearCacheFiles();
|
||||||
|
|
||||||
echo 'Regenerating theme files...'."\n";
|
echo "Regenerating theme files...\n";
|
||||||
rebuildThemes('all');
|
rebuildThemes('all');
|
||||||
|
|
||||||
echo 'Generating Javascript file...'."\n";
|
echo "Generating Javascript file...\n";
|
||||||
buildJavascript();
|
buildJavascript();
|
||||||
|
|
||||||
$boards = listBoards();
|
$boards = listBoards();
|
||||||
@ -50,7 +59,7 @@
|
|||||||
echo "Opening board /{$board['uri']}/...\n";
|
echo "Opening board /{$board['uri']}/...\n";
|
||||||
openBoard($board['uri']);
|
openBoard($board['uri']);
|
||||||
|
|
||||||
echo 'Creating index pages...'+"\n";
|
echo "Creating index pages...\n";
|
||||||
buildIndex();
|
buildIndex();
|
||||||
|
|
||||||
$query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error());
|
$query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error());
|
||||||
@ -59,9 +68,8 @@
|
|||||||
buildThread($post['id']);
|
buildThread($post['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo 'Complete!'."\n";
|
|
||||||
|
|
||||||
printf('Took %g seconds.'."\n", microtime(true) - $start);
|
printf("Complete! Took %g seconds\n", microtime(true) - $start);
|
||||||
|
|
||||||
|
// modLog('Rebuilt everything using tools/rebuild.php');
|
||||||
|
|
||||||
//modLog('Rebuilt everything using tools/rebuild.php');
|
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user