r88639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88638‎ | r88639 | r88640 >
Date:14:09, 23 May 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
(bug 27756, bug 26328) Removed AJAX preview (on diff) loading: causes more trouble than it's worth. If any reincarnation is added it must handle these problems (which involve rethinking the page loading model). Also, diffs use the current page cache when possible. The focus should be on avoiding fragmentation. Additionally, diffonly=0 in review links could be altered (we already enumerate template/file changes).
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php
@@ -609,19 +609,6 @@
610610 $view->addToDiffView( $diff, $oldRev, $newRev );
611611 return true;
612612 }
613 -
614 - /*
615 - * If an article is reviewable, get custom article contents from the FlaggedPageView
616 - */
617 - public static function onArticleContentOnDiff( $diffEngine, $out ) {
618 - $fa = FlaggedPage::getTitleInstance( $out->getTitle() );
619 - if ( !$fa->isReviewable() ) {
620 - return true; // nothing to do
621 - }
622 - $view = FlaggedPageView::singleton();
623 - $view->addCustomContentHtml( $out, $diffEngine->getNewid() );
624 - return false;
625 - }
626613
627614 public static function addRevisionIDField( $editPage, $out ) {
628615 $view = FlaggedPageView::singleton();
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php
@@ -1844,19 +1844,4 @@
18451845 }
18461846 return true;
18471847 }
1848 -
1849 - /*
1850 - * If this is a diff page then replace the article contents with a link
1851 - * to the specific revision. This will be replaced with article content
1852 - * using javascript and an api call.
1853 - */
1854 - public function addCustomContentHtml( OutputPage $out, $newRevId ) {
1855 - $this->load();
1856 - if ( $newRevId ) {
1857 - $out->addHTML( "<div id='mw-fr-revisioncontents'><span class='plainlinks'>" );
1858 - $out->addWikiMsg( 'revcontents-getcontents',
1859 - $this->article->getTitle()->getPrefixedDBKey(), $newRevId );
1860 - $out->addHTML( "</span></div>" );
1861 - }
1862 - }
18631848 }
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js
@@ -197,78 +197,6 @@
198198 }
199199 };
200200
201 -
202 -// Get the revisioncontents div and replace it with actual parsed article contents via an API call
203 -FlaggedRevs.getRevisionContents = function() {
204 - var revContent = mw.config.get( 'wgRevContents' );
205 - var $frRevContents = $( '#mw-fr-revisioncontents' );
206 - var $prevLink = $( '#differences-prevlink' );
207 - var $nextLink = $( '#differences-nextlink' );
208 -
209 - if ( $frRevContents.size() ) {
210 - var diffUIParams = document.getElementById( 'mw-fr-diff-dataform' );
211 - var oldRevId = diffUIParams.getElementsByTagName( 'input' )[1].value;
212 - var origContents = $frRevContents.html();
213 - $frRevContents.html( '<span class="loading mw-small-spinner spinner"></span>'
214 - + '<span class="loading">' + mw.html.escape( revContent.waiting ) + '</span>' );
215 - var queryParams = {
216 - format: 'json',
217 - action: 'parse',
218 - prop: 'text|categorieshtml|languageshtml|headitems'
219 - };
220 - if ( mw.config.get( 'wgCurRevisionId' ) == oldRevId
221 - && mw.config.exists( 'wgPageName' ) )
222 - {
223 - queryParams.page = mw.config.get( 'wgPageName' );
224 - } else {
225 - queryParams.oldid = oldRevId;
226 - }
227 -
228 - var call = $.ajax({
229 - url: mw.config.get( 'wgScriptPath' ) + '/api.php',
230 - data: queryParams,
231 - dataType: 'json',
232 - success: function( result ) {
233 - if ( !result || !result.parse ) {
234 - return;
235 - }
236 - // Get data
237 - var parse = result.parse,
238 - text = parse.text,
239 - languageshtml = parse.languageshtml,
240 - categoryhtml = parse.categorieshtml;
241 - // Insert data into page
242 - if ( text && text['*'] ) {
243 - $frRevContents.empty().append( text['*'] );
244 - } else {
245 - $frRevContents.empty().append( revContent.error + ' ' + origContents );
246 - }
247 - if ( languageshtml && languageshtml['*'] ) {
248 - $frRevContents.append( '<div class="langlinks" >' +
249 - languageshtml['*'] + '</div>' );
250 - }
251 - if ( categoryhtml && categoryhtml['*'] ) {
252 - $('#catlinks').replaceWith( $(categoryhtml['*']) );
253 - }
254 - },
255 - error: function(xhttp, status, error) {
256 - $frRevContents.html( revContent.error + ' ' + origContents );
257 - }
258 - });
259 - }
260 - $prevLink.click( function() {
261 - if ( call ) {
262 - call.abort();
263 - }
264 - } );
265 - $nextLink.click( function() {
266 - if ( call ) {
267 - call.abort();
268 - }
269 - } );
270 -};
271 -
272201 // Perform some onload (which is when this script is included) events:
273202 FlaggedRevs.enableShowhide();
274203 FlaggedRevs.setCheckTrigger();
275 -FlaggedRevs.getRevisionContents();
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -517,9 +517,6 @@
518518 # Database schema changes
519519 $wgHooks['LoadExtensionSchemaUpdates'][] = 'FlaggedRevsUpdaterHooks::addSchemaUpdates';
520520
521 -# Performance Don't show content on diff
522 -$wgHooks['ArticleContentOnDiff'][] = 'FlaggedRevsUIHooks::onArticleContentOnDiff';
523 -
524521 # ########
525522
526523 function efSetFlaggedRevsConditionalHooks() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r88641Follow-up r88639: Removed revcontents_ messagesaaron14:29, 23 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83552* (bug 27756) When viewing diffs, syntax highlight is not being applyed anymo...reedy23:44, 8 March 2011

Comments

#Comment by RobLa-WMF (talk | contribs)   00:36, 24 May 2011

Aaron, I'm really surprised you made this change. On complicated pages, parse times make viewing diffs unusably slow. Do you have a plan for fixing the problems the Ajax loading of oldrevs was designed to address, or are you planning to ignore those problems?

#Comment by Aaron Schulz (talk | contribs)   02:38, 24 May 2011

The slowness on enwiki can be dealt with for now, if nothing else, by removing (or even inverting) the diffonly=0 param in links. This would have no drawback there. The trial there is ending though, so I'm not sure that's a priority atm.

Also, if you can see the diff but have to wait 20 seconds for the preview it's still bad. Perhaps users review before it loads...but in that case why bother with diffonly=0?

I'm looking into either avoiding diffonly=0 and/or caching pending revs (even daemon could populate it if needed to avoid users getting a first-miss penalty). Avoiding fragmentation will also help here.

I talked to Chad about removing this beforehand on IRC. I lost any confidence that those bugs or the r77896 comment have any chance of being dealt with. If anyone is interested in adding a more thought-out, fixed, version of deferred loading in the core, that's another matter.

#Comment by Aaron Schulz (talk | contribs)   03:15, 24 May 2011

Actually, given that RevisionReviewForm::getRevIncludes() is called to get inclusion versions for the review form, I'm not sure how ajax even makes the base page load faster.

Status & tagging log