/** * This callback is run before PHP invokes its class-level unserialize() * function and for reasons beyond the realms of human understanding (B.R.O.H.A), the * module is unable to do anything without this static unless you want * {@link Zend_Cache_Frontend_File} to be returned as an instance of _PHP_Incomplete_Class_ * instead. * * @see // See: http://zend-framework-community.634137.n4.nabble.com/Zend-Cache-dosent-seem-to-be-returning-the-object-I-saved-td646246.html * @return void */ public static function callback_spl() { require_once dirname(__FILE__) . '/../../../' . THIRDPARTY_DIR . '/Zend/Cache/Frontend/Class.php'; if (CacheableConfig::current_cache_mode() === 'memcached') { require_once dirname(__FILE__) . '/../../../' . THIRDPARTY_DIR . '/Zend/Cache/Backend/Libmemcached.php'; } if (CacheableConfig::current_cache_mode() === 'apc') { require_once dirname(__FILE__) . '/../../../' . THIRDPARTY_DIR . '/Zend/Cache/Backend/Apc.php'; } }
/** * * Generate key information about the object cache. * * @return HTMLText */ public function inspect() { $backend = ucfirst(CacheableConfig::current_cache_mode()); $backendData['PHPMemoryLimit'] = ini_get('memory_limit'); switch ($backend) { // File backend case 'File': $fileList = ArrayList::create(Cacheable::get_cache_files()); $backendData['FileTotal'] = $fileList->count(); $backendData['FileList'] = $fileList; $backendData['FileCacheDir'] = CACHEABLE_STORE_DIR; $backendData['FileSizeOnDisk'] = round($this->getCacheSize() / 1024, 2) . 'Kb'; $backendData['CacheLastEdited'] = $this->getCacheLastUpdated(); break; // Memcached backend // TODO // Memcached backend // TODO case 'memcached': // Memcache backend // TODO // Memcache backend // TODO case 'memcache': // APCu backend // TODO // APCu backend // TODO case 'apc': break; } $comparisonData = array('StatusList' => ArrayList::create(array($this->cacheToORMCompareDataObject('Stage', 'SiteTree'), $this->cacheToORMCompareDataObject('Live', 'SiteTree')))); $templateLocal = 'BackendData_' . $backend; $templateAbsolute = __DIR__ . '/../../templates/includes/' . $templateLocal . '.ss'; $bData = ''; if (file_exists($templateAbsolute)) { $bData = $this->renderWith($templateLocal, $backendData); } $backendData = array_merge(array('BackEndMode' => $backend), array('BackEndDataList' => $bData)); $viewable = array_merge($comparisonData, $backendData); return $this->renderWith('Inspector', $viewable); }
/** * * Summarise the task's configuration details at the end of a run. * * @param string $totalTime * @param SS_HTTPRequest $request * @param boolean $lowCount If the total no. pages is greater than * the chunk divisor, we don't attempt to chunk * and let the user know * @return void */ public function showConfig($totalTime, $request, $lowCount = false) { $skipQueue = $request->getVar('SkipQueue') && $request->getVar('SkipQueue') == 1; $queueOn = interface_exists('QueuedJob') ? 'On' : 'Off'; $queueSkipped = $skipQueue ? ' (Skipped: User instruction)' : ''; if ($lowCount && !$skipQueue) { $queueSkipped = ' (Skipped: Low page count)'; } /** * Is the system underpowered enough such that {@link CacheableConfig::configure_memory_limit()} * has kicked-in? Notify the user accordingly. */ $memMode = CacheableConfig::$ini_modified_memory_limit ? 'Auto-modified' : 'PHP Default'; echo 'Job Queue: ' . $queueOn . $queueSkipped . self::new_line(); echo 'Cache backend: ' . CacheableConfig::current_cache_mode() . self::new_line(); echo 'Peak memory: ' . $this->memory() . 'Mb' . self::new_line(); echo 'Execution time: ' . $totalTime . 's' . self::new_line(); echo 'System memory_limit: ' . ini_get('memory_limit') . ' (' . $memMode . ')' . self::new_line(); echo 'Cache directory: ' . CACHEABLE_STORE_DIR . self::new_line(); }