本文整理汇总了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.'));
}
}