mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Rename Common\DbMigration
-> DbMigrationStep
This commit is contained in:
parent
2657f032dc
commit
ce89d4a7cb
@ -7,7 +7,7 @@ namespace Icinga\Application\Hook\Common;
|
|||||||
use ipl\Sql\Connection;
|
use ipl\Sql\Connection;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
class DbMigration
|
class DbMigrationStep
|
||||||
{
|
{
|
||||||
/** @var string The sql string to be executed */
|
/** @var string The sql string to be executed */
|
||||||
protected $query;
|
protected $query;
|
||||||
@ -65,7 +65,7 @@ class DbMigration
|
|||||||
*
|
*
|
||||||
* @param ?string $description
|
* @param ?string $description
|
||||||
*
|
*
|
||||||
* @return DbMigration
|
* @return DbMigrationStep
|
||||||
*/
|
*/
|
||||||
public function setDescription(?string $description): self
|
public function setDescription(?string $description): self
|
||||||
{
|
{
|
@ -9,7 +9,7 @@ use DateTime;
|
|||||||
use DirectoryIterator;
|
use DirectoryIterator;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Icinga\Application\ClassLoader;
|
use Icinga\Application\ClassLoader;
|
||||||
use Icinga\Application\Hook\Common\DbMigration;
|
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Application\Modules\Module;
|
use Icinga\Application\Modules\Module;
|
||||||
@ -51,7 +51,7 @@ abstract class MigrationHook implements Countable
|
|||||||
|
|
||||||
public const ALL_MIGRATIONS = 'all-migrations';
|
public const ALL_MIGRATIONS = 'all-migrations';
|
||||||
|
|
||||||
/** @var ?array<string, DbMigration> All pending database migrations of this hook */
|
/** @var ?array<string, DbMigrationStep> All pending database migrations of this hook */
|
||||||
protected $migrations;
|
protected $migrations;
|
||||||
|
|
||||||
/** @var ?string The current version of this hook */
|
/** @var ?string The current version of this hook */
|
||||||
@ -141,7 +141,7 @@ abstract class MigrationHook implements Countable
|
|||||||
/**
|
/**
|
||||||
* Get all the pending migrations of this hook
|
* Get all the pending migrations of this hook
|
||||||
*
|
*
|
||||||
* @return DbMigration[]
|
* @return DbMigrationStep[]
|
||||||
*/
|
*/
|
||||||
public function getMigrations(): array
|
public function getMigrations(): array
|
||||||
{
|
{
|
||||||
@ -159,7 +159,7 @@ abstract class MigrationHook implements Countable
|
|||||||
*
|
*
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* @return DbMigration[]
|
* @return DbMigrationStep[]
|
||||||
*/
|
*/
|
||||||
public function getLatestMigrations(int $limit): array
|
public function getLatestMigrations(int $limit): array
|
||||||
{
|
{
|
||||||
@ -282,7 +282,7 @@ abstract class MigrationHook implements Countable
|
|||||||
foreach (new DirectoryIterator($path . DIRECTORY_SEPARATOR . $upgradeDir) as $file) {
|
foreach (new DirectoryIterator($path . DIRECTORY_SEPARATOR . $upgradeDir) as $file) {
|
||||||
if (preg_match('/^(?:r|v)?((?:\d+\.){0,2}\d+)(?:_([\w+]+))?\.sql$/', $file->getFilename(), $m)) {
|
if (preg_match('/^(?:r|v)?((?:\d+\.){0,2}\d+)(?:_([\w+]+))?\.sql$/', $file->getFilename(), $m)) {
|
||||||
if (version_compare($m[1], $version, '>')) {
|
if (version_compare($m[1], $version, '>')) {
|
||||||
$migration = new DbMigration($m[1], $file->getRealPath());
|
$migration = new DbMigrationStep($m[1], $file->getRealPath());
|
||||||
if (isset($descriptions[$migration->getVersion()])) {
|
if (isset($descriptions[$migration->getVersion()])) {
|
||||||
$migration->setDescription($descriptions[$migration->getVersion()]);
|
$migration->setDescription($descriptions[$migration->getVersion()]);
|
||||||
} elseif (isset($m[2])) {
|
} elseif (isset($m[2])) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Web\Widget\ItemList;
|
namespace Icinga\Web\Widget\ItemList;
|
||||||
|
|
||||||
use Icinga\Application\Hook\Common\DbMigration;
|
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||||
use ipl\Html\Attributes;
|
use ipl\Html\Attributes;
|
||||||
use ipl\Html\BaseHtmlElement;
|
use ipl\Html\BaseHtmlElement;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
@ -20,7 +20,7 @@ class MigrationFileListItem extends BaseListItem
|
|||||||
{
|
{
|
||||||
use Translation;
|
use Translation;
|
||||||
|
|
||||||
/** @var DbMigration Just for type hint */
|
/** @var DbMigrationStep Just for type hint */
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
protected function assembleVisual(BaseHtmlElement $visual): void
|
protected function assembleVisual(BaseHtmlElement $visual): void
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
namespace Icinga\Web\Widget\ItemList;
|
namespace Icinga\Web\Widget\ItemList;
|
||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Icinga\Application\Hook\Common\DbMigration;
|
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||||
use Icinga\Application\Hook\MigrationHook;
|
use Icinga\Application\Hook\MigrationHook;
|
||||||
use Icinga\Application\MigrationManager;
|
use Icinga\Application\MigrationManager;
|
||||||
use Icinga\Forms\MigrationForm;
|
use Icinga\Forms\MigrationForm;
|
||||||
@ -31,7 +31,7 @@ class MigrationList extends BaseItemList
|
|||||||
/**
|
/**
|
||||||
* Create a new migration list
|
* Create a new migration list
|
||||||
*
|
*
|
||||||
* @param Generator<MigrationHook>|array<DbMigration|MigrationHook> $data
|
* @param Generator<MigrationHook>|array<DbMigrationStep|MigrationHook> $data
|
||||||
*
|
*
|
||||||
* @param ?MigrationForm $form
|
* @param ?MigrationForm $form
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Web\Widget\ItemList;
|
namespace Icinga\Web\Widget\ItemList;
|
||||||
|
|
||||||
use Icinga\Application\Hook\Common\DbMigration;
|
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||||
use Icinga\Application\Hook\MigrationHook;
|
use Icinga\Application\Hook\MigrationHook;
|
||||||
use ipl\Html\Attributes;
|
use ipl\Html\Attributes;
|
||||||
use ipl\Html\BaseHtmlElement;
|
use ipl\Html\BaseHtmlElement;
|
||||||
@ -69,7 +69,7 @@ class MigrationListItem extends BaseListItem
|
|||||||
protected function assembleCaption(BaseHtmlElement $caption): void
|
protected function assembleCaption(BaseHtmlElement $caption): void
|
||||||
{
|
{
|
||||||
$migrations = $this->item->getMigrations();
|
$migrations = $this->item->getMigrations();
|
||||||
/** @var DbMigration $migration */
|
/** @var DbMigrationStep $migration */
|
||||||
$migration = array_shift($migrations);
|
$migration = array_shift($migrations);
|
||||||
if ($migration->getLastState()) {
|
if ($migration->getLastState()) {
|
||||||
if ($migration->getDescription()) {
|
if ($migration->getDescription()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user