示例#1
0
 /**
  * Test locales.
  */
 function execute()
 {
     // Flush the file cache just to be certain we're using
     // the most recent stuff
     import('cache.CacheManager');
     $cacheManager =& CacheManager::getManager();
     $cacheManager->flush('locale');
     // Load plugins so that their locale data is included too
     $plugins = array();
     foreach (PluginRegistry::getCategories() as $category) {
         echo "Loading plugin category \"{$category}\"...\n";
         $morePlugins = PluginRegistry::loadCategory($category);
         if (is_array($morePlugins)) {
             $plugins += $morePlugins;
         }
     }
     foreach (Locale::getAllLocales() as $locale => $name) {
         if (!empty($this->locales) && !in_array($locale, $this->locales)) {
             continue;
         }
         if ($locale != MASTER_LOCALE) {
             echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n";
             $this->testLocale($locale, MASTER_LOCALE, $plugins);
             $this->testEmails($locale, MASTER_LOCALE);
         }
     }
 }
示例#2
0
 /**
  * Clear the data cache files (needed because of direct tinkering
  * with settings tables)
  * @return boolean
  */
 function clearDataCache()
 {
     $cacheManager = CacheManager::getManager();
     $cacheManager->flush(null, CACHE_TYPE_FILE);
     $cacheManager->flush(null, CACHE_TYPE_OBJECT);
     return true;
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     $cacheManager =& CacheManager::getManager();
     $cache =& $cacheManager->getFileCache('keywords_' . AppLocale::getLocale(), $journal->getId(), array(&$this, '_cacheMiss'));
     // If the cache is older than a couple of days, regenerate it
     if (time() - $cache->getCacheTime() > 60 * 60 * 24 * KEYWORD_BLOCK_CACHE_DAYS) {
         $cache->flush();
     }
     $keywords =& $cache->getContents();
     if (empty($keywords)) {
         return '';
     }
     // Get the max occurrences for all keywords
     $maxOccurs = array_shift(array_values($keywords));
     // Now sort the array alphabetically
     ksort($keywords);
     $page = Request::getRequestedPage();
     $op = Request::getRequestedOp();
     $templateMgr->assign_by_ref('cloudKeywords', $keywords);
     $templateMgr->assign_by_ref('maxOccurs', $maxOccurs);
     if ($page == 'index' && $op == 'index' || $page == 'issue' || $page == 'search') {
         return parent::getContents($templateMgr);
     } else {
         return '';
     }
 }
 /**
  * Get galley objects cache.
  * @return GenericCache
  */
 function &_getGalleyCache()
 {
     if (!isset($this->galleyCache)) {
         $cacheManager =& CacheManager::getManager();
         $this->galleyCache =& $cacheManager->getObjectCache('galley', 0, array(&$this, '_galleyCacheMiss'));
     }
     return $this->galleyCache;
 }
 /**
  * Clear the data cache.
  */
 function clearDataCache($args, &$request)
 {
     $this->validate();
     import('lib.pkp.classes.cache.CacheManager');
     $cacheManager =& CacheManager::getManager($request);
     $cacheManager->flush();
     $request->redirect('admin');
 }
 /**
  * Get the submission cache.
  * @return Cache
  */
 function _getCache()
 {
     if (!isset($this->cache)) {
         $cacheManager = CacheManager::getManager();
         $this->cache = $cacheManager->getObjectCache('submissions', 0, array(&$this, '_cacheMiss'));
     }
     return $this->cache;
 }
 function &_getArticlesInSectionsCache()
 {
     if (!isset($this->articlesInSectionsCache)) {
         $cacheManager =& CacheManager::getManager();
         $this->articlesInSectionsCache =& $cacheManager->getObjectCache('articlesInSections', 0, array(&$this, '_articlesInSectionsCacheMiss'));
     }
     return $this->articlesInSectionsCache;
 }
示例#8
0
 /**
  * Get supp file objects cache.
  * @return GenericCache
  */
 function &_getSuppFileCache()
 {
     if (!isset($this->suppFileCache)) {
         $cacheManager =& CacheManager::getManager();
         $this->suppFileCache =& $cacheManager->getObjectCache('suppfile', 0, array(&$this, '_suppFileCacheMiss'));
     }
     return $this->suppFileCache;
 }
