Ejemplo n.º 1
0
 * @license http://www.gnu.org/licenses/gpl.txt
 */
require_once dirname(__FILE__) . '/AirtimeIni.php';
require_once dirname(__FILE__) . '/AirtimeInstall.php';
// Need to check that we are superuser before running this.
AirtimeInstall::ExitIfNotRoot();
if (!file_exists(AirtimeIni::CONF_FILE_AIRTIME)) {
    echo PHP_EOL . "Airtime config file '" . AirtimeIni::CONF_FILE_AIRTIME . "' does not exist." . PHP_EOL;
    echo "Most likely this means that Airtime is not installed, so there is nothing to do." . PHP_EOL . PHP_EOL;
    exit;
}
require_once AirtimeInstall::GetAirtimeSrcDir() . '/application/configs/constants.php';
require_once AirtimeInstall::GetAirtimeSrcDir() . '/application/configs/conf.php';
echo PHP_EOL;
echo "* Uninstalling Airtime " . AIRTIME_VERSION . PHP_EOL;
AirtimeInstall::UninstallPhpCode();
//------------------------------------------------------------------------
// Delete the database
// Note: Do not put a call to AirtimeInstall::DbConnect()
// before this function, even if you called $CC_DBC->disconnect(), there will
// still be a connection to the database and you wont be able to delete it.
//------------------------------------------------------------------------
echo " * Dropping the database '" . $CC_CONFIG['dsn']['database'] . "'..." . PHP_EOL;
// check if DB exists
$command = "echo \"DROP DATABASE IF EXISTS " . $CC_CONFIG['dsn']['database'] . "\" | su postgres -c psql";
@exec($command, $output, $dbDeleteFailed);
//------------------------------------------------------------------------
// Delete DB tables
// We do this if dropping the database fails above.
//------------------------------------------------------------------------
if ($dbDeleteFailed) {