1
0
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:
SychO9
2021-11-23 23:02:56 +01:00
parent c8b8dacb67
commit f4bb8158ef
31 changed files with 1877 additions and 1007 deletions

View 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')
]);
}
}