本文整理匯總了PHP中Pagekit\Application::package方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::package方法的具體用法?PHP Application::package怎麽用?PHP Application::package使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pagekit\Application
的用法示例。
在下文中一共展示了Application::package方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: uninstall
/**
* @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));
}
}
}
示例2: checkFramework
/**
* @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;
}
示例3: extensionsAction
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'))]];
}
示例4: loadPackage
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.'));
}
}