Exemplo n.º 1
0
    }
    $link->commit();
    return true;
}
// drops a db, returns true if succeeds, false otherwise
function dropDb($db, $host, $user, $pass, $port)
{
    $drop_db_query = "DROP DATABASE {$db};";
    return executeQuery($drop_db_query, $host, $user, $pass, null, $port);
}
$config = parse_ini_file("uninstall.ini");
$success = true;
echo 'Uninstaller will fully remove the Kaltura software from your system.' . PHP_EOL;
echo 'Databases and any uploaded content will also be removed.' . PHP_EOL;
echo 'This action cannot be undone. Do you wish to continue? (y/N)' . PHP_EOL;
if (!getTrueFalse(false)) {
    echo 'Uninstallation was cancelled, uninstaller will now exit.' . PHP_EOL;
    die(0);
}
echo 'Stopping sphinx daemon... ';
if (execute($config['BASE_DIR'] . '/app/plugins/sphinx_search/scripts/watch.stop.sh')) {
    echo 'OK' . PHP_EOL;
} else {
    echo 'Failed' . PHP_EOL;
    $success = false;
}
echo 'Stopping sphinx... ';
if (execute($config['BASE_DIR'] . '/app/plugins/sphinx_search/scripts/searchd.sh stop')) {
    echo 'OK' . PHP_EOL;
} else {
    echo 'Failed' . PHP_EOL;
if (execute($config['BASE_DIR'] . '/dwh/setup/cleanup.sh')) {
    echo 'OK' . PHP_EOL;
} else {
    echo 'Failed' . PHP_EOL;
    $success = false;
}
//TODO: Kaltura user currently does not created
//echo 'Deleting kaltura user... ';
//if (execute('userdel kaltura')) {
//	echo 'OK'.PHP_EOL;
//} else {
//	echo 'Failed'.PHP_EOL;
//	$success = false;
//}
echo 'Would you like to drop the KalturaDB? (y/N)' . PHP_EOL;
if (getTrueFalse(true)) {
    foreach ($dbs_to_drop as $db) {
        if (isDbExist($db, $config['DB_HOST'], $config['DB_USER'], $config['DB_PASS'], $config['DB_PORT'])) {
            echo "Dropping '{$db}' database... ";
            if (dropDb($db, $config['DB_HOST'], $config['DB_USER'], $config['DB_PASS'], $config['DB_PORT'])) {
                echo 'OK' . PHP_EOL;
            } else {
                echo 'Failed' . PHP_EOL;
                $success = false;
            }
        }
    }
}
echo "Removing " . $config['BASE_DIR'] . "... ";
if (execute("rm -rf " . $config['BASE_DIR'])) {
    echo 'OK' . PHP_EOL;