Run the migration, optionally for a plugin

@param string $plugin Plugin name (optional)
@return void
556208
public function migrate($plugin = null)
    {
        $plugin = ($plugin === null)? '' : ' -p ' . $plugin;
        $this->dispatchShell('migrations migrate' . $plugin);
    }
339597
public function up()
    {
        if (Schema::hasColumn('sql_db_config', 'driver')) {
            // pre-2.2 
            Schema::table('sql_db_config', function (Blueprint $t){
                $t->string('driver')->nullable()->change();
                $t->string('dsn')->nullable()->change();
                $t->text('connection')->after('service_id')->nullable();
                $t->text('statements')->nullable();
            }
            );
        }
    }
406321
public function run()
    {
        $this->options['data-plugin-name'] = $this->_pluginName;

        if (!isset($this->options['class'])) {
            $this->options['class'] = 'fullcalendar';
        }

        echo Html::beginTag('div', $this->options) . "\n";
            echo Html::beginTag('div',['class'=>'fc-loading','style' => 'display:none;']);
                echo Html::encode($this->loading);
            echo Html::endTag('div')."\n";
        echo Html::endTag('div')."\n";
        $this->registerPlugin();
    }
268670
public static function unload($plugin = null)
    {
        if (self::loaded($plugin)) {
            $locales = Configure::read('App.paths.locales');
            foreach ($locales as $key => $path) {
                if ($path == self::getLocalePath($plugin)) {
                    unset($locales[$key]);
                }
            }

            Configure::write('App.paths.locales', $locales);
        }

        parent::unload($plugin);
    }
506205
public function up()
    {
        Schema::create('settings', function (Blueprint $table) {

            $table->increments('id');
            $table->string('module_name', 30);
            $table->enum('action', ['setting', 'xfield', 'creat', 'edit'])->default('setting');
            $table->string('section', 20)->default('main');
            $table->string('fieldset', 20)->default('general');
            $table->string('name', 30);
            $table->string('type', 20)->default('string');
            $table->string('value');
            $table->text('params')->nullable(); // multiline or json, or dinamic values
            $table->text('class')->length(255)->nullable();
            $table->text('html_flags')->length(500)->nullable();
            $table->string('title', 125)->nullable();
            $table->text('descr')->length(500)->nullable();

            // If need to monitor an additional field. I.e.: create and delete him.
            $table->boolean('as_xfield')->nullable();

            $table->index('action');
            $table->index('module_name');
            $table->unique(['name', 'module_name']);
            // $table->foreign('module_id', DB::getTablePrefix() . 'settings_module_id_fk')->references('id')->on('modules')
            $table->foreign('module_name')->references('name')->on('modules')
                  ->onDelete('cascade')->onUpdate('cascade');

            $table->timestamps();
        });
    }
1311245
protected function runMigration(object $migration, string $method, ?int $batch = null): void
	{
		$migrationInstance = $this->resolve($migration);

		$migrationWrapper = $this->buildMigrationWrapper($migration, $migrationInstance, $method, $batch);

		if($migrationInstance->useTransaction())
		{
			$migrationInstance->getConnection()->transaction(function() use ($migrationWrapper): void
			{
				$migrationWrapper();
			});

			return;
		}

		$migrationWrapper();
	}
10913
public function migrate($migrationName) {
		$this->createTable();
		$this->db->dal()->into('_migrations')->insert(['name'=>$migrationName, 'migrated'=>date('Y-m-d H:i:s')]);
	}
181388
public function migrate(ContainerInterface $container): void
    {
        foreach ($this->getMigrations($container) as $class) {
            assert(is_string($class));
            $this->getIO()->writeInfo("Starting migration for `$class`..." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);
            if (($migration = $this->createMigration($class, $container)) !== null) {
                $migration->init($container)->migrate();
                $this->getIO()->writeInfo("Migration finished for `$class`." . PHP_EOL, IoInterface::VERBOSITY_NORMAL);
            }
        }
    }
502893
protected function runMigration($migration, $method)
    {
        $callback = function () use ($migration, $method) {
            if (method_exists($migration, $method)) {
                $migration->{$method}();
            }
        };

        $callback();
    }
885401
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AchievementProviderInterface) {
            return; // we're okay
        }

        throw new RuntimeException(
            sprintf(
                'Plugin of type %s is invalid; must implement ' .
                'AxalianAchievements\AchievementProvider\AchievementProviderInterface',
                (is_object($plugin) ? get_class($plugin) : gettype($plugin))
            )
        );
    }
212211
public function validatePlugin($plugin)
    {
        if ($plugin instanceof AbstractPlugin) {
            return; // we're okay
        }

        throw new \InvalidArgumentException(sprintf(
            'Can\'t create jQuery plugin for %s; Plugin must be an instance of %s',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            AbstractPlugin::class
        ));
    }
