mirror of
https://github.com/flarum/core.git
synced 2025-08-07 00:47:00 +02:00
Apply fixes from StyleCI
[ci skip] [skip ci]
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
<?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\Database;
|
||||
|
||||
use Flarum\Extension\Extension;
|
||||
use Flarum\Foundation\Application;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class MigrationSourceRepository
|
||||
{
|
||||
@@ -27,7 +33,9 @@ class MigrationSourceRepository
|
||||
|
||||
public function extension(Extension $extension): ?array
|
||||
{
|
||||
if (! $extension->hasMigrations()) return [];
|
||||
if (! $extension->hasMigrations()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $extension->getMigrations();
|
||||
}
|
||||
@@ -36,12 +44,12 @@ class MigrationSourceRepository
|
||||
{
|
||||
// We read every file from the latest major/minor version migrations directory.
|
||||
// Including the create_<table>_table statements.
|
||||
$files = glob(__DIR__ . '/../../migrations/' . $this->installedVersion(true) . '/[0-9_]{15}_*.php');
|
||||
$files = glob(__DIR__.'/../../migrations/'.$this->installedVersion(true).'/[0-9_]{15}_*.php');
|
||||
|
||||
// Sort by timestamp.
|
||||
sort($files);
|
||||
|
||||
$create = glob(__DIR__ . '/../../migrations/' . $this->installedVersion(true) . '/create_*.php');
|
||||
$create = glob(__DIR__.'/../../migrations/'.$this->installedVersion(true).'/create_*.php');
|
||||
|
||||
return array_merge($create, $files);
|
||||
}
|
||||
@@ -51,7 +59,7 @@ class MigrationSourceRepository
|
||||
$files = [];
|
||||
$add = false;
|
||||
|
||||
$directories = glob(__DIR__ . '/../../migrations/', GLOB_ONLYDIR);
|
||||
$directories = glob(__DIR__.'/../../migrations/', GLOB_ONLYDIR);
|
||||
sort($directories, SORT_NATURAL);
|
||||
|
||||
// Upgrade
|
||||
@@ -65,7 +73,7 @@ class MigrationSourceRepository
|
||||
if ($add) {
|
||||
// Selectively add files, but only include those matching the format YYYY_MM_DD_HHIISS_<something>.php
|
||||
// This excludes the create_<table>_table.
|
||||
$files = array_merge($files, glob(__DIR__ . "/../../migrations/$directory/[0-9_]{15}_*.php"));
|
||||
$files = array_merge($files, glob(__DIR__."/../../migrations/$directory/[0-9_]{15}_*.php"));
|
||||
}
|
||||
|
||||
// Once we found the version that is installed, we can quit.
|
||||
|
@@ -212,7 +212,8 @@ class Migrator
|
||||
public function getMigrationFiles(string $path, Extension $extension = null): array
|
||||
{
|
||||
$files = $extension ? $this->source->extension($extension) : $this->source->flarum();
|
||||
dd($files);
|
||||
dd($files);
|
||||
|
||||
return array_map(function ($file) {
|
||||
return str_replace('.php', '', basename($file));
|
||||
}, $files);
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Flarum\Extension;
|
||||
|
||||
use Flarum\Database\Migrator;
|
||||
use Flarum\Extend\LifecycleInterface;
|
||||
use Flarum\Extension\Exception\ExtensionBootError;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
|
Reference in New Issue
Block a user