Configures the command.

@global Migrator $migrator the migrator

@action ON_CONFIGURE_MIGRATE_CMD_ACTION
188730
public function configure( )
    {
        global $migrator;
        
        $this->name          = 'Migrate';
        $this->version       = '1.0.0';
        $this->copyright     = '(c) 2014 RawPHP.org';
        $this->supportSite   = 'https://github.com/rawphp/RawPHP-Framework/issues';
        $this->supportSource = 'https://github.com/rawphp/RawPHP-Framework';
        $this->description   = 'Allows the migration of the database in either 
                                the up or down direction';
        
        $option = new Option( );
        $option->shortCode   = 'd';
        $option->longCode    = 'direction';
        $option->isRequired  = TRUE;
        $option->type        = Type::STRING;
        $option->description = 'The direction you want to migrate in';
        
        $this->options[] = $option;
        
        $option = new Option( );
        $option->shortCode   = 'l';
        $option->longCode    = 'levels';
        $option->isOptional  = TRUE;
        $option->type        = Type::STRING;
        $option->description = 'How many levels you want to migrate';
        
        $this->options[] = $option;
        
        $this->migrator = $migrator;
        
        $this->doAction( self::ON_CONFIGURE_MIGRATE_CMD_ACTION );
    }
804154
protected function registerCmsMigrator()
    {
        // Make sure that we do not use the same migrations table if CMS migrations
        // share the database with the app.
        $this->app->singleton('cms.migration-repository', function (Application $app) {

            $table = $this->getCore()->config(
                'database.migrations.table',
                $app['config']['database.migrations']
            );

            return new DatabaseMigrationRepository($app['db'], $table);
        });

        // This CMS migrator uses the exact same binding setup as the normal migrator,
        // except for this table configuration.
        $this->app->singleton('cms.migrator', function ($app) {
            return new Migrator($app['cms.migration-repository'], $app['db'], $app['files']);
        });


        // Bind the migrator contextually, so it will be set for the commands bound here.
        $this->app->when(MigrateCommand::class)
                  ->needs(Migrator::class)
                  ->give('cms.migrator');

        $this->app->when(MigrateInstallCommand::class)
                  ->needs(MigrationRepositoryInterface::class)
                  ->give('cms.migration-repository');

        $this->app->when(MigrateRefreshCommand::class)
                  ->needs(Migrator::class)
                  ->give('cms.migrator');

        $this->app->when(MigrateResetCommand::class)
                  ->needs(Migrator::class)
                  ->give('cms.migrator');

        $this->app->when(MigrateRollbackCommand::class)
                  ->needs(Migrator::class)
                  ->give('cms.migrator');

        $this->app->when(MigrateStatusCommand::class)
                  ->needs(Migrator::class)
                  ->give('cms.migrator');

        return $this;
    }
563054
public function handle()
    {
        // Next, we will check to see if a path option has been defined. If it has
        // we will use the path relative to the root of this installation folder
        // so that migrations may be run for any path within the applications.
        $this->deployer->run($this->getDeployPaths(), []);

        // Once the migrator has run we will grab the note output and send it out to
        // the console screen, since the migrator itself functions without having
        // any instances of the OutputInterface contract passed into the class.
        foreach ($this->deployer->getNotes() as $note) {
            $this->output->writeln($note);
        }
    }
260760
protected function configure()
    {
        $bits = explode('\\', get_class($this));

        $this->setName($this->getCommandNamePrefix() . Inflector::tableize(array_pop($bits)))
            ->addOption('debug', '', InputOption::VALUE_NONE, 'Output debug details')
            ->addOption('json', '', InputOption::VALUE_NONE, 'Output JSON')
            ->addOption('environment', 'e', InputOption::VALUE_REQUIRED, 'Environment in which we are are running (development, staging or production)', 'development');
    }
91747
public function fire(Command $command)
    {
        if ($command->option('verbose')) {
            $command->blockMessage('Migrations', 'Starting the module migrations ...', 'comment');
        }

        foreach ($this->modules as $module) {
            if ($command->option('verbose')) {
                $command->call('module:migrate', ['module' => $module]);
                continue;
            }
            $command->callSilent('module:migrate', ['module' => $module]);
        }
    }
1320983
public function handle(MigrateMessage $command)
    {
        $input = $command->getInput();
        $output = $command->getOutput();
        $this->command = $command;

        $targetArg = (string) $input->getArgument(MigrateMessage::ARG_TARGET);
        $strategy = (string) $this->getStrategyOption($input);

        $options = new Options(Options::DIRECTION_UP); // this value will get replaced by timeline later
        $options->setDryRun($input->getOption(MigrateMessage::OPT_DRY_RUN));
        $options->setExceptionOnSkip(false);

        $this->saveChanges = !$input->getOption(MigrateMessage::OPT_NO_STORAGE) && !$options->isDryRun();

        $this->trackProgress = ($output->getVerbosity() !== OutputInterface::VERBOSITY_QUIET)
            && !$input->getOption(MigrateMessage::OPT_NOPROGRESS);

        $this->attachEvents($output, $command->getTimeline()->getEventDispatcher());

        /* @var \Baleen\Migrations\Version\Collection\LinkedVersions $results */
        $command->getTimeline()->$strategy($targetArg, $options);
    }
