本文整理汇总了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);
}
}
示例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();
}
示例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);
}
}
示例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();
}
}
}
示例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'];
}
}
示例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);
}
示例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);
}
}
示例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'];
}
}
示例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'];
}
}
示例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();
}
}
}
示例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();
}
示例12: startup
/**
* startup
*
* @return void
*/
public function startup()
{
if (!$this->param('xml') && !$this->param('version')) {
parent::startup();
}
}
示例13: startup
/**
* startup
*
* @return void
*/
public function startup()
{
if (empty($this->params['xml'])) {
parent::startup();
}
}
示例14: startup
/**
* Initialize connection.
*
* @return void
*/
public function startup()
{
parent::startup();
$this->connection = ConnectionManager::get($this->params['connection']);
}
示例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();
}