Acl\Shell\AclShell::startup PHP Method

startup() public method

Override startup of the Shell
public startup ( ) : void
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);
        }
    }