mirror of
https://github.com/flarum/core.git
synced 2025-07-16 22:31:18 +02:00
Get rid of Compat extender
Now that we support any form of callable to be returned from the bootstrap.php files, it is no longer needed.
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Extend;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Container\Container;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is used to wrap old bootstrap.php closures (as used in versions up
|
|
||||||
* to 0.1.0-beta7) in the new Extender format.
|
|
||||||
*
|
|
||||||
* This gives extensions the chance to work with the new API without making any
|
|
||||||
* changes, and have some time to convert to the pure usage of extenders.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
class Compat
|
|
||||||
{
|
|
||||||
protected $callback;
|
|
||||||
|
|
||||||
public function __construct($callback)
|
|
||||||
{
|
|
||||||
$this->callback = $callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(Container $container)
|
|
||||||
{
|
|
||||||
$container->call($this->callback);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -12,7 +12,6 @@
|
|||||||
namespace Flarum\Extension;
|
namespace Flarum\Extension;
|
||||||
|
|
||||||
use Flarum\Database\Migrator;
|
use Flarum\Database\Migrator;
|
||||||
use Flarum\Extend\Compat;
|
|
||||||
use Flarum\Extension\Event\Disabled;
|
use Flarum\Extension\Event\Disabled;
|
||||||
use Flarum\Extension\Event\Disabling;
|
use Flarum\Extension\Event\Disabling;
|
||||||
use Flarum\Extension\Event\Enabled;
|
use Flarum\Extension\Event\Enabled;
|
||||||
@@ -286,14 +285,7 @@ class ExtensionManager
|
|||||||
if ($this->filesystem->exists($bootstrapper)) {
|
if ($this->filesystem->exists($bootstrapper)) {
|
||||||
$extenders = require $bootstrapper;
|
$extenders = require $bootstrapper;
|
||||||
|
|
||||||
if (is_array($extenders)) {
|
return (array) $extenders;
|
||||||
return $extenders;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assume that the extension has not yet switched to the new
|
|
||||||
// bootstrap.php format, and wrap the callback in a Compat
|
|
||||||
// extender.
|
|
||||||
return [new Compat($extenders)];
|
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user