console\controllers\MigrateController::getNewMigrations PHP Метод

getNewMigrations() защищенный Метод

Returns the migrations that are not applied.
protected getNewMigrations ( ) : array
Результат array list of new migrations, (key: migration version; value: alias)
    protected function getNewMigrations()
    {
        $applied = [];
        foreach ($this->getMigrationHistory(-1) as $version => $info) {
            $applied[substr($version, 1, 13)] = true;
        }
        if (isset(\Yii::$app->params['yii.migrations'])) {
            $this->migrationLookup = ArrayHelper::merge($this->migrationLookup, \Yii::$app->params['yii.migrations']);
        }
        if ($this->migrationPath && $this->disableLookup) {
            $directories = [$this->migrationPath];
        } else {
            $directories = ArrayHelper::merge([$this->migrationPath], $this->migrationLookup);
        }
        $migrations = [];
        echo "\nLookup:\n";
        foreach ($directories as $alias) {
            $dir = Yii::getAlias($alias);
            $handle = opendir($dir);
            while (($file = readdir($handle)) !== false) {
                if ($file === '.' || $file === '..') {
                    continue;
                }
                $path = $dir . DIRECTORY_SEPARATOR . $file;
                if (preg_match('/^(m(\\d{6}_\\d{6})_.*?)\\.php$/', $file, $matches) && is_file($path) && !isset($applied[$matches[2]])) {
                    $migrations[$matches[1]] = $alias;
                }
            }
            closedir($handle);
            echo "    " . $alias . " (" . \Yii::getAlias($alias) . ")\n";
        }
        ksort($migrations);
        echo "\n";
        return $migrations;
    }