Airship\Cabin\Bridge\Landing\Skyport::removePackage PHP Method

removePackage() public method

Trigger the package uninstall process.
public removePackage ( )
    public function removePackage()
    {
        $expected = ['package', 'supplier', 'type'];
        if (!\Airship\all_keys_exist($expected, $_POST)) {
            \Airship\json_response(['status' => 'ERROR', 'message' => \__('Incomplete request.')]);
        }
        if ($this->skyport->isLocked()) {
            $locked = true;
            if ($this->skyport->isPasswordLocked() && !empty($_POST['password'])) {
                $password = new HiddenString($_POST['password']);
                if ($this->skyport->tryUnlockPassword($password)) {
                    $_SESSION['airship_install_lock_override'] = true;
                    $locked = false;
                }
                unset($password);
            }
            if ($locked) {
                if ($this->skyport->isPasswordLocked()) {
                    \Airship\json_response(['status' => 'PROMPT', 'message' => \__('The skyport is locked. To unlock the skyport, please provide the password.')]);
                }
                \Airship\json_response(['status' => 'ERROR', 'message' => \__('The skyport is locked. You cannot install packages from the web interface.')]);
            }
        }
        try {
            $filter = new SkyportFilter();
            $post = $filter($_POST);
        } catch (\TypeError $ex) {
            $this->log("Input violation", LogLevel::ALERT, \Airship\throwableToArray($ex));
            \Airship\json_response(['status' => 'ERROR', 'message' => 'Type Error']);
            return;
        }
        $output = $this->skyport->forceRemoval($post['type'], $post['supplier'], $post['package']);
        \Airship\json_response(['status' => 'OK', 'message' => $output]);
    }