/** * Invokes the plugin specific code. * * @param boolean $isProduction */ function invoke($isProduction) { Piece_Flow_Env::setIsProduction($isProduction); }
/** * Sets whether the current environment is production or not. * * @param boolean $isProduction */ public function setIsProduction($isProduction) { Piece_Flow_Env::setIsProduction($isProduction); }
/** * Gets a Piece_Flow_Config object from a configuration file or a cache. * * @return Piece_Flow_Config */ function &_getConfiguration() { $masterFile = realpath($this->_source); $cache =& new Cache_Lite_File(array('cacheDir' => "{$this->_cacheDirectory}/", 'masterFile' => $masterFile, 'automaticSerialization' => true, 'errorHandlingAPIBreak' => true)); if (!Piece_Flow_Env::isProduction()) { $cache->remove($masterFile); } /* * The Cache_Lite class always specifies PEAR_ERROR_RETURN when * calling PEAR::raiseError in default. */ $config = $cache->get($masterFile); if (PEAR::isError($config)) { trigger_error("Cannot read the cache file in the directory [ {$this->_cacheDirectory} ].", E_USER_WARNING); return $this->_createConfigurationFromSource(); } if (!$config) { $config =& $this->_createConfigurationFromSource(); if (Piece_Flow_Error::hasErrors()) { $return = null; return $return; } $result = $cache->save($config); if (PEAR::isError($result)) { trigger_error("Cannot write the Piece_Flow object to the cache file in the directory [ {$this->_cacheDirectory} ].", E_USER_WARNING); } } return $config; }