本文整理汇总了PHP中AppShell::startup方法的典型用法代码示例。如果您正苦于以下问题:PHP AppShell::startup方法的具体用法?PHP AppShell::startup怎么用?PHP AppShell::startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppShell
的用法示例。
在下文中一共展示了AppShell::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');
list($plugin, $class) = pluginSplit($class, true);
App::uses($class, $plugin . 'Controller/Component/Acl');
if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
$out = "--------------------------------------------------\n";
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
$out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
$out .= "--------------------------------------------------\n";
$out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
$out .= "--------------------------------------------------\n";
$this->err($out);
$this->_stop();
}
if ($this->command) {
if (!config('database')) {
$this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'), true);
$this->args = null;
return $this->DbConfig->execute();
}
require_once APP . 'Config' . DS . 'database.php';
if (!in_array($this->command, array('initdb'))) {
$collection = new ComponentCollection();
$this->Acl = new AclComponent($collection);
$controller = new Controller();
$this->Acl->startup($controller);
}
}
}
示例2: startup
/**
* Welcome message
*/
public function startup()
{
$this->out('<info>CodeSniffer plugin</info> for CakePHP', 2);
if ($standard = Configure::read('CodeSniffer.standard')) {
$this->standard = $standard;
}
parent::startup();
}
示例3: startup
/**
* Create the configuration object used in other classes.
*
*/
public function startup()
{
parent::startup();
AssetConfig::clearAllCachedKeys();
$this->_Config = AssetConfig::buildFromIniFile($this->params['config']);
$this->AssetBuild->setThemes($this->_findThemes());
$this->out();
}
示例4: startup
/**
* Shell startup, prints info message about dry run.
*
* @return void
*/
public function startup() {
parent::startup();
if ($this->params['dry-run']) {
$this->out(__d('cake_console', '<warning>Dry-run mode enabled!</warning>'), 1, Shell::QUIET);
}
if ($this->params['git'] && !is_dir('.git')) {
$this->out(__d('cake_console', '<warning>No git repository detected!</warning>'), 1, Shell::QUIET);
}
}
示例5: startup
/**
* Shell startup, prints info message about dry run.
*
* @return void
*/
public function startup()
{
parent::startup();
if ($this->params['dry-run']) {
$this->out(__d('cake_console', '<warning>Dry-run mode enabled!</warning>'), 1, Shell::QUIET);
}
if (!$this->_test()) {
$this->out(__d('cake_console', '<warning>dos2unix not available</warning>'), 1, Shell::QUIET);
}
}
示例6: startup
/**
* Assign $this->connection to the active task if a connection param is set.
*
* for installing to test db: Console/cake install app --connection=test
*
* @return void
*/
public function startup()
{
parent::startup();
Configure::write('Security.salt', sha1('Catool' . time()));
Configure::write('Security.cipherSeed', implode("", array_map("rand", array_fill(0, 20, 1), array_fill(0, 20, 10))));
Configure::write('debug', 2);
Configure::write('Cache.disable', 1);
if (isset($this->params['connection'])) {
$this->connection = $this->params['connection'];
}
}
示例7: startup
/**
* Override startup
*
* @access public
*/
public function startup()
{
parent::startup();
ini_set('unserialize_callback_func', 'unserialize_jobs');
$connection = ConnectionManager::getDataSource($this->params['connection']);
if ($this->params['type'] == 'mysql') {
DJJob::setConnection($connection->getConnection());
} else {
DJJob::configure(implode(';', array("{$this->params['type']}:host={$connection->config['host']}", "dbname={$connection->config['database']}", "port={$connection->config['port']}", "user={$connection->config['login']}", "password={$connection->config['password']}")));
}
}
示例8: startup
/**
* Shell startup, prints info message about dry run.
*
* @return void
*/
public function startup()
{
parent::startup();
$this->binPath = Configure::read('Cli.dos2unixPath');
if ($this->params['dry-run']) {
$this->out(__d('cake_console', '<warning>Dry-run mode enabled!</warning>'), 1, Shell::QUIET);
}
if (false && !$this->_test()) {
$this->out(__d('cake_console', '<warning>dos2unix not available</warning>'), 1, Shell::QUIET);
}
}
示例9: startup
/**
* Assign $this->connection to the active task if a connection param is set.
*
* @return void
*/
public function startup()
{
parent::startup();
Configure::write('debug', 2);
Configure::write('Cache.disable', 1);
$task = Inflector::classify($this->command);
if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
if (isset($this->params['connection'])) {
$this->{$task}->connection = $this->params['connection'];
}
}
}
示例10: startup
/**
* CopyShell::startup()
*
* @return void
*/
public function startup()
{
$this->scriptFolder = dirname(__FILE__) . DS;
$this->sitecopyFolder = $this->scriptFolder . $this->sitecopyFolderName . DS;
$this->tmpFolder = TMP . 'cache' . DS . 'copy' . DS;
/*
TODO - garbage clean up of log file
if (file_exists($this->tmpFolder.'log.txt') && (int)round(filesize($this->tmpFolder.'log.txt')/1024) > 2000) { # > 2 MB
unlink($this->tmpFolder.'log.txt');
}
//echo (int)round(filesize($this->tmpFolder.'log.txt')/1024);
*/
parent::startup();
}
示例11: startup
/**
* Shell startup, prints info message about dry run.
*
* @return void
*/
public function startup()
{
parent::startup();
if ($this->params['dry-run']) {
$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
}
if (($this->params['git'] || $this->params['tgit']) && !$this->_isType('git')) {
$this->out('<warning>No git repository detected!</warning>', 1, Shell::QUIET);
}
if ($this->params['svn'] && !$this->_isType('svn')) {
$this->out('<warning>No svn repository detected!</warning>', 1, Shell::QUIET);
}
//TODO: .hg
# check for commands - if not available exit immediately
if ($this->params['svn']) {
$this->params['svn'] = 'svn';
if (!empty($this->args[0])) {
$this->params['svn'] = rtrim($this->args[0], DS) . DS . 'svn';
}
$res = exec('"' . $this->params['svn'] . '" help', $array, $r);
if ($r) {
return $this->error($res, 'The command `svn` is unknown (on Windows install SlikSVN)');
}
}
if ($this->params['tgit']) {
$res = exec('tgit help', $array, $r);
if ($r) {
return $this->error($res, 'The command `tgit` is unknown (on Windows install TortoiseGit)');
}
}
// custom path overrides everything
if (!empty($this->params['custom'])) {
$this->_customPaths = array($this->params['custom']);
//$this->_paths = array($this->params['custom']);
$this->params['plugin'] = '';
} elseif ($this->params['plugin'] === '*') {
$plugins = App::objects('plugins');
$plugins = array_unique($plugins);
$paths = array();
foreach ($plugins as $plugin) {
$paths[] = CakePlugin::path($plugin);
}
$this->_customPaths = $paths;
//$this->_paths = $this->_customPaths;
$this->params['plugin'] = '';
}
}
示例12: startup
/**
* startup() の override.
* Chatwork\API_TOKEN の存在チェックを行います.
* 存在しなければ app/Plugin/Chatwork/Config/bootstrap.php.default のリネームを忘れている可能性があります.
*/
public function startup()
{
parent::startup();
$dtype = 'chatwork_console';
if (!defined('Chatwork\\API_TOKEN')) {
if (file_exists(APP . 'Plugin' . DS . 'Chatwork' . DS . 'Config' . DS . 'bootstrap.php.default')) {
if (!file_exists(APP . 'Plugin' . DS . 'Chatwork' . DS . 'Config' . DS . 'bootstrap.php')) {
$this->error(__d($dtype, 'Your bootstrap file is NOT present.'), array(__d($dtype, '* Please a copy of ChatworkPlugin\'s bootstrap file is found in %s.', '/APP/Plugin/Chatwork/bootstrap.php.default'), __d($dtype, ' Make a copy of this file in the same directory, but name it %s.', 'bootstrap.php')));
}
}
if (file_exists(APP . 'Plugin' . DS . 'Chatwork' . DS . 'Config' . DS . 'bootstrap.php')) {
$this->error(__d($dtype, 'Your bootstrap file is NOT present.'), array(__d($dtype, '* Please see this script file: \'%s\'', 'https://github.com/sirone/chatwork_cakephp/blob/master/Config/bootstrap.php.default'), __d($dtype, '* A copy of ChatworkPlugin\'s bootstrap file is found in %s.', '/APP/Plugin/Chatwork/bootstrap.default.php'), __d($dtype, ' Make a copy of this file in the same directory, but name it %s.', 'bootstrap.php'), __d($dtype, '* Please also check the following information.'), __d($dtype, ' Ensure the plugin is loaded in app/Config/bootstrap.php by calling CakePlugin::load(\'Chatwork\',array(\'bootstrap\'=>true));')));
}
}
if (Chatwork\API_TOKEN === 'X-ChatWorkToken:CHANGE_THIS') {
$this->error(__d($dtype, 'Please changed "%s" !', 'Chatwork\\API_TOKEN'), array(__d($dtype, 'Please change the value of \'%s\' in %s to a API token value specific to your application.', 'define(__NAMESPACE__.\'\\API_TOKEN\',\'X-ChatWorkToken:CHANGE_THIS\');', 'APP/Plugin/Chatwork/bootstrap.php')));
}
}
示例13: startup
/**
* Disable caching and enable debug for baking.
* This forces the most current database schema to be used.
*
* @return void
*/
public function startup()
{
Configure::write('debug', 2);
Configure::write('Cache.disable', 1);
parent::startup();
}
示例14: startup
public function startup()
{
parent::startup();
$this->WorksController = new WorksController();
}
示例15: startup
/**
* startup
*
* @return void
*/
public function startup()
{
if (empty($this->params['xml'])) {
parent::startup();
}
}