示例#9
0
 function &_getCache()
 {
     if (!isset($this->cache)) {
         $cacheManager =& CacheManager::getManager();
         $this->cache =& $cacheManager->getObjectCache('monographs', 0, array(&$this, '_cacheMiss'));
     }
     return $this->cache;
 }
 function &_getCache()
 {
     $settingCache =& Registry::get('siteSettingCache', true, null);
     if ($settingCache === null) {
         $cacheManager =& CacheManager::getManager();
         $settingCache = $cacheManager->getFileCache('siteSettings', 'site', array($this, '_cacheMiss'));
     }
     return $settingCache;
 }
 function &_getCache()
 {
     static $settingCache;
     if (!isset($settingCache)) {
         import('cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $settingCache = $cacheManager->getCache('siteSettings', 'site', array($this, '_cacheMiss'));
     }
     return $settingCache;
 }
示例#12
0
 /**
  * Get an issue cache by cache ID.
  * @param $cacheId string
  * @return GenericCache
  */
 function _getCache($cacheId)
 {
     if (!isset($this->caches)) {
         $this->caches = array();
     }
     if (!isset($this->caches[$cacheId])) {
         $cacheManager = CacheManager::getManager();
         $this->caches[$cacheId] = $cacheManager->getObjectCache('issues', $cacheId, array($this, '_cacheMiss'));
     }
     return $this->caches[$cacheId];
 }
 protected function setUp()
 {
     $this->cacheManager = CacheManager::getManager();
     $this->cacheMisses = 0;
     if (!is_writable($this->cacheManager->getFileCachePath())) {
         $this->markTestSkipped('File cache path not writable.');
     } else {
         parent::setUp();
         $this->cacheManager->flush();
     }
 }
示例#14
0
 /**
  * Clear the data cache.
  * @param $args array
  * @param $request PKPRequest
  */
 function clearDataCache($args, $request)
 {
     // Clear the CacheManager's caches
     $cacheManager = CacheManager::getManager();
     $cacheManager->flush();
     // Clear ADODB's cache
     $userDao = DAORegistry::getDAO('UserDAO');
     // As good as any
     $userDao->flushCache();
     $request->redirect(null, 'admin');
 }
示例#15
0
 function &_getCache($journalId)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($settingCache[$journalId])) {
         $cacheManager =& CacheManager::getManager();
         $settingCache[$journalId] =& $cacheManager->getFileCache('journalSettings', $journalId, array($this, '_cacheMiss'));
     }
     return $settingCache[$journalId];
 }
 function &_getCache($conferenceId)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($settingCache[$conferenceId])) {
         $cacheManager =& CacheManager::getManager();
         $settingCache[$conferenceId] = $cacheManager->getCache('conferenceSettings', $conferenceId, array($this, '_cacheMiss'));
     }
     return $settingCache[$conferenceId];
 }
 function &_getCache($pluginName)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($this->settingCache[$pluginName])) {
         import('cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $this->settingCache[$pluginName] = $cacheManager->getCache('pluginSettings', $pluginName, array($this, '_cacheMiss'));
     }
     return $this->settingCache[$pluginName];
 }
 function &_getCache($sortOrderId)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($settingCache[$sortOrderId])) {
         import('cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $settingCache[$sortOrderId] = $cacheManager->getCache('sortOrderSettings', $sortOrderId, array($this, '_cacheMiss'));
     }
     return $settingCache[$sortOrderId];
 }
 function &_getCache($archiveId)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($settingCache[$archiveId])) {
         import('lib.pkp.classes.cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $settingCache[$archiveId] = $cacheManager->getCache('archiveSettings', $archiveId, array($this, '_cacheMiss'));
     }
     return $settingCache[$archiveId];
 }
 function &_getCache()
 {
     if (!isset($this->cache)) {
         $cacheManager =& CacheManager::getManager();
         $this->cache = $cacheManager->getFileCache('helpmap', md5($this->filename), array(&$this, '_cacheMiss'));
         // Check to see if the cache info is outdated.
         $cacheTime = $this->cache->getCacheTime();
         if ($cacheTime !== null && file_exists($this->filename) && $cacheTime < filemtime($this->filename)) {
             // The cached data is out of date.
             $this->cache->flush();
         }
     }
     return $this->cache;
 }
示例#21
0
 function &_getTimeZoneCache()
 {
     $cache =& Registry::get('allTimeZones', true, null);
     if ($cache === null) {
         $cacheManager = CacheManager::getManager();
         $cache = $cacheManager->getFileCache('timeZone', 'list', array($this, '_timeZoneCacheMiss'));
         // Check to see if the data is outdated
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getFilename())) {
             $cache->flush();
         }
     }
     return $cache;
 }
示例#22
0
 function &_getCache()
 {
     $locale = Locale::getLocale();
     $cache =& Registry::get('languageCache', true, null);
     if ($cache === null) {
         $cacheManager = CacheManager::getManager();
         $cache =& $cacheManager->getFileCache('languages', $locale, array(&$this, '_cacheMiss'));
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getLanguageFilename($locale))) {
             $cache->flush();
         }
     }
     return $cache;
 }
