mirror of
https://github.com/flarum/core.git
synced 2025-09-07 14:40:52 +02:00
feat: misc additions
- Detect extensions that didn't update between updates - Add composer why not command where approriate (when extension didn't update, when major update failed) - Detect incompatible extensions in major update failure and show the extensions in the frontend - Create last update run setting value which holds the state of the latest update runs - Other fixes
This commit is contained in:
47
extensions/package-manager/src/Api/Controller/WhyNotController.php
Executable file
47
extensions/package-manager/src/Api/Controller/WhyNotController.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?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\Api\Controller;
|
||||
|
||||
use Flarum\Bus\Dispatcher;
|
||||
use Flarum\Http\RequestUtil;
|
||||
use Flarum\PackageManager\Command\WhyNot;
|
||||
use Illuminate\Support\Arr;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class WhyNotController implements RequestHandlerInterface
|
||||
{
|
||||
/**
|
||||
* @var Dispatcher
|
||||
*/
|
||||
protected $bus;
|
||||
|
||||
public function __construct(Dispatcher $bus)
|
||||
{
|
||||
$this->bus = $bus;
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$actor = RequestUtil::getActor($request);
|
||||
$package = Arr::get($request->getParsedBody(), 'data.package', '');
|
||||
$version = Arr::get($request->getParsedBody(), 'data.version', '*');
|
||||
|
||||
$whyNot = $this->bus->dispatch(
|
||||
new WhyNot($actor, $package, $version)
|
||||
);
|
||||
|
||||
return new JsonResponse([
|
||||
'data' => compact('whyNot')
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user