Index: trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php |
— | — | @@ -20,6 +20,18 @@ |
21 | 21 | static public function setApprovedRevForParsing( &$parser, &$text, &$stripState ) { |
22 | 22 | global $wgRequest; |
23 | 23 | if ( $wgRequest->getCheck( 'wpSave' ) ) { |
| 24 | + // @HACK !! If the Semantic Forms extension is being |
| 25 | + // used, the form will be parsed right before the page |
| 26 | + // is parsed, and there doesn't seem to be any way |
| 27 | + // to determine, from within this hook function, |
| 28 | + // which one is being parsed at the moment - we only |
| 29 | + // want to modify the parsing of the main page, not |
| 30 | + // of the form page. So look for a string that should |
| 31 | + // appear in every form page, but should really never |
| 32 | + // appear in non-form pages - '{{{for template'. |
| 33 | + if ( strpos( $text, '{{{for template' ) !== false ) { |
| 34 | + return true; |
| 35 | + } |
24 | 36 | $title = $parser->getTitle(); |
25 | 37 | if ( ! ApprovedRevs::pageIsApprovable( $title ) ) { |
26 | 38 | return true; |
— | — | @@ -137,6 +149,15 @@ |
138 | 150 | |
139 | 151 | global $wgRequest; |
140 | 152 | if ( $wgRequest->getCheck( 'oldid' ) ) { |
| 153 | + // If the user is looking at the latest revision, |
| 154 | + // disable caching, to avoid the wiki getting the |
| 155 | + // contents from the cache, and thus getting the |
| 156 | + // approved contents instead (seems to be an issue |
| 157 | + // only for MW >= 1.17). |
| 158 | + if ( $revisionID == $article->getLatest() ) { |
| 159 | + global $wgEnableParserCache; |
| 160 | + $wgEnableParserCache = false; |
| 161 | + } |
141 | 162 | return true; |
142 | 163 | } |
143 | 164 | |