diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-03-15 01:44:29 +1100 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-03-15 01:44:29 +1100 |
| commit | 64c1f6821c90297cf3d1c4b8a4bbec6fe4449016 (patch) | |
| tree | 56942e328c37a2dfd63b4dca0009f08b2fae15dd /tools/rebuild.php | |
| parent | 2482723ff2f567c4b041f9f0840f34049f0881b7 (diff) | |
get_httpd_privileges() function for CLI scripts
Diffstat (limited to 'tools/rebuild.php')
| -rwxr-xr-x | tools/rebuild.php | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/tools/rebuild.php b/tools/rebuild.php index 56f94aa9..0dfd9899 100755 --- a/tools/rebuild.php +++ b/tools/rebuild.php @@ -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"; |