示例#23
0
 function _getCache()
 {
     $locale = AppLocale::getLocale();
     $cache =& Registry::get('currencyCache', true, null);
     if ($cache === null) {
         $cacheManager = CacheManager::getManager();
         $cache = $cacheManager->getFileCache('currencies', $locale, array($this, '_cacheMiss'));
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getCurrencyFilename($locale))) {
             $cache->flush();
         }
     }
     return $cache;
 }
 /**
  * Get the cache for plugin settings.
  * @param $contextId int Context ID
  * @param $pluginName string Plugin symbolic name
  * @return Cache
  */
 function _getCache($contextId, $pluginName)
 {
     static $settingCache;
     if (!isset($settingCache)) {
         $settingCache = array();
     }
     if (!isset($settingCache[$contextId])) {
         $settingCache[$contextId] = array();
     }
     if (!isset($settingCache[$contextId][$pluginName])) {
         $cacheManager = CacheManager::getManager();
         $settingCache[$contextId][$pluginName] = $cacheManager->getCache('pluginSettings-' . $contextId, $pluginName, array($this, '_cacheMiss'));
     }
     return $settingCache[$contextId][$pluginName];
 }
示例#25
0
 function &_getCache()
 {
     $locale = Locale::getLocale();
     static $cache;
     if (!isset($cache)) {
         import('cache.CacheManager');
         $cacheManager = CacheManager::getManager();
         $cache =& $cacheManager->getFileCache('currencies', $locale, array(&$this, '_cacheMiss'));
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getCurrencyFilename($locale))) {
             $cache->flush();
         }
     }
     return $cache;
 }
 /**
  * Language mappings are cached using the file cache system.
  * _getMapCache returns the cache object responsible for this.
  * @return object
  */
 function &_getMapCache()
 {
     static $cache;
     if (!isset($cache)) {
         import('lib.pkp.classes.cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $cache = $cacheManager->getFileCache($this->getName(), 'mapping', array(&$this, '_mapCacheMiss'));
         // Check to see if the cache is outdated.
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getPluginPath() . '/' . LANGUAGE_MAP_FILE)) {
             $cache->flush();
         }
     }
     return $cache;
 }
 /**
  * Type mappings are cached using the file cache system.
  * _getMapCache returns the cache object responsible for this.
  * @return object
  */
 function &_getMapCache(&$archive)
 {
     static $cache;
     if (!isset($cache)) {
         import('cache.CacheManager');
         $cacheManager =& CacheManager::getManager();
         $cache = $cacheManager->getFileCache($this->getName(), $archive->getArchiveId(), array(&$this, '_mapCacheMiss'));
         // Check to see if the cache is outdated.
         $cacheTime = $cache->getCacheTime();
         $typemap_file = 'typemap-' . $archive->getArchiveId() . '.xml';
         if ($cacheTime !== null && $cacheTime < filemtime($this->getPluginPath() . '/' . $typemap_file)) {
             $cache->flush();
         }
     }
     return $cache;
 }
示例#28
0
 function &_getCache($topicId)
 {
     $cache =& Registry::get('helpTopicCache', true, null);
     $locale = PKPHelp::getLocale();
     if (!isset($cache[$locale][$topicId])) {
         $help =& PKPHelp::getHelp();
         $cacheManager =& CacheManager::getManager();
         $cache[$locale][$topicId] = $cacheManager->getFileCache('help-topic-' . $locale, $topicId, array($this, '_cacheMiss'));
         // Check to see if the cache info is outdated.
         $cacheTime = $cache[$locale][$topicId]->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getFilename($topicId))) {
             // The cached data is out of date.
             $cache[$locale][$topicId]->flush();
         }
     }
     return $cache[$locale][$topicId];
 }
示例#29
0
 /**
  * Get the cache object for this locale file.
  */
 function &_getCache($locale)
 {
     if (!isset($this->cache)) {
         $cacheManager =& CacheManager::getManager();
         $this->cache = $cacheManager->getFileCache('locale', md5($this->filename), array(&$this, '_cacheMiss'));
         // Check to see if the cache is outdated.
         // Only some kinds of caches track cache dates;
         // if there's no date available (ie cachedate is
         // null), we have to assume it's up to date.
         $cacheTime = $this->cache->getCacheTime();
         if ($cacheTime === null || $cacheTime < filemtime($this->filename)) {
             // This cache is out of date; flush it.
             $this->cache->setEntireCache(LocaleFile::load($this->filename));
         }
     }
     return $this->cache;
 }
 /**
  * Get the codelist item cache.
  * @param $locale string Locale code (optional)
  * @return GenericCache
  */
 function _getCache($locale = null)
 {
     if ($locale == null) {
         $locale = AppLocale::getLocale();
     }
     $cacheName = $this->getCacheName();
     $cache =& Registry::get($cacheName, true, null);
     if ($cache === null) {
         $cacheManager = CacheManager::getManager();
         $cache = $cacheManager->getFileCache($this->getName() . '_codelistItems', $locale, array($this, '_cacheMiss'));
         $cacheTime = $cache->getCacheTime();
         if ($cacheTime !== null && $cacheTime < filemtime($this->getFilename($locale))) {
             $cache->flush();
         }
     }
     return $cache;
 }