/** * @param array $uninstall * @return bool */ public function uninstall($uninstall) { foreach ((array) $uninstall as $name) { if (!($package = App::package($name))) { throw new \RuntimeException(__('Unable to find "%name%".', ['%name%' => $name])); } $this->disable($package); $this->getScripts($package)->uninstall(); App::config('system')->remove('packages.' . $package->get('module')); if ($this->composer->isInstalled($package->getName())) { $this->composer->uninstall($package->getName()); } else { if (!($path = $package->get('path'))) { throw new \RuntimeException(__('Package path is missing.')); } $this->output->writeln(__("Removing package folder.")); App::file()->delete($path); @rmdir(dirname($path)); } } }
/** * @return bool|string */ public function checkFramework() { if (!($package = App::package('bixie/pk-framework'))) { return __('Please install the Bixie Framework.'); } if (!($module = App::module('bixie/pk-framework'))) { return __('Please enable the Bixie Framework.'); } if (version_compare(self::REQUIRED_FRAMEWORK_VERSION, $package->get('version')) == 1) { return __('Please update the Bixie Framework to version %version%.', ['%version%' => self::REQUIRED_FRAMEWORK_VERSION]); } return true; }
public function extensionsAction() { return ['$view' => ['title' => __('Marketplace'), 'name' => 'installer:views/marketplace.php'], '$data' => ['title' => 'Extensions', 'type' => 'pagekit-extension', 'api' => App::get('system.api'), 'installed' => array_values(App::package()->all('pagekit-extension'))]]; }
protected function loadPackage($file) { try { if (is_file($file)) { $zip = new \ZipArchive(); if ($zip->open($file) === true) { $json = $zip->getFromName('composer.json'); if ($json) { $package = App::package()->load($json); $extra = $package->get('extra'); if (isset($extra['image'])) { unset($extra['image']); $package->set('extra', $extra); } $package->set('shasum', sha1_file($file)); } $zip->close(); } } if (isset($package)) { return $package; } App::abort(400); } catch (\Exception $e) { App::abort(400, __('Can\'t load json file from package.')); } }