/** * Handle GET request * * @throws \Exception */ function GET() { $key = static::EXTENSION . '_' . $this->name . '_' . $this->version; $files = $this->getFiles(); $this->sendHeaders($files); $cache = PooledCache::Get(get_called_class(), 'Memory'); $ret = $cache->get($key); if (!$ret || !\Radical\Core\Server::isProduction()) { $data = array(); foreach ($files as $f) { if (is_file($f)) { //Ignore folders $fn = basename($f); $data[$fn] = Individual::get_file($f); } } $ret = ''; foreach ($data as $f => $d) { if (!\Radical\Core\Server::isProduction()) { $ret .= "\r\n/* Including: " . $f . " */\r\n"; } $ret .= $d; } if (\Radical\Core\Server::isProduction()) { $ret = $this->optimize($ret); $cache->set($key, $ret); } } echo $ret; $headers = \Radical\Web\Page\Handler::top()->headers; $headers->setContentLength(strlen($ret)); $headers['Vary'] = 'Accept-Encoding'; }
function execute(array $arguments) { if (!isset($_SERVER['REQUEST_URI'])) { $this->_Execute($arguments); } else { $key = '__cron__' . $this->getName(); //because pool isnt working for file $fileCache = PooledCache::Get('cron', 'FileCache'); $lastExecute = (int) $fileCache->Get($key); $lastWantTo = time() - $this->getTime(); if (!$lastExecute || $lastExecute < $lastWantTo) { $this->_Execute($arguments); $fileCache->Set($key, time()); return true; } else { return false; } } }