mirror of
https://github.com/flarum/core.git
synced 2025-07-17 06:41:21 +02:00
Restructure Flarum\Database namespace
This commit is contained in:
@@ -16,7 +16,7 @@ use Flarum\Debug\Console\CacheClearCommand;
|
|||||||
use Flarum\Debug\Console\InfoCommand;
|
use Flarum\Debug\Console\InfoCommand;
|
||||||
use Flarum\Foundation\AbstractServer;
|
use Flarum\Foundation\AbstractServer;
|
||||||
use Flarum\Install\Console\InstallCommand;
|
use Flarum\Install\Console\InstallCommand;
|
||||||
use Flarum\Update\Console\MigrateCommand;
|
use Flarum\Database\Console\MigrateCommand;
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
|
|
||||||
class Server extends AbstractServer
|
class Server extends AbstractServer
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Flarum\Update\Console;
|
namespace Flarum\Database\Console;
|
||||||
|
|
||||||
use Flarum\Console\AbstractCommand;
|
use Flarum\Console\AbstractCommand;
|
||||||
use Illuminate\Contracts\Container\Container;
|
use Illuminate\Contracts\Container\Container;
|
@@ -12,7 +12,6 @@
|
|||||||
namespace Flarum\Database;
|
namespace Flarum\Database;
|
||||||
|
|
||||||
use Flarum\Foundation\AbstractServiceProvider;
|
use Flarum\Foundation\AbstractServiceProvider;
|
||||||
use Flarum\Foundation\Application;
|
|
||||||
use Illuminate\Database\ConnectionResolver;
|
use Illuminate\Database\ConnectionResolver;
|
||||||
use Illuminate\Database\Connectors\ConnectionFactory;
|
use Illuminate\Database\Connectors\ConnectionFactory;
|
||||||
use PDO;
|
use PDO;
|
||||||
@@ -46,14 +45,6 @@ class DatabaseServiceProvider extends AbstractServiceProvider
|
|||||||
});
|
});
|
||||||
|
|
||||||
$this->app->alias('Illuminate\Database\ConnectionResolverInterface', 'db');
|
$this->app->alias('Illuminate\Database\ConnectionResolverInterface', 'db');
|
||||||
|
|
||||||
$this->app->singleton('Flarum\Database\MigrationRepositoryInterface', function ($app) {
|
|
||||||
return new DatabaseMigrationRepository($app['db'], 'migrations');
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->app->bind(MigrationCreator::class, function (Application $app) {
|
|
||||||
return new MigrationCreator($app->make('Illuminate\Filesystem\Filesystem'), $app->basePath());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
32
src/Database/MigrationServiceProvider.php
Normal file
32
src/Database/MigrationServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?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\Database;
|
||||||
|
|
||||||
|
use Flarum\Foundation\AbstractServiceProvider;
|
||||||
|
use Flarum\Foundation\Application;
|
||||||
|
|
||||||
|
class MigrationServiceProvider extends AbstractServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->app->singleton('Flarum\Database\MigrationRepositoryInterface', function ($app) {
|
||||||
|
return new DatabaseMigrationRepository($app['db'], 'migrations');
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->app->bind(MigrationCreator::class, function (Application $app) {
|
||||||
|
return new MigrationCreator($app->make('Illuminate\Filesystem\Filesystem'), $app->basePath());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -14,7 +14,7 @@ namespace Flarum\Update\Controller;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Flarum\Foundation\Application;
|
use Flarum\Foundation\Application;
|
||||||
use Flarum\Http\Controller\ControllerInterface;
|
use Flarum\Http\Controller\ControllerInterface;
|
||||||
use Flarum\Update\Console\MigrateCommand;
|
use Flarum\Database\Console\MigrateCommand;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Symfony\Component\Console\Input\StringInput;
|
use Symfony\Component\Console\Input\StringInput;
|
||||||
use Symfony\Component\Console\Output\StreamOutput;
|
use Symfony\Component\Console\Output\StreamOutput;
|
||||||
|
Reference in New Issue
Block a user