/** * BeforeFilter * * @param \Cake\Event\Event $event Event instance. * @return void * @throws Cake\Network\Exception\NotFoundException */ public function beforeFilter(Event $event) { // set cakebox version $this->set(['version' => $this->Info->cakeboxVersion()]); // Throw 404's for non-ajax connections to ajax_ prefixed actions if (substr($this->request->action, 0, 5) == 'ajax_') { if (!$this->request->is('ajax')) { throw new NotFoundException(); } } }
/** * Returns an array containing all application checks for a given application. * * @param string $appdir Containing path of the application to validate. * @return array Named array */ public function getApplicationChecks($appdir) { $framework = $this->Info->getFrameworkCommonName($appdir); // writebale directories foreach ($this->frameworkRequirements[$framework]['writeables'] as $dir) { $result[] = $this->getWriteableDirectoryCheck($appdir . DS . $dir); } // cache and database $result[] = $this->getApplicationCacheCheck(); $result[] = $this->getApplicationDatabaseCheck(); return $result; }
/** * Update framework specific configuration files if possible. * * @return boolean True if successful * @throws Cake\Core\Exception\Exception */ public function updateConfigs() { Log::debug("Updating configuration files"); $knownSources = Hash::extract($this->Info->frameworkMeta, '{s}.source'); if (!in_array($this->options['source'], $knownSources)) { Log::debug("* Skipping: automated configuration updates are not supported for user specified applications"); return true; } Log::debug("Updating " . $this->options['framework_human'] . " config files"); if ($this->options['framework_short'] == 'cakephp3') { if (!$this->Execute->updateCake3Configuration($this->options['path'], $this->options['url'])) { throw new Exception("Error updating config file."); } } if ($this->options['framework_short'] == 'cakephp2') { if (!$this->Execute->updateCake2Configuration($this->options['path'], $this->options['url'])) { throw new Exception("Error updating config file."); } } return true; }