Ejemplo n.º 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');
     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);
         }
     }
 }
 /**
  * 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();
 }
 /**
  * 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();
 }
Ejemplo n.º 4
0
/**
 * 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);
		}
	}
Ejemplo n.º 5
0
 /**
  * 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);
     }
 }
 /**
  * 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'];
     }
 }
 /**
  * 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']}")));
     }
 }
Ejemplo n.º 8
0
 /**
  * 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);
     }
 }
Ejemplo n.º 9
0
 /**
  * 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'];
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * 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();
 }
Ejemplo n.º 11
0
 /**
  * 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'] = '';
     }
 }
Ejemplo n.º 12
0
 /**
  * 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')));
     }
 }
Ejemplo n.º 13
0
 /**
  * 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();
 }
Ejemplo n.º 14
0
 public function startup()
 {
     parent::startup();
     $this->WorksController = new WorksController();
 }
Ejemplo n.º 15
0
 /**
  * startup
  *
  * @return void
  */
 public function startup()
 {
     if (empty($this->params['xml'])) {
         parent::startup();
     }
 }
Ejemplo n.º 16
0
 /**
  * Create the configuration object used in other classes.
  *
  */
 public function startup()
 {
     parent::startup();
 }
Ejemplo n.º 17
0
 /**
  * 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();
 }
Ejemplo n.º 18
0
 /**
  * startup 
  */
 public function startup()
 {
     parent::startup();
     $this->BcManager = new BcManagerComponent(new ComponentCollection());
 }
Ejemplo n.º 19
0
 /**
  * startup method
  *
  * @return void
  * @access public
  */
 function startup()
 {
     parent::startup();
     $this->_welcome();
 }
Ejemplo n.º 20
0
 public function startup()
 {
     parent::startup();
     $collection = new ComponentCollection();
     $this->Acl = new AclComponent($collection);
 }
Ejemplo n.º 21
0
    /**
     * Overriding the standard call to Cake Shell startup method
     *
     * @access public
     * @return false
     */
    public function startup()
    {
        parent::startup();

        //Turn off cache while setup shell runs under sudo to prevent cache files with incorrect permissions
        Configure::write('Cache.disable', true);
    }
Ejemplo n.º 22
0
 /**
  * シェル実行の準備
  */
 public function startup()
 {
     parent::startup();
     // コントローラー設定
     $this->PushController = new PushController();
 }