当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell::startup方法代码示例

本文整理汇总了PHP中Cake\Console\Shell::startup方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::startup方法的具体用法?PHP Shell::startup怎么用?PHP Shell::startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Console\Shell的用法示例。


在下文中一共展示了Shell::startup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startup

 /**
  * 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);
     }
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:49,代码来源:AclShell.php

示例2: startup

 /**
  * Create the configuration object used in other classes.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $configFinder = new ConfigFinder();
     $this->setConfig($configFinder->loadAll());
     $this->out();
 }
开发者ID:markstory,项目名称:asset_compress,代码行数:12,代码来源:AssetCompressShell.php

示例3: startup

 /**
  * Shell startup, prints info message about dry run.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (!empty($this->params['dry-run'])) {
         $this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
     }
 }
开发者ID:dereuromark,项目名称:cakephp-setup,代码行数:12,代码来源:ClearShell.php

示例4: startup

 /**
  * 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');
     $className = App::classname('Acl.' . $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: %s', $class) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         return $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;
             return $this->DbConfig->execute();
         }
         if (!in_array($this->command, ['initdb'])) {
             $registry = new ComponentRegistry();
             $this->Acl = new AclComponent($registry);
             $controller = new Controller();
         }
     }
 }
开发者ID:ceeram,项目名称:acl,代码行数:36,代码来源:AclShell.php

示例5: startup

 /**
  * Assign $this->connection to the active task if a connection param is set.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     Configure::write('debug', true);
     Cache::disable();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
 }
开发者ID:mindforce,项目名称:cakephp-platform,代码行数:14,代码来源:SetupShell.php

示例6: startup

 /**
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $settings = ['debug' => !empty($this->params['debug']) ? $this->params['debug'] : false];
     if (!empty($this->params['project'])) {
         $settings['project'] = $this->params['project'];
     }
     $this->Transifex = new TransifexLib($settings);
 }
开发者ID:dereuromark,项目名称:cakephp-transifex,代码行数:12,代码来源:TransifexShell.php

示例7: startup

 /**
  * Assign $this->connection to the active task if a connection param is set.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     Cache::disable();
     $this->UserTable = TableRegistry::get($this->param('model'), ['connection' => ConnectionManager::get($this->param('connection'))]);
     if (!$this->UserTable->hasBehavior('Burzum/UserTools.User')) {
         $this->UserTable->addBehavior('Burzum/UserTools.User');
     }
     try {
         $this->UserTable->schema();
     } catch (\Exception $e) {
         $this->err($e->getMessage());
         $this->_stop(1);
     }
 }
开发者ID:tiagocapelli,项目名称:cakephp-user-tools,代码行数:20,代码来源:UserShell.php

示例8: startup

 /**
  * Assign $this->connection to the active task if a connection param is set.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     Configure::write('debug', true);
     Cache::disable();
     $task = $this->_camelize($this->command);
     if (isset($this->{$task}) && !in_array($task, ['Project'])) {
         if (isset($this->params['connection'])) {
             $this->{$task}->connection = $this->params['connection'];
         }
     }
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:20,代码来源:BakeShell.php

示例9: startup

 /**
  * @inheritDoc
  */
 public function startup()
 {
     parent::startup();
     $storageTable = 'Burzum/FileStorage.ImageStorage';
     if (isset($this->params['storageTable'])) {
         $storageTable = $this->params['storageTable'];
     }
     $this->Table = TableRegistry::get($storageTable);
     if (isset($this->params['limit'])) {
         if (!is_numeric($this->params['limit'])) {
             $this->out(__d('file_storage', '--limit must be an integer!'));
             $this->_stop();
         }
         $this->limit = $this->params['limit'];
     }
 }
开发者ID:tiagocapelli,项目名称:cakephp-file-storage,代码行数:19,代码来源:ImageVersionShell.php

示例10: startup

 /**
  * Start up And load Acl Component / Aco model
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $this->AclExtras->startup();
     $this->AclExtras->Shell = $this;
     if ($this->command) {
         try {
             \Cake\ORM\TableRegistry::get('Aros')->schema();
         } 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();
             return $this->_stop();
         }
     }
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:22,代码来源:AclExtrasShell.php

示例11: startup

 /**
  * Starts up the Shell and displays the welcome message.
  * 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.
  *
  * @return void
  * @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup
  */
 public function startup()
 {
     if (!empty($this->params['host'])) {
         $this->_host = $this->params['host'];
     }
     if (!empty($this->params['port'])) {
         $this->_port = $this->params['port'];
     }
     if (!empty($this->params['document_root'])) {
         $this->_documentRoot = $this->params['document_root'];
     }
     // for windows
     if (substr($this->_documentRoot, -1, 1) === DIRECTORY_SEPARATOR) {
         $this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
     }
     if (preg_match("/^([a-z]:)[\\\\]+(.+)\$/i", $this->_documentRoot, $m)) {
         $this->_documentRoot = $m[1] . '\\' . $m[2];
     }
     parent::startup();
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:30,代码来源:ServerShell.php

示例12: startup

 /**
  * startup
  *
  * @return void
  */
 public function startup()
 {
     if (!$this->param('xml') && !$this->param('version')) {
         parent::startup();
     }
 }
开发者ID:tgr0ss,项目名称:cakephp,代码行数:11,代码来源:CommandListShell.php

示例13: startup

 /**
  * startup
  *
  * @return void
  */
 public function startup()
 {
     if (empty($this->params['xml'])) {
         parent::startup();
     }
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:11,代码来源:CommandListShell.php

示例14: startup

 /**
  * Initialize connection.
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $this->connection = ConnectionManager::get($this->params['connection']);
 }
开发者ID:jmjjg,项目名称:cakephp-postgres,代码行数:10,代码来源:MaintenanceShell.php

示例15: startup

 /**
  * Starts up the Shell and displays the welcome message.
  * 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.
  *
  * @return void
  * @link http://book.cakephp.org/3.0/en/console-and-shells.html#hook-methods
  */
 public function startup()
 {
     if (!empty($this->params['host'])) {
         $this->_host = $this->params['host'];
     }
     if (!empty($this->params['port'])) {
         $this->_port = $this->params['port'];
     }
     if (!empty($this->params['document_root'])) {
         $this->_documentRoot = $this->params['document_root'];
     }
     if (!empty($this->params['ini_file'])) {
         $this->_iniFile = ROOT . DS . $this->params['ini_file'];
     }
     // For Windows
     if (substr($this->_documentRoot, -1, 1) === DS) {
         $this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
     }
     if (preg_match("/^([a-z]:)[\\\\]+(.+)\$/i", $this->_documentRoot, $m)) {
         $this->_documentRoot = $m[1] . '\\' . $m[2];
     }
     parent::startup();
 }
开发者ID:webuilder240,项目名称:instant-cake,代码行数:33,代码来源:InstantCakeShell.php


注:本文中的Cake\Console\Shell::startup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。