395747
protected function configure() {
		parent::configure();
		
		if (!empty($this->options['tmpPath'])) {
			if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'], 0755, true)) && is_writable($this->options['tmpPath'])) {
				$this->tmp = $this->options['tmpPath'];
			}
		}
		
		if (!$this->tmp && $this->tmbPath) {
			$this->tmp = $this->tmbPath;
		}
		
		if (!$this->tmp) {
			$this->disabled[] = 'mkfile';
			$this->disabled[] = 'paste';
			$this->disabled[] = 'duplicate';
			$this->disabled[] = 'upload';
			$this->disabled[] = 'edit';
			$this->disabled[] = 'archive';
			$this->disabled[] = 'extract';
		}
		
		// echo $this->tmp;
		
	}
699426
protected function configure()
    {

        // configure the command
        $this->addArgument(InputArgumentKeys::OPERATION_NAME, InputArgument::OPTIONAL, 'The operation that has to be used for the import, one of "add-update", "replace" or "delete"', OperationKeys::ADD_UPDATE)
             ->addOption(InputOptionKeys::SERIAL, null, InputOption::VALUE_REQUIRED, 'The unique identifier of this import process', Uuid::uuid4()->__toString())
             ->addOption(InputOptionKeys::INSTALLATION_DIR, null, InputOption::VALUE_REQUIRED, 'The Magento installation directory to which the files has to be imported', getcwd())
             ->addOption(InputOptionKeys::SYSTEM_NAME, null, InputOption::VALUE_REQUIRED, 'Specify the system name to use', gethostname())
             ->addOption(InputOptionKeys::PID_FILENAME, null, InputOption::VALUE_REQUIRED, 'The explicit PID filename to use', sprintf('%s/%s', sys_get_temp_dir(), Configuration::PID_FILENAME))
             ->addOption(InputOptionKeys::MAGENTO_EDITION, null, InputOption::VALUE_REQUIRED, 'The Magento edition to be used, either one of "CE" or "EE" (will be autodetected if possible and not specified)')
             ->addOption(InputOptionKeys::MAGENTO_VERSION, null, InputOption::VALUE_REQUIRED, 'The Magento version to be used, e. g. "2.1.2"')
             ->addOption(InputOptionKeys::CONFIGURATION, null, InputOption::VALUE_REQUIRED, 'Specify the pathname to the configuration file to use')
             ->addOption(InputOptionKeys::SOURCE_DIR, null, InputOption::VALUE_REQUIRED, 'The directory that has to be watched for new files')
             ->addOption(InputOptionKeys::TARGET_DIR, null, InputOption::VALUE_REQUIRED, 'The target directory with the files that has been imported')
             ->addOption(InputOptionKeys::ARCHIVE_DIR, null, InputOption::VALUE_REQUIRED, 'The directory the imported files will be archived in')
             ->addOption(InputOptionKeys::ARCHIVE_ARTEFACTS, null, InputOption::VALUE_REQUIRED, 'Whether or not files should be archived')
             ->addOption(InputOptionKeys::SOURCE_DATE_FORMAT, null, InputOption::VALUE_REQUIRED, 'The date format used in the CSV file(s)')
             ->addOption(InputOptionKeys::USE_DB_ID, null, InputOption::VALUE_REQUIRED, 'The explicit database ID used for the actual import process')
             ->addOption(InputOptionKeys::DB_PDO_DSN, null, InputOption::VALUE_REQUIRED, 'The DSN used to connect to the Magento database where the data has to be imported, e. g. mysql:host=127.0.0.1;dbname=magento;charset=utf8')
             ->addOption(InputOptionKeys::DB_USERNAME, null, InputOption::VALUE_REQUIRED, 'The username used to connect to the Magento database')
             ->addOption(InputOptionKeys::DB_PASSWORD, null, InputOption::VALUE_REQUIRED, 'The password used to connect to the Magento database')
             ->addOption(InputOptionKeys::LOG_LEVEL, null, InputOption::VALUE_REQUIRED, 'The log level to use')
             ->addOption(InputOptionKeys::DEBUG_MODE, null, InputOption::VALUE_REQUIRED, 'Whether or not debug mode should be used')
             ->addOption(InputOptionKeys::SINGLE_TRANSACTION, null, InputOption::VALUE_REQUIRED, 'Whether or not the import should be wrapped within a single transaction')
             ->addOption(InputOptionKeys::PARAMS, null, InputOption::VALUE_REQUIRED, 'Additional options passed as a string (MUST have the same format as the used configuration file has)')
             ->addOption(InputOptionKeys::PARAMS_FILE, null, InputOption::VALUE_REQUIRED, 'Additional options passed as pathname');
    }
