mirror of
https://github.com/flarum/core.git
synced 2025-08-09 18:07:02 +02:00
wip
This commit is contained in:
committed by
David Wheatley
parent
6006ad00a2
commit
731fae666f
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -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;
|
|
||||||
}
|
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -14,7 +14,6 @@ use Flarum\Foundation\Config;
|
|||||||
use Flarum\Foundation\ErrorHandling\Registry;
|
use Flarum\Foundation\ErrorHandling\Registry;
|
||||||
use Flarum\Foundation\ErrorHandling\Reporter;
|
use Flarum\Foundation\ErrorHandling\Reporter;
|
||||||
use Flarum\Foundation\Paths;
|
use Flarum\Foundation\Paths;
|
||||||
use Flarum\Queue\Driver\DriverInterface;
|
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
use Illuminate\Contracts\Cache\Factory as CacheFactory;
|
use Illuminate\Contracts\Cache\Factory as CacheFactory;
|
||||||
use Illuminate\Contracts\Container\Container;
|
use Illuminate\Contracts\Container\Container;
|
||||||
@@ -62,7 +61,7 @@ class QueueServiceProvider extends AbstractServiceProvider
|
|||||||
|
|
||||||
$driverClass = Arr::get($drivers, $driverName);
|
$driverClass = Arr::get($drivers, $driverName);
|
||||||
|
|
||||||
/** @var DriverInterface $driver */
|
/** @var Queue $driver */
|
||||||
$driver = $container->make($driverClass);
|
$driver = $container->make($driverClass);
|
||||||
$driver->setContainer($container);
|
$driver->setContainer($container);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user