r97978 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97977‎ | r97978 | r97979 >
Date:00:37, 24 September 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Removed action=raw support from HTMLFileCache. Obsolete due to RL.
Modified paths:
  • /trunk/phase3/includes/cache/HTMLFileCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/cache/HTMLFileCache.php
@@ -29,7 +29,7 @@
3030
3131 public function __construct( $title, $type = 'view' ) {
3232 $this->mTitle = $title;
33 - $this->mType = ($type == 'raw' || $type == 'view' ) ? $type : false;
 33+ $this->mType = ( $type == 'view' ) ? $type : false;
3434 $this->fileCacheName(); // init name
3535 }
3636
@@ -45,8 +45,8 @@
4646 throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' );
4747 }
4848
49 - # Store raw pages (like CSS hits) elsewhere
50 - $subdir = ($this->mType === 'raw') ? 'raw/' : '';
 49+ # Store other views of aspects of pages elsewhere
 50+ $subdir = ($this->mType === 'view') ? '' : "{$this->mType}/";
5151
5252 $key = $this->mTitle->getPrefixedDbkey();
5353 if ( $wgFileCacheDepth > 0 ) {
@@ -92,15 +92,13 @@
9393 $queryVals = $wgRequest->getValues();
9494 foreach( $queryVals as $query => $val ) {
9595 if( $query == 'title' || $query == 'curid' ) {
96 - continue;
 96+ continue; // note: curid sets title
9797 // Normal page view in query form can have action=view.
9898 // Raw hits for pages also stored, like .css pages for example.
9999 } elseif( $query == 'action' && $val == 'view' ) {
100100 continue;
101 - } elseif( $query == 'usemsgcache' && $val == 'yes' ) {
102 - continue;
103101 // Below are header setting params
104 - } elseif( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
 102+ } elseif( $query == 'maxage' || $query == 'smaxage' ) {
105103 continue;
106104 } else {
107105 return false;
@@ -158,14 +156,9 @@
159157 global $wgOut, $wgMimeType, $wgLanguageCode;
160158 wfDebug( __METHOD__ . "()\n");
161159 $filename = $this->fileCacheName();
162 - // Raw pages should handle cache control on their own,
163 - // even when using file cache. This reduces hits from clients.
164 - if( $this->mType !== 'raw' ) {
165 - $wgOut->sendCacheControl();
166 - header( "Content-Type: $wgMimeType; charset=UTF-8" );
167 - header( "Content-Language: $wgLanguageCode" );
168 - }
169 -
 160+ $wgOut->sendCacheControl();
 161+ header( "Content-Type: $wgMimeType; charset=UTF-8" );
 162+ header( "Content-Language: $wgLanguageCode" );
170163 if( $this->useGzip() ) {
171164 if( wfClientAcceptsGzip() ) {
172165 header( 'Content-Encoding: gzip' );
@@ -240,9 +233,6 @@
241234 $fc = new self( $title, 'view' );
242235 unlink( $fc->fileCacheName() );
243236
244 - $fc = new self( $title, 'raw' );
245 - unlink( $fc->fileCacheName() );
246 -
247237 wfRestoreWarnings();
248238
249239 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r97980FU r97978: removed more raw page file cache codeaaron00:55, 24 September 2011

Comments

#Comment by Krinkle (talk | contribs)   20:16, 24 September 2011

Alright, I'm totally not familiar with HTMLFileCache. Just wanna make note here that the time of usage of action=raw to load .css or .js is NOT over. There is still very significant usages of it, including in scripts that are loaded for anonymous users or some of the largest wikimedia wikis. Including enwiki, commonswiki, nlwiki and whatnot.

#Comment by Aaron Schulz (talk | contribs)   20:17, 24 September 2011

Note that wmf doesn't use filecache (it uses squid servers instead).

#Comment by Krinkle (talk | contribs)   20:19, 24 September 2011

OK. That's comforting for us :) But we may wanna postpone this for now though. importScript/actionRaw is also used a lot by other wikis. Mainly wikis copying/pasting from en.wikipedia.

#Comment by Hashar (talk | contribs)   16:22, 12 December 2011

As I understand it, importScript/actionRaw will still work for WMF wiki since the FileCache code is unused by the WMF.

Thus marking ok.

#Comment by Krinkle (talk | contribs)   18:09, 12 December 2011

And other wikis in the world that do use FileCache and have either copied (from WMF wikis) or written themselves many gadgets and user scripst using action=raw for loading styles and javascript (as well as extensions allowing custom styling/scripting from a wiki and loading it as a url, such as Geshi with MediaWiki:Geshi.css, granted should be using ResourceLoader by now).

#Comment by Krinkle (talk | contribs)   18:14, 12 December 2011

Sorry for complaining and all, I'm just making sure that support for action=raw is not dropped. I don't know whether this revision just changes it cache-wise or makes action=raw itself not work anymore properly. But imho action=raw is not obsolete at this time as there are still many valid use cases that are not covered (yet) by ResourceLoader - use cases that apply to all wikis, especially non-WMF wikis (those do use FileCache ?).

Those use cases may be covered in ResourceLoader2/Gadgets 2.0 but that's hasn't even been completed, or landed in trunk. If it's still actively used, why remove it from cache ?

#Comment by Krinkle (talk | contribs)   20:18, 24 September 2011

Where ? Custom user scripts and site script that are more advanced (e.g. what we're doing in ResourceLoader 2.0). Until ResourceLoader 2.0 is ready, deployed + 6 months after that, this will still be used a lot.

For all I know this revision is not related to that, but in case it is, this comment is to trigger something in the person that does know what this does.

Status & tagging log