get_httpd_privileges() function for CLI scripts
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
#!/usr/bin/php
|
||||
<?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 dirname(__FILE__) . '/inc/cli.php';
|
||||
|
||||
$mod = Array(
|
||||
@@ -21,31 +14,7 @@
|
||||
echo "== Tinyboard {$config['version']} ==\n";
|
||||
|
||||
if(!is_writable($config['file_script'])) {
|
||||
echo "Dropping priviledges... (I can't operate as user; I need PHP's rights.)\n";
|
||||
|
||||
$filename = '.' . md5(rand()) . '.php';
|
||||
|
||||
echo "Copying rebuilder to web directory...\n";
|
||||
copy(__FILE__, $filename);
|
||||
chmod($filename, 0666);
|
||||
|
||||
if(preg_match('/^https?:\/\//', $config['root'])) {
|
||||
$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";
|
||||
|
||||
unlink($filename);
|
||||
|
||||
echo "Bye!\n";
|
||||
exit;
|
||||
get_httpd_privileges();
|
||||
}
|
||||
|
||||
echo "Clearing template cache...\n";
|
||||
|
Reference in New Issue
Block a user