500188
protected function configure(): void
    {
        $this
            ->setName('make:model')
            ->setDescription('Creates a new App model')
            ->addArgument(
                'modelName',
                InputArgument::OPTIONAL,
                'Define the name of the model to create'
            )
            ->addOption(
                'skip-db',
                null,
                InputOption::VALUE_NONE,
                'Skip database table creation'
            )
            ->addOption(
                'skip-seeder',
                null,
                InputOption::VALUE_NONE,
                'Skip seeder creation'
            )
            ->addOption(
                'auto-detect',
                null,
                InputOption::VALUE_NONE,
                'Automatically build models from the database'
            )
            ->addOption(
                'localised',
                null,
                InputOption::VALUE_NONE,
                'Create a localised model (or convert an existing model)'
            );

        if (Components::exists('nails/module-admin')) {
            $this->addOption(
                'admin',
                null,
                InputOption::VALUE_NONE,
                'Create an admin controller'
            );
        }
    }
242642
protected function configure()
    {
        $this->setName(self::COMMAND_NAME);
        $this->setDescription('Checks the style of commit messages');

        $help = '';
        $help .= "Check your commit messages to ensure they follow the guidelines described by Chris Beams.\n";
        $help .= "To enable the Git hook in your project run 'composer install-git-hook.'\n";
        $help .= "\n";
        $help .= "\n";
        $help .= "Here are some good articles on commit message style:\n";
        $help .= "\n";
        $help .= "* http://chris.beams.io/posts/git-commit/\n";
        $help .= "* https://git-scm.com/book/ch5-2.html#Commit-Guidelines\n";
        $help .= "* https://github.com/blog/926-shiny-new-commit-styles\n";

        $this->setHelp($help);
        $this->setDefinition(
            new InputDefinition(
                [
                    new InputArgument(
                        self::ARGUMENT_COMMIT_MESSAGE_FILE,
                        InputArgument::REQUIRED,
                        'Path to commit message file'
                    ),
                    new InputOption(
                        self::OPTION_IGNORE,
                        ['i'],
                        InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
                        'Ignore a commit message that matches this pattern and don\'t test it',
                        ['/^Merge branch/']
                    ),
                    new InputOption(
                        self::OPTION_COMMENT_CHAR,
                        ['c'],
                        InputOption::VALUE_OPTIONAL,
                        'Ignore lines that are prefixed with this character',
                        '#'
                    ),
                ]
            )
        );
    }
1165205
private function registerCommands()
    {
        $this->app['commands.drawbridge.migrations'] = $this->app->share(function($app)
        {
            return new MigrationsCommand($app);
        });

        $this->commands(
            array(
                 'commands.drawbridge.migrations'
            )
        );
    }
1276524
protected function configure(): void
    {
        parent::configure();
        foreach ($this->aArguments as $aArgument) {
            $this->addArgument(
                getFromArray('name', $aArgument),
                getFromArray('mode', $aArgument, InputArgument::OPTIONAL),
                getFromArray('description', $aArgument),
                getFromArray('default', $aArgument)
            );
        }
    }
50515
protected function configure()
    {
        $this
            ->addArgument('stores', InputArgument::IS_ARRAY | InputArgument::REQUIRED,
                'A list of stores to re-encrypt.')
            ->addOption(
                'new-profile',
                null,
                InputOption::VALUE_REQUIRED,
                'The new profile the current data is encrypted with.',
                null
            )
            ->addOption(
                'offset',
                null,
                InputOption::VALUE_REQUIRED,
                'Starting record',
                0
            )
            ->addOption(
                'limit',
                null,
                InputOption::VALUE_REQUIRED,
                'Max records to process',
                null
            )
            ->addOption(
                'batch-size',
                null,
                InputOption::VALUE_REQUIRED,
                'Records per batch to process',
                1
            );
    }
1083224
protected function registerMakeCommand()
    {
        $this->app->bindShared('migration.creator', function($app)
        {
            return new MigrationCreator($app['files']);
        });

        $this->app->bindShared('command.migrate.make', function($app)
        {
            $creator = $app['migration.creator'];

            $packagePath = $app['path.base'] .DS .'vendor';

            return new MakeMigrationCommand($creator, $packagePath);
        });
    }
364092
public function handle(Migrator $migrator)
   {
       $migrator->makeLogTable();

       $this->showMigrations($migrator);

       $this->showSeeds($migrator);
   }
1361062
public function installAction()
    {
        // Create database connection and load migrations
        $connection = ConnectionManager::create($_SESSION['db']);
        $this->loadMigrations();

        // Migrate the database.
        $m = new Migrator;
        $m->migrate('up');

        // Create admin account
        $admin = new User($_SESSION['admin'] + [
            'name'     => $_SESSION['admin']['username'],
            'group_id' => 1
        ]);
        $admin->save();

        // Set config file contents
        $this->set("config", $this->makeConfig());

        // Insert defaults
        $seeder = new Seeder;
        $seeder->seed();

        // Remove database and account details from the session.
        unset($_SESSION['db'], $_SESSION['admin']);

        $this->title("Complete");
        return $this->render("complete.phtml");
    }
1154790
protected function configure()
    {
        $this->setName($this->commandDefinition->getNamespace() . ':' . $this->commandDefinition->getAction())
             ->setDescription($this->commandDefinition->getDefinition());
    }