/** * @return dmPageCacheLoader */ public static function getInstance() { if (!is_object(self::$instance)) { self::$instance = new dmPageCacheLoader(); } return self::$instance; }
public static function log($env = 'prod') { $browser = self::getBrowser(); $data = array('time' => $_SERVER['REQUEST_TIME'], 'uri' => substr(self::cleanUri($_SERVER['REQUEST_URI']), 0, 500), 'code' => 200, 'env' => $env, 'ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => substr($_SERVER['HTTP_USER_AGENT'], 0, 500), 'mem' => memory_get_peak_usage(true), 'duration' => microtime(true) - dmPageCacheLoader::getInstance()->start); $path = str_replace('diem/dmFrontPlugin/lib/cache/page', '', dirname(__FILE__)) . 'data/dm/log/static.log'; $fh = fopen($path, 'a'); fwrite($fh, implode('|', array_merge($data, $browser)) . "\n"); fclose($fh); if (filesize($path) > self::STATIC_LOG_MAX_SIZE) { file_put_contents($path, 'VIOLENT CLEAN UP OCCURRED!!!' . "\n"); } }
public function getURI() { return dmPageCacheLoader::getInstance()->getURI(); }
<?php require_once dirname(__FILE__) . '/../diem-extended/dmFrontPlugin/lib/cache/page/dmPageCacheLoader.class.php'; dmPageCacheLoader::load(dirname(__FILE__) . '/../cache/', 'prod'); require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php'; $configuration = ProjectConfiguration::getApplicationConfiguration('front', 'prod', false); dm::createContext($configuration)->dispatch();
protected function renderClearPageCache() { if ($this->user->can('clear_cache')) { return $this->helper->link('+/dmCore/clearPageCache')->param('cache', md5(dmPageCacheLoader::getInstance()->getURI()))->text('')->title($this->i18n->__('Clear page cache'))->set('.tipable.dm_clear_cache_link.widget16.s16block.s16_delete'); } }