コード例 #1
0
ファイル: Cache.php プロジェクト: BGCX262/zyk-svn-to-git
 /**
  * To init the view
  *
  * @return Zend_View $view
  */
 public function init()
 {
     $frontendOptions = array('automatic_serialization' => true, 'lifetime' => 86400);
     $backendOptions = array('cache_dir' => PROJECT_ROOT . '/repository/cache/');
     if ('development' == APPLICATION_ENV) {
         $frontendOptions['caching'] = false;
         //关闭缓存
     } else {
         $classFileIncCache = $backendOptions['cache_dir'] . 'pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
     $this->_cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_cache);
     //缓存Zend_Db_Table元数据
     Zend_Date::setOptions(array('cache' => $this->_cache));
     //缓存Zend_Date
     Zend_Translate::setCache($this->_cache);
     //缓存Zend_Translate
     Zend_Registry::set('cache', $this->_cache);
     // Return it, so that it can be stored by the bootstrap
     return $this->_cache;
 }
コード例 #2
0
ファイル: Default.php プロジェクト: henvic/MediaLab
 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $sysCache = $registry->get("sysCache");
     $cacheFiles = new Ml_Cache_Files($sysCache);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $frontController = $this->getBootstrap()->getResource('FrontController');
     $dispatcher = $frontController->getDispatcher();
     $request = $frontController->getRequest();
     $router = $frontController->getRouter();
     $router->removeDefaultRoutes();
     //@todo remove this patched route module and use the original instead ASAP
     $compat = new Ml_Controller_Router_Route_Module(array(), $dispatcher, $request);
     $router->addRoute("default", $compat);
     $routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
     $router->addConfig($routerConfig, "routes");
     $frontController->registerPlugin(new Ml_Plugins_ReservedUsernames());
     Zend_Controller_Action_HelperBroker::getStaticHelper("Redirector")->setPrependBase(false);
     $frontController->setBaseUrl($config['webroot']);
     $loader = new Zend_Loader_PluginLoader();
     $loader->addPrefixPath('Zend_View_Helper', EXTERNAL_LIBRARY_PATH . '/Zend/View/Helper/')->addPrefixPath('Ml_View_Helper', APPLICATION_PATH . '/views/helpers');
     $classFileIncCache = CACHE_PATH . '/PluginDefaultLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         require $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     $viewRenderer->initView();
 }
コード例 #3
0
ファイル: Bootstrap.php プロジェクト: knatorski/SMS
 /**
  *
  * Kilka dodatkowych statycznych inicjaliacji
  *
  */
 public function _initStatics()
 {
     $config = $this->getApplication()->getOptions();
     /**
      * Ustawienie konfigu na rejestrze dla kompatybilnosci z poprzednmi rozwiazaniami (resouce plugin dla ACL)
      */
     Zend_Registry::set('config', $config);
     if (isset($config['general']['pluginloader']) and $config['general']['pluginloader']) {
         $classFileIncCache = APPLICATION_PATH . '/../tmp/pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
     /**
      * Ustawienie fallback tak by klasy bez namespacu tez dzialaly
      */
     Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)->pushAutoloader(NULL, 'Smarty_');
     /**
      * Domyslny rozmiar strony paginatora
      */
     Zend_Paginator::setDefaultItemCountPerPage($config['paginator']['DefaultItemCountPerPage']);
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('/common/paginator_footer.phtml');
     Zend_Controller_Action_HelperBroker::addPrefix('Base_Controller_Action_Helper');
     Zend_Markup::addRendererPath('Logic', 'Logic/');
     Base_Logic_Abstract::setUsePreexecuteHooks($config['general']['usepreexecutehooks']);
 }
コード例 #4
0
ファイル: Application.php プロジェクト: rusnak/Ext
 /**
  * Метод инициализирует кеширование загрузки плагинов приложения.
  *
  * @param string $path
  */
 protected function _initPluginCache($path)
 {
     if (file_exists($path) && is_readable($path)) {
         include $path;
     }
     if (is_writable($path) || is_writable(dirname($path))) {
         Zend_Loader_PluginLoader::setIncludeFileCache($path);
     }
 }
