/** * Generate cache filename * * @return string md5 */ public function strategy() { //when session support is enabled add that to file name $session_str = SessionHandler::process(); $uri = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI']; $query = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING']; return md5($uri . $_SERVER['SCRIPT_NAME'] . $query . $session_str); }
/** * Generate cache file name * Sets a "-mob" ending to cache files for visitors coming from mobile devices (phones but not tablets) * * @return string file name */ public function strategy() { $ends = ''; if ($this->currentMobile()) { $ends = '-mob'; } //when session support is enabled add that to file name $session_str = SessionHandler::process(); $uri = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI']; $query = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING']; return md5($uri . $_SERVER['SCRIPT_NAME'] . $query . $session_str) . $ends; }
/** * @depends testEnableDisableStatus * @depends testExcludeKeys */ public function testProcess() { $_SESSION['testing'] = 'somevar'; SessionHandler::setStatus(false); $this->assertNull(SessionHandler::process()); SessionHandler::enable(); $this->assertContains('somevar', SessionHandler::process()); $this->assertEquals(serialize($_SESSION), SessionHandler::process()); $_SESSION['process'] = 'ignorethis'; $this->assertEquals(serialize($_SESSION), SessionHandler::process()); SessionHandler::excludeKeys(array('NonExistingSessionVariable')); SessionHandler::excludeKeys(array('process')); $process = SessionHandler::process(); $this->assertEquals(array('testing' => 'somevar'), unserialize($process)); }