Exemplo n.º 1
0
 public function preDispatch()
 {
     if ($this->_getParam('applicationAssetsVersion')) {
         if (Kwf_Assets_Dispatcher::getAssetsVersion() != $this->_getParam('applicationAssetsVersion')) {
             $this->_forward('json-wrong-version', 'error', 'kwf_controller_action_error');
             return;
         }
     }
     $this->_validateSessionToken();
     $allowed = false;
     if ($this->_getUserRole() == 'cli') {
         $allowed = true;
     } else {
         $acl = Zend_Registry::get('acl');
         $resource = $this->getRequest()->getResourceName();
         if (!$acl->has($resource)) {
             throw new Kwf_Exception_NotFound();
         } else {
             if ($this->_getAuthData()) {
                 $allowed = $acl->isAllowedUser($this->_getAuthData(), $resource, 'view');
             } else {
                 $allowed = $acl->isAllowed($this->_getUserRole(), $resource, 'view');
             }
         }
     }
     if (!$allowed) {
         $params = array('resource' => $resource, 'role' => $this->_getUserRole());
         $this->_forward('json-login', 'login', 'kwf_controller_action_user', $params);
     }
     parent::preDispatch();
 }
 public function showAssetPackageSizesAction()
 {
     $a = new Kwf_Util_Build_Types_Assets();
     $packages = $a->getAllPackages();
     $langs = $a->getAllLanguages();
     $exts = array('js', 'defer.js', 'css');
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         $language = $langs[0];
         foreach ($exts as $extension) {
             $cacheId = Kwf_Assets_Dispatcher::getCacheIdByPackage($p, $extension, $language);
             $cacheContents = Kwf_Assets_BuildCache::getInstance()->load($cacheId);
             echo "{$depName} ";
             $h = new Kwf_View_Helper_FileSize();
             echo "{$extension} size: " . $h->fileSize(strlen(gzencode($cacheContents['contents'], 9, FORCE_GZIP)));
             echo "\n";
         }
     }
     $d = Kwf_Assets_Package_Default::getDefaultProviderList()->findDependency('Frontend');
     foreach ($d->getFilteredUniqueDependencies('text/javascript') as $i) {
         if ($i instanceof Kwf_Assets_Dependency_File && $i->getType() == 'ext2') {
             echo "\n[WARNING] Frontend text/javascript contains ext2\n";
             echo "To improve frontend performance all ext2 dependencies should be moved to defer\n\n";
             break;
         }
     }
     exit;
 }
Exemplo n.º 3
0
 public function preDispatch()
 {
     if ($this->_getParam('applicationAssetsVersion') && $this->getHelper('ViewRenderer')->isJson()) {
         if (Kwf_Assets_Dispatcher::getInstance()->getAssetsVersion() != $this->_getParam('applicationAssetsVersion')) {
             $this->_forward('json-wrong-version', 'error', 'kwf_controller_action_error');
             return;
         }
     }
     $this->_validateSessionToken();
     $t = microtime(true);
     $allowed = $this->_isAllowedResource();
     if ($allowed) {
         $allowed = $this->_isAllowed($this->_getAuthData());
     }
     if (!$allowed) {
         $params = array('role' => $this->_getUserRole());
         if ($this->getHelper('ViewRenderer')->isJson()) {
             $this->_forward('json-login', 'login', 'kwf_controller_action_user', $params);
         } else {
             $params = array('location' => $this->getRequest()->getBaseUrl() . '/' . ltrim($this->getRequest()->getPathInfo(), '/'));
             $this->_forward('index', 'login', 'kwf_controller_action_user', $params);
         }
     }
     Kwf_Benchmark::subCheckpoint('check acl', microtime(true) - $t);
 }
Exemplo n.º 4
0
 public function jsonWrongVersionAction()
 {
     $this->view->wrongversion = true;
     $this->view->success = false;
     $this->view->assetsVersion = Kwf_Assets_Dispatcher::getAssetsVersion();
     $this->getResponse()->setRawHeader('HTTP/1.0 428 Precondition Required');
     $this->getResponse()->setHttpResponseCode(428);
 }
 public function testPackageDispatch()
 {
     $package = new Kwf_Assets_Package($this->_list, 'Test');
     $urls = $package->getPackageUrls('text/javascript', 'en');
     $this->assertEquals(1, count($urls));
     $url = $urls[0];
     $output = Kwf_Assets_Dispatcher::getInstance()->getOutputForUrl($url, Kwf_Media_Output::ENCODING_NONE);
     $contents = trim($output['contents']);
     $contents = str_replace("\n\n", "\n", $contents);
     $this->assertRegExp("/^foo2;\nbar2;\nfoo;\nbar;\n\\/\\/# sourceMappingURL=/", $contents);
 }