コード例 #5
0
ファイル: Includefilecache.php プロジェクト: rockett/parables
 /**
  * Set include file cache
  *
  * @return  void
  */
 public function setIncludeFileCache()
 {
     if ($options = $this->getOptions()) {
         if (is_string($options) && file_exists($options)) {
             include_once $options;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($options);
     }
 }
コード例 #6
0
 /**
  * Setup include file cache to increase performance
  *
  * @return void
  * @author Jim Li
  */
 protected function _initFileInlcudeCache()
 {
     $classFileIncCacheOptions = $this->getOption('cache');
     $classFileIncCache = $classFileIncCacheOptions['classFileIncludeCache'];
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
 }
コード例 #7
0
ファイル: Bootstrap.php プロジェクト: shadobladez/erp2
 /**
  * Configure the pluginloader cache
  */
 protected function X_initPluginLoaderCache()
 {
     if ('production' == $this->getEnvironment()) {
         $classFileIncCache = APPLICATION_PATH . '/../data/cache/pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
 }
コード例 #8
0
ファイル: LoaderCache.php プロジェクト: rickyfeng/wenda
 public function init()
 {
     if (!RFLib_Core::getIsDeveloperMode()) {
         $classFileCache = VAR_PATH . DS . self::CACHE_FOLDER . DS . self::CACHE_FILE;
         if (file_exists($classFileCache)) {
             include_once $classFileCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileCache);
     }
 }
コード例 #9
0
ファイル: Bootstrap.php プロジェクト: Lazaro-Gallo/psmn
 protected function _initCachePlugin()
 {
     //Tunning do Zend
     $pathIncCache = APPLICATION_PATH_CACHE . '/cachePlugin';
     $classFileIncCache = $pathIncCache . '/pluginLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
 }
コード例 #10
0
ファイル: Bootstrap.php プロジェクト: kminkov/Blog
 protected function _initPluginCache()
 {
     if ($this->getEnvironment() != 'production') {
         return;
     }
     $file = APPLICATION_PATH . '/../data/plugin-cache.php';
     if (file_exists($file)) {
         include_once $file;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($file);
 }
コード例 #11
0
ファイル: Bootstrap.php プロジェクト: AlexChien/bbcoach
 protected function _initAutoLoader()
 {
     $classFileIncCache = APPLICATION_PATH . '/../datas/cache/pluginLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     if ($this->_config->enablePluginLoaderCache) {
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('Enterprise_');
 }
コード例 #12
0
 /**
  * Setup our cache
  */
 protected function _initAppCache()
 {
     $this->bootstrap('cachemanager');
     $metaCache = $this->getResource('cachemanager')->getCache('metadata');
     $dateCache = $this->getResource('cachemanager')->getCache('date');
     Zend_Db_Table_Abstract::setDefaultMetadataCache($metaCache);
     Zend_Date::setOptions(array('cache' => $dateCache));
     if ('production' === $this->getEnvironment()) {
         $classFileIncCache = APPLICATION_PATH . '/tmp/pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
 }
コード例 #13
0
ファイル: Bootstrap.php プロジェクト: abdala/la
 public function _initCache()
 {
     $this->bootstrap('cachemanager');
     $options = $this->getOption('resources');
     if (!$options['cachemanager']['default']['active']) {
         return;
     }
     $cache = $this->getPluginResource('cachemanager')->getCacheManager()->getCache('default');
     $classFileIncCache = APPLICATION_PATH . '/../data/cache/pluginLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
     Zend_Registry::set('cache', $cache);
 }
コード例 #14
0
ファイル: index.php プロジェクト: hirak/performance
function main()
{
    $key = 'app_performance';
    $config = apc_fetch($key, $success);
    if (!$success) {
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
        $config = $config->toArray();
        apc_store($key, $config);
    }
    $cachefile = APPLICATION_PATH . '/../data/cache/plugins.php';
    if (file_exists($cachefile)) {
        include_once $cachefile;
    }
    Zend_Loader_PluginLoader::setIncludeFileCache($cachefile);
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, $config);
    $application->bootstrap()->run();
}
コード例 #15
0
ファイル: Bootstrap.php プロジェクト: bokultis/kardiomedika
 /**
  * Set caching
  *
  * @return void
  */
 public function _initCache()
 {
     if (!Zend_Registry::isRegistered('cachemanager')) {
         return false;
     }
     $cache = HCMS_Cache::getInstance()->getCoreCache();
     //set cache for table metadata
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
     //set cache for locale
     Zend_Locale::setCache($cache);
     //set cache for translate
     Zend_Translate::setCache($cache);
     //plugin loader cache
     $classFileIncCache = APPLICATION_PATH . '/../cache/file/pluginLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
 }
コード例 #16
0
ファイル: Bootstrap.php プロジェクト: roed/zend-mvc-extend
 /**
  * Initialize the cache
  *
  * @return Zend_Cache_Core
  */
 protected function _initCache()
 {
     // Cache options
     $frontendOptions = array('lifetime' => 1200, 'automatic_serialization' => true);
     $backendOptions = array('cache_dir' => DATA_PATH . '/cache/');
     // DON'T cache in a development environment
     if ('development' == APPLICATION_ENV) {
         $frontendOptions['caching'] = false;
     } else {
         // enable Plugin Loader Cache - see ZF reference chapter 30.4.4.
         $classFileIncCache = $backendOptions['cache_dir'] . 'pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
     // Get a Zend_Cache_Core object
     $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
     // Set cache for Zend_Db_Table - see ZF reference chapter 15.5.12.
     Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
     //Zend_Registry::set('cache', $cache);
     // Return it, so that it can be stored by the bootstrap
     return $cache;
 }
コード例 #17
0
ファイル: Application.php プロジェクト: sgdoc/sgdoce-codigo
 /**
  * @see    Zend_Application::setOptions()
  * @param  array $options
  * @return Core_Application provides a fluent interface
  */
 public function setOptions(array $options)
 {
     if (!empty($options['config'])) {
         $options = $this->_mergeFilesRecursive($options);
         unset($options['config']);
     }
     if (!empty($options['pluginCache'])) {
         if (!is_string($options['pluginCache'])) {
             throw new Zend_Application_Exception('Plugin cache deve ser string');
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($options['pluginCache']);
         if (file_exists($options['pluginCache'])) {
             include_once $options['pluginCache'];
         }
     }
     return parent::setOptions($options);
 }
コード例 #18
0
ファイル: Loader.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Setup plugin loader
  *
  * @param Zend_Config $config
  * @return void
  */
 protected function _setupPluginLoader(Zend_Config $config)
 {
     $file = $config->get('include_file_cache');
     $classFileIncCache = $this->getApp()->getPath(Zym_App::PATH_DATA, $file);
     if (!$config->get('use_file_cache')) {
         // Delete existing file cache
         @unlink($classFileIncCache);
         return;
     }
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     /**
      * @see Zend_Loader_PluginLoader
      */
     require_once 'Zend/Loader/PluginLoader.php';
     Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
 }
コード例 #19
0
ファイル: Bootstrap.php プロジェクト: ngukho/ducbui-cms
 /**
  * Initialize the PluginLoader class file include cache
  *
  * 
  */
 protected function _initPluginLoaderCache()
 {
     $this->bootstrap('config');
     // Get config resource
     $config = $this->getResource('config');
     // Getting Better Performance for Plugins : Using the PluginLoader class file include cache
     $classFileIncCache = BASE_PATH . '/cache/pluginLoaderCache.php';
     if (file_exists($classFileIncCache)) {
         include_once $classFileIncCache;
     }
     if ($config->enablePluginLoaderCache) {
         Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
     }
 }
コード例 #20
0
ファイル: PluginLoaderTest.php プロジェクト: omusico/logica
 /**
  * @group ZF-4670
  */
 public function testPluginLoaderShouldAppendIncludeCacheWhenClassIsFound()
 {
     $cacheFile = $this->_includeCache;
     Zend_Loader_PluginLoader::setIncludeFileCache($cacheFile);
     $loader = new Zend_Loader_PluginLoader(array());
     $loader->addPrefixPath('Zend_View_Helper', $this->libPath . '/Zend/View/Helper');
     $loader->addPrefixPath('ZfTest', dirname(__FILE__) . '/_files/ZfTest');
     try {
         $className = $loader->load('CacheTest');
     } catch (Exception $e) {
         $paths = $loader->getPaths();
         $this->fail(sprintf("Failed loading helper; paths: %s", var_export($paths, 1)));
     }
     $this->assertTrue(file_exists($cacheFile));
     $cache = file_get_contents($cacheFile);
     $this->assertContains('CacheTest.php', $cache);
 }
コード例 #21
0
 /**
  * Initialize paths
  * 
  * @param string $basePath
  * @return string
  */
 public static function initPaths($basePath)
 {
     $loader = Zend_Loader_Autoloader::getInstance();
     $autoloader = new Zend_Application_Module_Autoloader(array('namespace' => '', 'basePath' => $basePath));
     $loader->registerNamespace('Uni_');
     /**
      * Plugin Loader cache management.
      */
     if (Fox::getMode() != Uni_Controller_Action::MODE_INSTALL) {
         $classFileIncCache = APPLICATION_PATH . '/../var/data/pluginLoaderCache.php';
         if (file_exists($classFileIncCache)) {
             include_once $classFileIncCache;
             Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
         }
     }
 }
コード例 #22
0
ファイル: index.php プロジェクト: smalyshev/chgk-teams
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
//define('APPLICATION_ENV', isset($_SERVER['APPLICATION_ENV'])?$_SERVER['APPLICATION_ENV']:'development');
define('APPLICATION_ENV', isset($_SERVER['APPLICATION_ENV']) ? $_SERVER['APPLICATION_ENV'] : 'production');
// Ensure library/ is on include_path
if (isset($_SERVER['ZF_PATH'])) {
    define('ZF_PATH', $_SERVER['ZF_PATH']);
} else {
    define('ZF_PATH', dirname(__FILE__) . "/../../zf");
}
set_include_path(implode(PATH_SEPARATOR, array(ZF_PATH . "/library", ".", realpath(APPLICATION_PATH . '/../library'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Zend_Loader_PluginLoader::setIncludeFileCache(APPLICATION_PATH . "/../data/pluginsCache.php");
$application->bootstrap()->run();
コード例 #23
0
ファイル: index.php プロジェクト: uglide/zfcore-transition
            $backendOptions = array("file_name_prefix" => APPLICATION_ENV . "_config", "cache_dir" => $appRootPath . "/data/cache", "cache_file_umask" => 0644);
            // getting a Zend_Cache_Core object
            $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
            if (!($result = $cache->load('application'))) {
                require_once 'Zend/Config/Yaml.php';
                require_once 'Core/Config/Yaml.php';
                $result = new Core_Config_Yaml($config, APPLICATION_ENV);
                $result = $result->toArray();
                $cache->save($result, 'application');
            }
            $config = $result;
        } else {
            throw new Exception('Config not founded!');
        }
    }
    $classFileIncCache = $appRootPath . '/data/cache/pluginLoaderCache.php';
    if (file_exists($classFileIncCache)) {
        include_once $classFileIncCache;
    }
    Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
    require_once 'Zend/Loader/AutoloaderFactory.php';
    require_once 'Zend/Loader/ClassMapAutoloader.php';
    Zend_Loader_AutoloaderFactory::factory(array('Zend_Loader_ClassMapAutoloader' => array($appRootPath . '/vendor/uglide/zendframework1/library/autoload_classmap.php', $appRootPath . '/library/autoload_classmap.php'), 'Zend_Loader_StandardAutoloader' => array('autoloadernamespaces' => $config['autoloadernamespaces'], 'fallback_autoloader' => true)));
    require_once 'Zend/Application.php';
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, $config);
    $application->bootstrap()->run();
} catch (Exception $exception) {
    Core_ErrorHandler::saveErrorInLog($exception, 'exception');
    Core_ErrorHandler::exitWithMessage('General Application Error!');
}