mirror of
https://github.com/flarum/framework.git
synced 2025-04-01 05:05:14 +08:00
![dependabot[bot]](/assets/img/avatar_default.png)
* chore(deps): bump glob-parent in /extensions/emoji/js Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 3.1.0 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Apply fixes from StyleCI [ci skip] [skip ci] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: StyleCI Bot <bot@styleci.io>
66 lines
1.6 KiB
PHP
Executable File
66 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* For detailed copyright and license information, please view the
|
|
* LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\PackageManager\Command;
|
|
|
|
use Flarum\PackageManager\Composer\ComposerAdapter;
|
|
use Flarum\PackageManager\Exception\ComposerRequireFailedException;
|
|
use Flarum\PackageManager\WhyNotValidator;
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
|
use Symfony\Component\Console\Input\StringInput;
|
|
|
|
class WhyNotHandler
|
|
{
|
|
/**
|
|
* @var ComposerAdapter
|
|
*/
|
|
protected $composer;
|
|
|
|
/**
|
|
* @var WhyNotValidator
|
|
*/
|
|
protected $validator;
|
|
|
|
/**
|
|
* @var Dispatcher
|
|
*/
|
|
protected $events;
|
|
|
|
public function __construct(ComposerAdapter $composer, WhyNotValidator $validator, Dispatcher $events)
|
|
{
|
|
$this->composer = $composer;
|
|
$this->validator = $validator;
|
|
$this->events = $events;
|
|
}
|
|
|
|
/**
|
|
* @throws \Flarum\User\Exception\PermissionDeniedException
|
|
* @throws \Exception
|
|
*/
|
|
public function handle(WhyNot $command)
|
|
{
|
|
$command->actor->assertAdmin();
|
|
|
|
$this->validator->assertValid([
|
|
'package' => $command->package,
|
|
'version' => $command->version
|
|
]);
|
|
|
|
$output = $this->composer->run(
|
|
new StringInput("why-not $command->package $command->version")
|
|
);
|
|
|
|
if ($output->getExitCode() !== 0) {
|
|
throw new ComposerRequireFailedException($command->package, $output->getContents());
|
|
}
|
|
|
|
return $output->getContents();
|
|
}
|
|
}
|