581688
public function runInstall(Model $entity, ?string $database): void
    {
        $database = $this->asConnection($entity, $database);
        $table = $this->resolveMigrationTableName($entity);
        $migrator = $this->resolveMigrator($table);
        $repository = $migrator->getRepository();

        $migrator->setConnection($database);

        if (! $repository->repositoryExists()) {
            $repository->createRepository();

            $this->note("<info>Migration table {$table} created successfully.</info>");
        }

        $migrator->resetConnection();
    }
1282737
public function execUp(string $name): void{
        DB::connection('default')->table('migrations')->insert(['name' => $name]);
        $this->up();
    }
564161
public function registerPlugin(Plugin $plugin)
    {
        try {
            $this->smarty->registerPlugin($plugin->getType(), $plugin->getName(), $plugin->getCallbackFunction(),
                $plugin->getAttribute('Cachable', true), $plugin->getAttribute('CacheAttr', null));
        } catch (\SmartyException $e) {
            throw new SmartyException($e);
        }
    }
160352
public function validatePlugin($plugin)
    {
        if ($plugin instanceof RouteInterface) {
            // we're okay
            return;
        }

        throw new RuntimeException(sprintf(
            'Plugin of type %s is invalid; must implement %s\RouteInterface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
779534
public function plugin_loaded( string $plugin ): void {

		$time            = microtime( true );
		$this->entries[] = [
			'name'     => $plugin,
			'origin'   => $this->last,
			'duration' => $time - $this->last,
		];
		$this->last      = $time;
	}
402361
protected static function run_migration()
	{
		// make sure we've got a usertable we can work with
		static::usertable();

		// get the simpleauth config
		\Config::load('simpleauth', true);
		$simpleauth = \Config::get('simpleauth', array());

		// process the defined roles
		foreach (\Config::get('simpleauth.roles', array()) as $role => $config)
		{
			// skip all non-standard roles
			if ($role == '#' or ! is_array($config))
			{
				continue;
			}

			// do we already have this role?
			$result = \DB::select('id')->from(static::$data['ormauth_table'].'_roles')->where('name', '=', $role)->execute();
			if (count($result))
			{
				$role_id = $result[0]['id'];
			}

			// no, add it
			else
			{
				\Cli::write('- creating role: '.$role, 'light_green');
				list($role_id, $rows_affected) = \DB::insert(static::$data['ormauth_table'].'_roles')->set(array('name' => $role))->execute();
			}

			// fetch the role as an ORM object, and assign the defined permissions to it
			$role = \Model\Auth_Role::find($role_id);
			if ($role)
			{
				foreach ($config as $area => $permissions)
				{
					foreach ($permissions as $permission)
					{
						$perm = \Model\Auth_Permission::query()->where('area', '=', $area)->where('permission', '=', $permission)->get_one();
						if ( ! $perm)
						{
							\Cli::write('- creating permission: '.$area.'.'.$permission, 'light_green');
							$perm = \Model\Auth_Permission::forge(array('area' => $area, 'permission' => $permission, 'description' => $area.'.'.$permission, 'actions' => serialize(array())));
						}
						$role->permissions[] = $perm;
					}
				}

				// update the role and save the permissions
				$role->save();
			}
		}

		// process the defined groups
		foreach (\Config::get('simpleauth.groups', array()) as $group => $config)
		{
			// ignore invalid entries
			if ( ! isset($config['name']) or ! isset($config['roles']))
			{
				continue;
			}

			// do we already have this group?
			$result = \DB::select('id')->from(static::$data['ormauth_table'].'_groups')->where('name', '=', $config['name'])->execute();
			if (count($result))
			{
				$group_id = $result[0]['id'];
			}

			// no, add it
			else
			{
				\Cli::write('- creating group: '.$config['name'], 'light_green');
				list($group_id, $rows_affected) = \DB::insert(static::$data['ormauth_table'].'_groups')->set(array('name' => $config['name']))->execute();
			}

			// update the user group entries
			\DB::update(static::$data['ormauth_table'])->set(array('group_id' => $group_id))->where('group_id', '=', $group)->execute();

			// fetch the group as an ORM object, and assign the defined roles to it
			$group = \Model\Auth_Group::find($group_id);

			if ($group)
			{
				foreach ($config['roles'] as $role)
				{
					$role = \Model\Auth_Role::query()->where('name', '=', $role)->get_one();
					if ( ! $role)
					{
						$role = \Model\Auth_Role::forge(array('name' => $role));
						\Cli::write('- creating role: '.$role, 'light_green');
					}
					$group->roles[] = $role;
				}

				// update the group and save the roles
				$group->save();
			}
		}

		return true;
	}