Exemplo n.º 6
0
 public function flagAllPackagesOutdated($extension)
 {
     $langs = $this->getAllLanguages();
     $packages = $this->getAllPackages();
     foreach ($packages as $p) {
         foreach ($langs as $language) {
             $cacheId = Kwf_Assets_Dispatcher::getCacheIdByPackage($p, $extension, $language);
             if (Kwf_Assets_BuildCache::getInstance()->load($cacheId) !== false) {
                 Kwf_Assets_BuildCache::getInstance()->save('outdated', $cacheId);
             }
             $cacheId = Kwf_Assets_Dispatcher::getCacheIdByPackage($p, $extension . '.map', $language);
             if (Kwf_Assets_BuildCache::getInstance()->load($cacheId) !== false) {
                 Kwf_Assets_BuildCache::getInstance()->save('outdated', $cacheId);
             }
         }
     }
 }
Exemplo n.º 7
0
 public function getContents($language)
 {
     $ret = "if (typeof Kwf == 'undefined') Kwf = {};" . "Kwf.application = { assetsVersion: '" . Kwf_Assets_Dispatcher::getAssetsVersion() . "' };\n";
     return $ret;
 }
Exemplo n.º 8
0
 protected function _build($options)
 {
     if (!file_exists('build/assets')) {
         mkdir('build/assets');
     }
     Kwf_Assets_BuildCache::getInstance()->building = true;
     Kwf_Assets_BuildCache::getInstance()->clean();
     Kwf_Assets_BuildCache::getInstance()->save(time(), 'assetsVersion');
     $langs = $this->_getAllLanguages();
     $packages = $this->_getAllPackages();
     $exts = array('js', 'defer.js', 'css', 'printcss');
     echo "\ncalculating dependencies...\n";
     $steps = count($packages) * count($exts);
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(50);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     $countDependencies = 0;
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         foreach ($exts as $extension) {
             $progress->next(1, "{$depName} {$extension}");
             $countDependencies += count($p->getFilteredUniqueDependencies(self::$_mimeTypeByExtension[$extension]));
             $cacheId = $p->getMaxMTimeCacheId(self::$_mimeTypeByExtension[$extension]);
             if (!$cacheId) {
                 throw new Kwf_Exception("Didn't get cacheId for " . get_class($p));
             }
             $maxMTime = $p->getMaxMTime(self::$_mimeTypeByExtension[$extension]);
             Kwf_Assets_BuildCache::getInstance()->save($maxMTime, $cacheId);
             //save generated caches for clear-cache-watcher
             $fileName = 'build/assets/package-max-mtime-' . $extension;
             if (!file_exists($fileName) || strpos(file_get_contents($fileName), $cacheId . "\n") === false) {
                 file_put_contents($fileName, $cacheId . "\n", FILE_APPEND);
             }
         }
     }
     $progress->finish();
     echo "compiling assets...\n";
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(50);
     $progress = new Zend_ProgressBar($c, 0, $countDependencies);
     foreach ($packages as $p) {
         foreach ($exts as $extension) {
             foreach ($p->getFilteredUniqueDependencies(self::$_mimeTypeByExtension[$extension]) as $dep) {
                 $progress->next(1, "{$dep}");
                 $dep->warmupCaches();
             }
         }
     }
     $progress->finish();
     echo "generating packages...\n";
     $steps = count($packages) * count($langs) * count($exts) * 4;
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(50);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         foreach ($langs as $language) {
             foreach ($exts as $extension) {
                 $packageContents = $p->getPackageContents(self::$_mimeTypeByExtension[$extension], $language);
                 $maxMTime = $p->getMaxMTime(self::$_mimeTypeByExtension[$extension]);
                 $progress->next(1, "{$depName} {$extension} {$language}");
                 $progress->next(1, "{$depName} {$extension} {$language} source");
                 $this->_buildPackageContents($packageContents, $maxMTime, $p, $extension, $language);
                 $progress->next(1, "{$depName} {$extension} {$language} map");
                 $this->_buildPackageSourceMap($packageContents, $maxMTime, $p, $extension, $language);
                 $progress->next(1, "{$depName} {$extension} {$language} url");
                 $urls = $p->getPackageUrls(self::$_mimeTypeByExtension[$extension], $language);
                 if (Kwf_Setup::getBaseUrl()) {
                     foreach ($urls as $k => $i) {
                         $urls[$k] = substr($i, strlen(Kwf_Setup::getBaseUrl()));
                     }
                 }
                 $cacheId = $p->getPackageUrlsCacheId(self::$_mimeTypeByExtension[$extension], $language);
                 Kwf_Assets_BuildCache::getInstance()->save($urls, $cacheId);
             }
         }
     }
     Kwf_Assets_Cache::getInstance()->clean();
     Kwf_Assets_BuildCache::getInstance()->building = false;
     $exts = array('js', 'defer.js', 'css');
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         $language = $langs[0];
         foreach ($exts as $extension) {
             $cacheId = Kwf_Assets_Dispatcher::getCacheIdByPackage($p, $extension, $language);
             $cacheContents = Kwf_Assets_BuildCache::getInstance()->load($cacheId);
             echo "{$depName} ";
             $h = new Kwf_View_Helper_FileSize();
             echo "{$extension} size: " . $h->fileSize(strlen(gzencode($cacheContents['contents'], 9, FORCE_GZIP)));
             echo "\n";
         }
     }
     $d = Kwf_Assets_Package_Default::getDefaultProviderList()->findDependency('Frontend');
     foreach ($d->getFilteredUniqueDependencies('text/javascript') as $i) {
         if ($i instanceof Kwf_Assets_Dependency_File && $i->getType() == 'ext2') {
             echo "\n[WARNING] Frontend text/javascript contains ext2\n";
             echo "To improve frontend performance all ext2 dependencies should be moved to defer\n\n";
             break;
         }
     }
 }
