Market::Remove PHP Method

Remove() public method

public Remove ( $type, $name )
    public function Remove($type, $name)
    {
        function rrmdir($path)
        {
            return is_file($path) ? @unlink($path) : @array_map('rrmdir', glob($path . '/*')) == @rmdir($path);
        }
        rrmdir(BASE_PATH . '/' . $type . '/' . $name);
        echo formatJSEND("success", null);
    }

Usage Example

Exemplo n.º 1
0
require_once '../../common.php';
require_once 'class.market.php';
//////////////////////////////////////////////////////////////////
// Verify Session or Key
//////////////////////////////////////////////////////////////////
checkSession();
$market = new Market();
//////////////////////////////////////////////////////////////////
// Install
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'install') {
    if (checkAccess()) {
        $market->Install($_GET['type'], $_GET['name'], $_GET['repo']);
    }
}
//////////////////////////////////////////////////////////////////
// Remove
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'remove') {
    if (checkAccess()) {
        $market->Remove($_GET['type'], $_GET['name']);
    }
}
//////////////////////////////////////////////////////////////////
// Update
//////////////////////////////////////////////////////////////////
if ($_GET['action'] == 'update') {
    if (checkAccess()) {
        $market->Update($_GET['type'], $_GET['name']);
    }
}