Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -353,18 +353,8 @@ |
354 | 354 | * @param $context ResourceLoaderContext: Context in which a response should be formed |
355 | 355 | */ |
356 | 356 | public function respond( ResourceLoaderContext $context ) { |
357 | | - global $wgCacheEpoch, $wgUseFileCache; |
| 357 | + global $wgCacheEpoch; |
358 | 358 | |
359 | | - // Use file cache if enabled and available... |
360 | | - if ( $wgUseFileCache ) { |
361 | | - $type = 'resources-' . ( $context->getOnly() === 'styles' ? 'css' : 'js' ); |
362 | | - $hash = sha1( $context->getHash() . implode( ',', $context->getModules() ) ); |
363 | | - $fileCache = ObjectFileCache::newFromKey( $hash, $type ); |
364 | | - if ( $this->tryRespondFromFileCache( $fileCache, $context ) ) { |
365 | | - return; // output handled |
366 | | - } |
367 | | - } |
368 | | - |
369 | 359 | // Buffer output to catch warnings. Normally we'd use ob_clean() on the |
370 | 360 | // top-level output buffer to clear warnings, but that breaks when ob_gzhandler |
371 | 361 | // is used: ob_clean() will clear the GZIP header in that case and it won't come |
— | — | @@ -442,15 +432,6 @@ |
443 | 433 | ob_end_clean(); |
444 | 434 | echo $response; |
445 | 435 | |
446 | | - // Save response to file cache if enabled |
447 | | - if ( isset( $fileCache ) && !$private && !$exceptions && !$missing ) { |
448 | | - $request = $context->getRequest(); |
449 | | - // Don't cache URLs that the user was not given by site |
450 | | - if ( $request->getVal( 'fckey' ) == self::fileCacheKey( $request->getRequestURL() ) ) { |
451 | | - $fileCache->saveText( $response ); |
452 | | - } |
453 | | - } |
454 | | - |
455 | 436 | wfProfileOut( __METHOD__ ); |
456 | 437 | } |
457 | 438 | |
— | — | @@ -539,50 +520,6 @@ |
540 | 521 | } |
541 | 522 | |
542 | 523 | /** |
543 | | - * Send out code for a response from file cache if possible |
544 | | - * |
545 | | - * @param $fileCache ObjectFileCache: Cache object for this request URL |
546 | | - * @param $context ResourceLoaderContext: Context in which to generate a response |
547 | | - * @return bool If this found a cache file and handled the response |
548 | | - */ |
549 | | - protected function tryRespondFromFileCache( |
550 | | - ObjectFileCache $fileCache, ResourceLoaderContext $context |
551 | | - ) { |
552 | | - global $wgResourceLoaderMaxage; |
553 | | - // Buffer output to catch warnings. |
554 | | - ob_start(); |
555 | | - // Get the maximum age the cache can be |
556 | | - $maxage = is_null( $context->getVersion() ) |
557 | | - ? $wgResourceLoaderMaxage['unversioned']['server'] |
558 | | - : $wgResourceLoaderMaxage['versioned']['server']; |
559 | | - // Minimum timestamp the cache file must have |
560 | | - $good = $fileCache->isCacheGood( wfTimestamp( TS_MW, time() - $maxage ) ); |
561 | | - if ( !$good ) { |
562 | | - try { // RL always hits the DB on file cache miss... |
563 | | - wfGetDB( DB_SLAVE ); |
564 | | - } catch( DBConnectionError $e ) { // ...check if we need to fallback to cache |
565 | | - $good = $fileCache->isCacheGood(); // cache existence check |
566 | | - } |
567 | | - } |
568 | | - if ( $good ) { |
569 | | - $ts = $fileCache->cacheTimestamp(); |
570 | | - // Send content type and cache headers |
571 | | - $this->sendResponseHeaders( $context, $ts, false ); |
572 | | - // If there's an If-Modified-Since header, respond with a 304 appropriately |
573 | | - if ( $this->tryRespondLastModified( $context, $ts ) ) { |
574 | | - return; // output handled (buffers cleared) |
575 | | - } |
576 | | - $response = $fileCache->fetchText(); |
577 | | - // Remove the output buffer and output the response |
578 | | - ob_end_clean(); |
579 | | - echo $response . "\n/* Cached {$ts} */"; |
580 | | - return true; // cache hit |
581 | | - } |
582 | | - ob_end_clean(); |
583 | | - return false; // cache miss |
584 | | - } |
585 | | - |
586 | | - /** |
587 | 524 | * Generates code for a response |
588 | 525 | * |
589 | 526 | * @param $context ResourceLoaderContext: Context in which to generate a response |
— | — | @@ -975,32 +912,17 @@ |
976 | 913 | */ |
977 | 914 | public static function makeLoaderURL( $modules, $lang, $skin, $user = null, $version = null, $debug = false, $only = null, |
978 | 915 | $printable = false, $handheld = false, $extraQuery = array() ) { |
979 | | - global $wgLoadScript, $wgUseFileCache; |
| 916 | + global $wgLoadScript; |
980 | 917 | $query = self::makeLoaderQuery( $modules, $lang, $skin, $user, $version, $debug, |
981 | 918 | $only, $printable, $handheld, $extraQuery |
982 | 919 | ); |
983 | | - |
984 | | - $url = wfAppendQuery( $wgLoadScript, $query ); |
985 | | - // Avoid deliberate FS pollution with hand-made URLs |
986 | | - if ( $wgUseFileCache ) { |
987 | | - $url .= '&fckey=' . self::fileCacheKey( $url . '&*' ); |
988 | | - } |
989 | | - |
| 920 | + |
990 | 921 | // Prevent the IE6 extension check from being triggered (bug 28840) |
991 | | - // by appending a character that's invalid in Windows extensions ('*') |
992 | | - return $url . '&*'; |
| 922 | + // by appending a character that's invalid in Windows extensions ('*') |
| 923 | + return wfExpandUrl( wfAppendQuery( $wgLoadScript, $query ) . '&*', PROTO_RELATIVE ); |
993 | 924 | } |
994 | 925 | |
995 | 926 | /** |
996 | | - * Get a filecache key for a load.php URL |
997 | | - * @return string |
998 | | - */ |
999 | | - protected static function fileCacheKey( $url ) { |
1000 | | - global $wgSecretKey; |
1001 | | - return sha1( preg_replace( '/&fckey=[^&]*/', '', $url ) . $wgSecretKey . wfWikiID() ); |
1002 | | - } |
1003 | | - |
1004 | | - /** |
1005 | 927 | * Build a query array (array representation of query string) for load.php. Helper |
1006 | 928 | * function for makeLoaderURL(). |
1007 | 929 | * @return array |