Exemplo n.º 9
0
 public function getPackageUrl($ext, $language)
 {
     return Kwf_Setup::getBaseUrl() . '/assets/dependencies/' . get_class($this) . '/' . $this->toUrlParameter() . '/' . $language . '/' . $ext . '?v=' . Kwf_Assets_Dispatcher::getInstance()->getAssetsVersion();
 }
Exemplo n.º 10
0
 public function getFileContents($file, $language = null)
 {
     $ret = array();
     if (substr($file, -4) == '.gif') {
         $ret['mimeType'] = 'image/gif';
     } else {
         if (substr($file, -4) == '.png') {
             $ret['mimeType'] = 'image/png';
         } else {
             if (substr($file, -4) == '.jpg') {
                 $ret['mimeType'] = 'image/jpeg';
             } else {
                 if (substr($file, -4) == '.mp4') {
                     $ret['mimeType'] = 'video/mp4';
                 } else {
                     if (substr($file, -5) == '.webm') {
                         $ret['mimeType'] = 'video/webm';
                     } else {
                         if (substr($file, -4) == '.css' || substr($file, -5) == '.scss') {
                             $ret['mimeType'] = 'text/css; charset=utf-8';
                             if (!Kwf_Assets_Dispatcher::allowSourceAccess()) {
                                 throw new Kwf_Exception_AccessDenied();
                             }
                         } else {
                             if (substr($file, -3) == '.js') {
                                 $ret['mimeType'] = 'text/javascript; charset=utf-8';
                                 if (!Kwf_Assets_Dispatcher::allowSourceAccess()) {
                                     throw new Kwf_Exception_AccessDenied();
                                 }
                             } else {
                                 if (substr($file, -4) == '.swf') {
                                     $ret['mimeType'] = 'application/flash';
                                 } else {
                                     if (substr($file, -4) == '.ico') {
                                         $ret['mimeType'] = 'image/x-icon';
                                     } else {
                                         if (substr($file, -5) == '.html') {
                                             $ret['mimeType'] = 'text/html; charset=utf-8';
                                         } else {
                                             if (substr($file, -4) == '.otf') {
                                                 // für Schriften
                                                 $ret['mimeType'] = 'application/octet-stream';
                                             } else {
                                                 if (substr($file, -4) == '.eot') {
                                                     // für Schriften
                                                     $ret['mimeType'] = 'application/vnd.ms-fontobject';
                                                 } else {
                                                     if (substr($file, -4) == '.svg') {
                                                         // für Schriften
                                                         $ret['mimeType'] = 'image/svg+xml';
                                                     } else {
                                                         if (substr($file, -4) == '.ttf') {
                                                             // für Schriften
                                                             $ret['mimeType'] = 'application/octet-stream';
                                                         } else {
                                                             if (substr($file, -5) == '.woff') {
                                                                 // für Schriften
                                                                 $ret['mimeType'] = 'application/font-woff';
                                                             } else {
                                                                 if (substr($file, -6) == '.woff2') {
                                                                     // für Schriften
                                                                     $ret['mimeType'] = 'application/font-woff2';
                                                                 } else {
                                                                     if (substr($file, -4) == '.htc') {
                                                                         // für ie css3
                                                                         $ret['mimeType'] = 'text/x-component';
                                                                     } else {
                                                                         if (substr($file, -4) == '.pdf') {
                                                                             $ret['mimeType'] = 'application/pdf';
                                                                         } else {
                                                                             throw new Kwf_Assets_NotFoundException("Invalid filetype ({$file})");
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (substr($ret['mimeType'], 0, 5) == 'text/') {
         $ret['mtime'] = time();
         $file = new Kwf_Assets_Dependency_File($file);
         if (!$file->getAbsoluteFileName() || !file_exists($file->getAbsoluteFileName())) {
             throw new Kwf_Exception_NotFound();
         }
         $ret['contents'] = $file->getContents(null);
     } else {
         $fx = substr($file, 0, strpos($file, '/'));
         if (substr($fx, 0, 3) == 'fx_') {
             $cache = Kwf_Assets_Cache::getInstance();
             $cacheId = 'fileContents' . str_replace(array('/', '.', '-', ':'), array('_', '_', '_', '_'), $file);
             if (!($cacheData = $cache->load($cacheId))) {
                 if (substr($ret['mimeType'], 0, 6) != 'image/') {
                     throw new Kwf_Exception("Fx is only possible for images");
                 }
                 $im = new Imagick();
                 if (substr($file, -4) == '.ico') {
                     $im->setFormat('ico');
                 }
                 //required because imagick can't autodetect ico format
                 $file = new Kwf_Assets_Dependency_File(substr($file, strpos($file, '/') + 1));
                 $im->readImage($file->getAbsoluteFileName());
                 $fx = explode('_', substr($fx, 3));
                 foreach ($fx as $i) {
                     $params = array();
                     if (($pos = strpos($i, '-')) !== false) {
                         $params = explode('-', substr($i, $pos + 1));
                         $i = substr($i, 0, $pos);
                     }
                     call_user_func(array('Kwf_Assets_Effects', $i), $im, $params);
                 }
                 $cacheData['mtime'] = $file->getMTime();
                 $cacheData['contents'] = $im->getImagesBlob();
                 $im->destroy();
                 $cache->save($cacheData, $cacheId);
             }
             $ret['contents'] = $cacheData['contents'];
             $ret['mtime'] = time();
         } else {
             $ret['mtime'] = time();
             $file = new Kwf_Assets_Dependency_File($file);
             if (!file_exists($file->getAbsoluteFileName())) {
                 throw new Kwf_Exception_NotFound();
             }
             $ret['contents'] = $file->getContents(null);
         }
     }
     return $ret;
 }
Exemplo n.º 11
0
 protected function _build($options)
 {
     if (!file_exists('build/assets')) {
         mkdir('build/assets');
     }
     Kwf_Assets_BuildCache::getInstance()->building = true;
     Kwf_Assets_BuildCache::getInstance()->clean();
     Kwf_Assets_BuildCache::getInstance()->save(time(), 'assetsVersion');
     $langs = $this->getAllLanguages();
     $packages = $this->getAllPackages();
     $exts = array('js', 'defer.js', 'css', 'ie8.css', 'ie8.js');
     $providers = array();
     foreach ($packages as $p) {
         foreach ($p->getProviderList()->getProviders() as $provider) {
             if (!in_array($provider, $providers)) {
                 $providers[] = $provider;
             }
         }
     }
     echo "\ninitializing providers...\n";
     $steps = count($providers);
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(80);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     foreach ($providers as $provider) {
         $progress->next(1, get_class($provider));
         $provider->initialize();
     }
     $progress->finish();
     echo "calculating dependencies...\n";
     $steps = count($packages) * count($exts);
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(80);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     $countDependencies = 0;
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         foreach ($exts as $extension) {
             $progress->next(1, "{$depName} {$extension}");
             $p->getFilteredUniqueDependencies(self::$_mimeTypeByExtension[$extension]);
         }
         $it = new RecursiveIteratorIterator(new Kwf_Assets_Dependency_Iterator_UniqueFilter(new Kwf_Assets_Dependency_Iterator_Recursive($p->getDependency(), Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_ALL)), RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($it as $i) {
             $countDependencies++;
         }
     }
     $progress->finish();
     echo "compiling assets...\n";
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_ETA, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(80);
     $progress = new Zend_ProgressBar($c, 0, $countDependencies);
     foreach ($packages as $p) {
         $it = new RecursiveIteratorIterator(new Kwf_Assets_Dependency_Iterator_UniqueFilter(new Kwf_Assets_Dependency_Iterator_Recursive($p->getDependency(), Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_ALL)), RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($it as $dep) {
             $progress->next(1, "{$dep}");
             if ($dep->getMimeType()) {
                 $mimeType = $dep->getMimeType();
                 $p->warmupDependencyCaches($dep, $mimeType, $progress);
                 if ($mimeType == 'text/css') {
                     $p->warmupDependencyCaches($dep, 'text/css; ie8', $progress);
                 }
             }
         }
     }
     $progress->finish();
     echo "generating package urls...\n";
     $steps = count($packages) * count($langs) * count($exts);
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(80);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     $allUrls = array();
     foreach ($packages as $p) {
         $depName = $p->getDependencyName();
         foreach ($langs as $language) {
             foreach ($exts as $extension) {
                 $progress->next(1, "{$depName} {$extension} {$language}");
                 $urls = $p->getPackageUrls(self::$_mimeTypeByExtension[$extension], $language);
                 if (Kwf_Setup::getBaseUrl()) {
                     foreach ($urls as $k => $i) {
                         $urls[$k] = substr($i, strlen(Kwf_Setup::getBaseUrl()));
                     }
                 }
                 $cacheId = $p->getPackageUrlsCacheId(self::$_mimeTypeByExtension[$extension], $language);
                 Kwf_Assets_BuildCache::getInstance()->save($urls, $cacheId);
                 foreach ($urls as $url) {
                     if (!in_array($url, $allUrls)) {
                         $allUrls[] = $url;
                     }
                 }
             }
         }
     }
     echo "generating package contents...\n";
     $steps = count($allUrls) * 2;
     $c = new Zend_ProgressBar_Adapter_Console();
     $c->setElements(array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR, Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT));
     $c->setTextWidth(80);
     $progress = new Zend_ProgressBar($c, 0, $steps);
     foreach ($allUrls as $url) {
         if (substr($url, 0, 8) != '/assets/') {
             continue;
         }
         $param = explode('/', $url);
         if (count($param) != 7) {
             continue;
         }
         $dependencyClass = $param[3];
         $dependencyParams = $param[4];
         $urlLanguage = $param[5];
         $urlExtension = $param[6];
         $urlExtension = substr($urlExtension, 0, strpos($urlExtension, '?'));
         if (!class_exists($dependencyClass)) {
             throw new Kwf_Exception();
         }
         if (!is_instance_of($dependencyClass, 'Kwf_Assets_Interface_UrlResolvable')) {
             throw new Kwf_Exception();
         }
         $p = call_user_func(array($dependencyClass, 'fromUrlParameter'), $dependencyClass, $dependencyParams);
         if (!$p instanceof Kwf_Assets_Package) {
             throw new Kwf_Exception();
         }
         $contents = $p->getUrlContents($urlExtension, $urlLanguage);
         $progress->next(1, "{$p->getDependencyName()} {$urlExtension} {$urlLanguage} source");
         $cacheId = Kwf_Assets_Dispatcher::getInstance()->getCacheIdByPackage($p, $urlExtension, $urlLanguage);
         Kwf_Assets_BuildCache::getInstance()->save($contents, $cacheId);
         //save generated caches for clear-cache-watcher
         $fileName = 'build/assets/output-cache-ids-' . $urlExtension;
         if (!file_exists($fileName) || strpos(file_get_contents($fileName), $cacheId . "\n") === false) {
             file_put_contents($fileName, $cacheId . "\n", FILE_APPEND);
         }
         $contents = $p->getUrlContents($urlExtension . '.map', $urlLanguage);
         $progress->next(1, "{$p->getDependencyName()} {$urlExtension} {$urlLanguage} map");
         $cacheId = Kwf_Assets_Dispatcher::getInstance()->getCacheIdByPackage($p, $urlExtension . '.map', $urlLanguage);
         Kwf_Assets_BuildCache::getInstance()->save($contents, $cacheId);
     }
     Kwf_Assets_Cache::getInstance()->clean();
     Kwf_Assets_BuildCache::getInstance()->building = false;
 }
 public function getContentsPacked()
 {
     $ret = "if (typeof Kwf == 'undefined') Kwf = {};" . "Kwf.application = { assetsVersion: '" . Kwf_Assets_Dispatcher::getInstance()->getAssetsVersion() . "' };\n";
     return Kwf_SourceMaps_SourceMap::createEmptyMap($ret);
 }