Cake\Console\Shell::startup PHP Метод

startup() публичный Метод

Allows for checking and configuring prior to command or main execution Override this method if you want to remove the welcome information, or otherwise modify the pre-command flow.
public startup ( ) : void
Результат void
    public function startup()
    {
        if (!$this->param('requested')) {
            $this->_welcome();
        }
    }

Usage Example

Пример #1
1
 /**
  * Override startup of the Shell
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
     $class = Configure::read('Acl.classname');
     if (strpos($class, '\\') === false && strpos($class, '.') === false) {
         $className = App::classname('Acl.' . $class, 'Adapter');
     } else {
         $className = App::classname($class, 'Adapter');
     }
     if ($class !== 'DbAcl' && !is_subclass_of($className, 'Acl\\Adapter\\DbAcl')) {
         $out = "--------------------------------------------------\n";
         $out .= __d('cake_acl', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n";
         $out .= __d('cake_acl', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
         $out .= "--------------------------------------------------\n";
         $out .= __d('cake_acl', 'Current ACL Classname: {0}', [$class]) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         $this->_stop();
     }
     if ($this->command) {
         if (Configure::check('Datasource') === null) {
             $this->out(__d('cake_acl', 'Your database configuration was not found. Take a moment to create one.'));
             $this->args = null;
             $this->DbConfig->execute();
             return;
         }
         try {
             TableRegistry::get('Aros')->schema();
             TableRegistry::remove('Aros');
         } catch (\Cake\Database\Exception $e) {
             $this->out(__d('cake_acl', 'Acl database tables not found. To create them, run:'));
             $this->out();
             $this->out('  bin/cake Migrations.migrations migrate -p Acl');
             $this->out();
             $this->_stop();
             return;
         }
         $registry = new ComponentRegistry();
         $this->Acl = new AclComponent($registry);
     }
 }
All Usage Examples Of Cake\Console\Shell::startup