1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00
This commit is contained in:
Daniel Klabbers
2021-07-31 23:51:52 +02:00
committed by David Wheatley
parent 6006ad00a2
commit 731fae666f
5 changed files with 1 additions and 98 deletions

View File

@@ -1,28 +0,0 @@
<?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\Queue\Driver;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Database\ConnectionInterface;
class DatabaseQueue extends Driver
{
public function build(): Queue
{
$queue = new \Illuminate\Queue\DatabaseQueue(
$this->container->make(ConnectionInterface::class),
'queue_jobs'
);
$queue->setContainer($this->container);
return $queue;
}
}

View File

@@ -1,24 +0,0 @@
<?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\Queue\Driver;
use Illuminate\Contracts\Container\Container;
abstract class Driver implements DriverInterface
{
protected ?Container $container = null;
public function setContainer(Container $container): DriverInterface
{
$this->container = $container;
return $this;
}
}

View File

@@ -1,20 +0,0 @@
<?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\Queue\Driver;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Queue\Queue;
interface DriverInterface
{
public function build(): Queue;
public function setContainer(Container $container): self;
}

View File

@@ -1,24 +0,0 @@
<?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\Queue\Driver;
use Illuminate\Contracts\Queue\Queue;
class SyncQueue extends Driver
{
public function build(): Queue
{
$queue = new \Illuminate\Queue\SyncQueue();
$queue->setContainer($this->container);
return $queue;
}
}

View File

@@ -14,7 +14,6 @@ use Flarum\Foundation\Config;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\Paths;
use Flarum\Queue\Driver\DriverInterface;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Cache\Factory as CacheFactory;
use Illuminate\Contracts\Container\Container;
@@ -62,7 +61,7 @@ class QueueServiceProvider extends AbstractServiceProvider
$driverClass = Arr::get($drivers, $driverName);
/** @var DriverInterface $driver */
/** @var Queue $driver */
$driver = $container->make($driverClass);
$driver->setContainer($container);