CC-2225 airtime-clean-storage doesnt work

Forced the user to run the script as superuser.
This commit is contained in:
Paul Baranowski 2011-04-25 18:34:03 -04:00
parent 78ed3e2822
commit 219598ac06
2 changed files with 15 additions and 6 deletions

View file

@ -59,7 +59,10 @@ function airtime_empty_db($db)
Playlist::deleteAll();
echo " * Clearing files table...".PHP_EOL;
StoredFile::deleteAll();
$result = StoredFile::deleteAll();
if (PEAR::isError($result)) {
echo $result->getMessage().PHP_EOL;
}
}
@ -88,6 +91,12 @@ if (isset($opts->h)) {
exit;
}
// Need to check that we are superuser before running this.
if (exec("whoami") != "root") {
echo PHP_EOL."You must be root to use this script.".PHP_EOL.PHP_EOL;
exit(1);
}
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);