/** * XXX write, test, use, document ... */ public function getCacheUrlFor($packages, $extension) { $cacheKey = ''; foreach ($packages as $package) { $cacheKey .= $package->getCacheKey(); } return $this->configuration->getOption(Dynamics_Configuration::RELATIVE_ROOT_URL) . $this->getUrlFor(md5($cacheKey), $extension); }
/** * generateSupercache - creates supercache file for given packages */ public function generateSupercache($url, $packages, $type) { if (!$this->configuration->isSupercacheEnabled()) { throw new BadMethodCallException('Supercache is disabled.'); } if (!file_exists($filename = $this->configuration->getOption(Dynamics_Configuration::WEB_DIR) . $url)) { $src = ''; foreach ($packages as $name => $package) { if ($renderedSrc = trim($this->getAsset($name, $package, $type))) { $src .= '/* ' . $name . ' */ ' . $renderedSrc . "\n"; } } if (strlen($src)) { file_put_contents($filename, $src); if (!file_exists($filename)) { throw new Exception('Supercache could not be written: ' . $filename); } } else { return false; } } return true; }