public function getContent()
 {
     wfProfileIn(__METHOD__);
     $processingTimeStart = null;
     if ($this->mForceProfile) {
         $processingTimeStart = microtime(true);
     }
     $hash = wfAssetManagerGetSASShash($this->mOid);
     $paramsHash = md5(urldecode(http_build_query($this->mParams, '', ' ')));
     $cacheId = "/Sass-{$paramsHash}-{$hash}-" . self::CACHE_VERSION;
     $memc = F::App()->wg->Memc;
     $cachedContent = $memc->get($cacheId);
     if ($cachedContent) {
         $this->mContent = $cachedContent;
     } else {
         $this->processContent();
         // This is the final pass on contents which, among other things, performs minification
         parent::getContent($processingTimeStart);
         // Prevent cache poisoning if we are serving sass from preview server
         if (getHostPrefix() == null && !$this->mForceProfile) {
             $memc->set($cacheId, $this->mContent);
         }
     }
     wfProfileOut(__METHOD__);
     return $this->mContent;
 }
예제 #2
0
 private function getAMLocalURL($type, $oid, $params = array())
 {
     wfProfileIn(__METHOD__);
     global $wgAssetsManagerQuery, $IP, $wgSpeedBox, $wgDevelEnvironment;
     $cb = $this->mCacheBuster;
     if (!empty($wgSpeedBox) && !empty($wgDevelEnvironment)) {
         if ($type == 'sass') {
             $cb = hexdec(substr(wfAssetManagerGetSASShash($IP . '/' . $oid), 0, 8));
         } else {
             if ($type == 'one' && endsWith($oid, '.js')) {
                 $cb = filemtime($IP . '/' . $oid);
             }
         }
     }
     $url = sprintf($wgAssetsManagerQuery, $type, $oid, !empty($params) ? urlencode(http_build_query($params)) : '-', $cb);
     wfProfileOut(__METHOD__);
     return $url;
 }