r75865 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75864‎ | r75865 | r75866 >
Date:18:57, 2 November 2010
Author:questpc
Status:deferred (Comments)
Tags:
Comment:
v 0.2.1. Separate settings for user groups allowed to perform wiki synchronization at both directions. Firefox JS UI fixes.
Modified paths:
  • /trunk/extensions/WikiSync/INSTALL (modified) (history)
  • /trunk/extensions/WikiSync/README (modified) (history)
  • /trunk/extensions/WikiSync/WikiSync.js (modified) (history)
  • /trunk/extensions/WikiSync/WikiSync.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSyncApi.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSyncBasic.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSyncClient.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSyncExporter.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSyncPage.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSync_i18n.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSync_utils.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiSync/WikiSyncExporter.php
@@ -28,7 +28,7 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
Index: trunk/extensions/WikiSync/WikiSyncApi.php
@@ -28,7 +28,7 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
@@ -150,6 +150,7 @@
151151 }
152152 # place result list items into attributes of <similarrev> xml tag
153153 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'similarrev' );
 154+ unset( $dbres );
154155 }
155156
156157 private function extractRowInfo( $row ) {
@@ -337,6 +338,7 @@
338339 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'revision' );
339340 // $this->getResult()->setIndexedTagName( $resultData, 'page' );
340341 // $this->getResult()->addValue( null, $this->getModuleName(), $resultData );
 342+ unset( $dbres );
341343 }
342344 }
343345
@@ -507,7 +509,8 @@
508510 $this->dieUsageMsg( array( 'missingparam', 'timestamp' ) );
509511 }
510512 if ( !$this->getMain()->canApiHighLimits() ) {
511 - $this->dieUsageMsg( array( 'actionthrottledtext' ) );
 513+ // throttle a non-priviledged user
 514+ sleep( 1 );
512515 }
513516 $title = Title::newFromText( $params['title'], NS_FILE );
514517 if ( $title instanceof Title ) {
Index: trunk/extensions/WikiSync/WikiSyncPage.php
@@ -28,7 +28,7 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
@@ -45,6 +45,8 @@
4646 var $remote_log_tpl;
4747 var $page_tpl;
4848
 49+ var $initUser;
 50+
4951 function initRemoteLoginFormTpl() {
5052 $remote_wiki_root = _QXML::specialchars( WikiSyncSetup::$remote_wiki_root );
5153 $remote_wiki_user = _QXML::specialchars( WikiSyncSetup::$remote_wiki_user );
@@ -176,6 +178,7 @@
177179 $outputPage->addScript(
178180 '<script type="' . $wgJsMimeType . '" src="' . WikiSyncSetup::$ScriptPath . '/WikiSync.js?' . WikiSyncSetup::$version . '"></script>
179181 <script type="' . $wgJsMimeType . '" src="' . WikiSyncSetup::$ScriptPath . '/WikiSync_Utils.js?' . WikiSyncSetup::$version . '"></script>
 182+ <script type="' . $wgJsMimeType . '">WikiSyncUtils.addEvent(window,"load",WikiSync.onloadHandler);</script>
180183 <script type="' . $wgJsMimeType . '">
181184 WikiSync.setLocalNames( ' .
182185 self::getJsObject( 'wsLocalMessages', 'last_op_error', 'synchronization_confirmation', 'synchronization_success', 'already_synchronized', 'sync_to_itself', 'diff_search', 'revision', 'file_size_mismatch' ) .
@@ -212,18 +215,27 @@
213216 }
214217
215218 function __construct() {
216 - parent::__construct( 'WikiSync', 'delete' );
217 - WikiSyncSetup::initUser();
 219+ parent::__construct( 'WikiSync', 'edit' );
 220+ $this->initUser = WikiSyncSetup::initUser();
218221 }
219222
220223 function execute( $param ) {
221224 global $wgOut, $wgContLang;
222225 global $wgUser;
223 - if ( !$wgUser->isAllowed( 'delete' ) ) {
224 - $wgOut->permissionRequired('delete');
 226+ # commented out, ignored by FF 3+ anyway
 227+# $wgOut->enableClientCache( false );
 228+ if ( !$wgUser->isAllowed( 'edit' ) ) {
 229+ $wgOut->permissionRequired('edit');
225230 return;
226231 }
227 -
 232+ if ( is_string( $this->initUser ) ) {
 233+ # not enough priviledges to run this method
 234+ $wgOut->addHTML( $this->initUser );
 235+ return;
 236+ }
 237+ if ( !$wgUser->isAnon() ) {
 238+ WikiSyncSetup::$remote_wiki_user = $wgUser->getName();
 239+ }
228240 self::headScripts( $wgOut, $wgContLang->isRTL() );
229241 $wgOut->setPagetitle( wfMsgHtml( 'wikisync' ) );
230242 $this->initSyncDirectionTpl();
Index: trunk/extensions/WikiSync/WikiSyncClient.php
@@ -28,7 +28,7 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
@@ -275,9 +275,9 @@
276276 */
277277 $args = func_get_args();
278278 $json_result = new WikiSyncJSONresult();
279 - if ( !WikiSyncSetup::initUser() ) {
 279+ if ( is_string( $iu = WikiSyncSetup::initUser() ) ) {
280280 # not enough priviledges to run this method
281 - return $json_result->getResult( 'noaccess' );
 281+ return $json_result->getResult( 'noaccess', $iu );
282282 }
283283 $snoopy = new WikiSnoopy();
284284 list( $remote_wiki_root, $remote_wiki_user, $remote_wiki_password ) = $args;
@@ -369,9 +369,9 @@
370370 throw new MWException( 'Unsupported type of result (' . htmlspecialchars( $resultEncoding, ENT_COMPAT, 'UTF-8' ) . ' ) in ' . __METHOD__ );
371371 }
372372 $json_result = new WikiSyncJSONresult( $resultEncoding == self::RESULT_JSON_STRING );
373 - if ( !WikiSyncSetup::initUser() ) {
 373+ if ( is_string( $iu = WikiSyncSetup::initUser() ) ) {
374374 # not enough priviledges to run this method
375 - return $json_result->getResult( 'noaccess' );
 375+ return $json_result->getResult( 'noaccess', $iu );
376376 }
377377 $api_params = is_array( $args[0] ) ? $args[0] : json_decode( $args[0], true );
378378 try {
@@ -417,9 +417,9 @@
418418 # when there are files posted, use only 'multipart/form-data'
419419 $useMultipart = is_array( $api_files );
420420 $json_result = new WikiSyncJSONresult( $resultEncoding == self::RESULT_JSON_STRING );
421 - if ( !WikiSyncSetup::initUser() ) {
 421+ if ( is_string( $iu = WikiSyncSetup::initUser() ) ) {
422422 # not enough priviledges to run this method
423 - return $json_result->getResult( 'noaccess' );
 423+ return $json_result->getResult( 'noaccess', $iu );
424424 }
425425 # snoopy api_params are associative array
426426 $api_params = is_array( $args[1] ) ? $args[1] : json_decode( $args[1], true );
@@ -496,11 +496,6 @@
497497 # use default IIS / Apache execution time limit which is much larger than default PHP limit
498498 set_time_limit( 300 );
499499 self::$json_result = new WikiSyncJSONresult();
500 - if ( !WikiSyncSetup::initUser() ) {
501 - # not enough priviledges to run this method
502 - self::$json_result->setCode( 'noaccess' );
503 - return false;
504 - }
505500 if ( count( $args ) < $min_args ) {
506501 self::$json_result->setCode( 'init_client', 'Not enough number of parameters in ' . __METHOD__ );
507502 return false;
@@ -512,9 +507,16 @@
513508 self::$json_result->setCode( 'init_client', $check_result );
514509 return false;
515510 }
516 - if ( !is_bool( self::$directionToLocal = self::$client_params['direction_to_local'] ) ) {
517 - self::$json_result->setCode( 'init_client', 'Parameter "direction_to_local" is not boolean in ' . $client_name );
518 - };
 511+ if ( !isset( self::$client_params['direction_to_local'] ) ) {
 512+ self::$json_result->setCode( 'init_client', 'direction_to_local was not passed for ' . $client_name );
 513+ return false;
 514+ }
 515+ self::$directionToLocal = self::$client_params['direction_to_local'];
 516+ if ( is_string( $iu = WikiSyncSetup::initUser( self::$directionToLocal ) ) ) {
 517+ # not enough priviledges to run this method
 518+ self::$json_result->setCode( 'noaccess', $iu );
 519+ return false;
 520+ }
519521 return true;
520522 }
521523
Index: trunk/extensions/WikiSync/WikiSync_i18n.php
@@ -29,7 +29,7 @@
3030 'wikisync_log_uploaded_by' => 'Uploaded by [[Special:WikiSync]]',
3131 'wikisync_api_result_unknown_action' => 'Unknown API action',
3232 'wikisync_api_result_exception' => 'Exception occured in local API call',
33 - 'wikisync_api_result_noaccess' => 'Only members of (sysop, bureaucrat) groups can use site synchronization',
 33+ 'wikisync_api_result_noaccess' => 'Only members of the following groups can perform this action: ($1)',
3434 'wikisync_api_result_invalid_parameter' => 'Invalid value of parameter',
3535 'wikisync_api_result_http' => 'HTTP error while querying data from remote API',
3636 'wikisync_api_result_Unsupported' => 'Your version of MediaWiki is unsupported (less than 1.15)',
@@ -78,7 +78,7 @@
7979 'wikisync_log_imported_by' => 'Импортировано с помощью [[Special:WikiSync]]',
8080 'wikisync_log_uploaded_by' => 'Загружено с помощью [[Special:WikiSync]]',
8181 'wikisync_api_result_unknown_action' => 'Неизвестное действие (action) API',
82 - 'wikisync_api_result_noaccess' => 'Only members of (sysop, bureaucrat) groups can use site synchronization',
 82+ 'wikisync_api_result_noaccess' => 'Только пользователи, входящие в нижеперечисленные группы, могут выполнять указанное действие: ($1)',
8383 'wikisync_api_result_Illegal' => 'Недопустимое имя пользователя',
8484 'wikisync_api_result_NotExists' => 'Такого пользователя не существует',
8585 'wikisync_api_result_WrongPass' => 'Неверный пароль',
Index: trunk/extensions/WikiSync/WikiSync.php
@@ -28,12 +28,12 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
36 - */
37 -
 36+ */
 37+
3838 if ( !defined( 'MEDIAWIKI' ) ) {
3939 die( "This file is a part of MediaWiki extension.\n" );
4040 }
@@ -75,8 +75,12 @@
7676 class WikiSyncSetup {
7777 # {{{ changable in LocalSettings.php :
7878 static $remote_wiki_root = 'http://www.mediawiki.org/w';
79 - static $remote_wiki_user = 'Username';
 79+ static $remote_wiki_user = '';
8080 static $proxy_address = ''; # 'http://10.0.0.78:3128';
 81+ # which user groups can synchronize from remote to local
 82+ static $rtl_access_groups = array( 'user' );
 83+ # which user groups can synchronize from local to remote
 84+ static $ltr_access_groups = array( 'sysop', 'bureaucrat' );
8185 # }}}
8286
8387 # {{{ decoded local proxy settings
@@ -86,7 +90,7 @@
8791 static $proxy_pass = '';
8892 # }}}
8993
90 - static $version = '0.2.0'; // version of extension
 94+ static $version = '0.2.1'; // version of extension
9195 static $ExtDir; // filesys path with windows path fix
9296 static $ScriptPath; // apache virtual path
9397
@@ -137,16 +141,39 @@
138142 }
139143 }
140144
 145+ static function checkUserMembership( $groups ) {
 146+ global $wgUser;
 147+ $ug = $wgUser->getEffectiveGroups();
 148+ if ( !$wgUser->isAnon() && !in_array( 'user', $ug ) ) {
 149+ $ug[] = 'user';
 150+ }
 151+ if ( array_intersect( $groups, $ug ) ) {
 152+ return true;
 153+ }
 154+ return wfMsg( 'wikisync_api_result_noaccess', implode( $groups, ',' ) );
 155+ }
 156+
141157 /*
142158 * should not be called from LocalSettings.php
143159 * should be called only when the wiki is fully initialized
144 - * @return true, when the current user has admin rights, false otherwise
 160+ * @param $direction defines the direction of synchronization
 161+ * true - from remote to local wiki
 162+ * false - from local to remote wiki
 163+ * null - direction is undefined yet (any direction)
 164+ * @return true, when the current user has access to synchronization;
 165+ * string error message, when the current user has no access
145166 */
146 - static function initUser() {
147 - global $wgUser;
 167+ static function initUser( $direction = null) {
148168 wfLoadExtensionMessages( 'WikiSync' );
149 - $ug = $wgUser->getEffectiveGroups();
150 - return array_intersect( array( 'sysop', 'bureaucrat' ), $ug );
 169+ if ( $direction === true ) {
 170+ return self::checkUserMembership( self::$rtl_access_groups );
 171+ } elseif ( $direction === false ) {
 172+ return self::checkUserMembership( self::$ltr_access_groups );
 173+ } elseif ( $direction === null ) {
 174+ $groups = array_merge( self::$rtl_access_groups, self::$ltr_access_groups );
 175+ return self::checkUserMembership( $groups );
 176+ }
 177+ return 'Bug: direction should be boolean or null, value (' . $direction . ') given in ' . __METHOD__;
151178 }
152179
153180 } /* end of WikiSyncSetup class */
Index: trunk/extensions/WikiSync/WikiSyncBasic.php
@@ -28,7 +28,7 @@
2929 * * Add this line at the end of your LocalSettings.php file :
3030 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3131 *
32 - * @version 0.2.0
 32+ * @version 0.2.1
3333 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3434 * @author Dmitriy Sintsov <questpc@rambler.ru>
3535 * @addtogroup Extensions
Index: trunk/extensions/WikiSync/WikiSync_utils.js
@@ -1,4 +1,41 @@
 2+var WikiSyncUtils = {
 3+ // browser-independent addevent function
 4+ addEvent : function ( obj, type, fn ) {
 5+ if ( document.getElementById && document.createTextNode ) {
 6+ if (obj.addEventListener) {
 7+ obj.addEventListener( type, fn, false );
 8+ }
 9+ else if (obj.attachEvent) {
 10+ obj["e"+type+fn] = fn;
 11+ obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
 12+ obj.attachEvent( "on"+type, obj[type+fn] );
 13+ }
 14+ else {
 15+ obj["on"+type] = obj["e"+type+fn];
 16+ }
 17+ }
 18+ },
 19+
 20+ getEventObj : function ( event, stopPropagation ) {
 21+ var obj;
 22+ if ( typeof event.target !== 'undefined' ) {
 23+ obj = event.target;
 24+ if ( stopPropagation ) {
 25+ event.stopPropagation();
 26+ }
 27+ } else {
 28+ obj = event.srcElement;
 29+ if ( stopPropagation ) {
 30+ event.cancelBubble = true;
 31+ }
 32+ }
 33+ return obj;
 34+ }
 35+
 36+};
 37+
238 /**
 39+ * percents indicator class
340 * @param id - id of table container for percents indicator
441 */
542 function WikiSyncPercentsIndicator( id ) {
@@ -13,7 +50,7 @@
1451 this.reset();
1552 }
1653 WikiSyncPercentsIndicator.prototype.setVisibility = function( visible ) {
17 - this.topElement.style.display = visible ? 'block' : 'none';
 54+ this.topElement.style.display = visible ? 'table' : 'none';
1855 }
1956 /**
2057 * @access private
Index: trunk/extensions/WikiSync/README
@@ -1,4 +1,4 @@
2 -MediaWiki extension WikiSync, version 0.2.0
 2+MediaWiki extension WikiSync, version 0.2.1
33
44 WikiSync allows an AJAX-based synchronization of revisions and files between
55 global wiki site and it's local mirror. Files download can optionally be disabled,
Index: trunk/extensions/WikiSync/INSTALL
@@ -1,4 +1,4 @@
2 -MediaWiki extension WikiSync, version 0.2.0
 2+MediaWiki extension WikiSync, version 0.2.1
33
44 * download the latest available version and extract it to your wiki extension directory.
55 * add the following line to LocalSettings.php
Index: trunk/extensions/WikiSync/WikiSync.js
@@ -27,7 +27,7 @@
2828 * * Add this line at the end of your LocalSettings.php file :
2929 * require_once "$IP/extensions/WikiSync/WikiSync.php";
3030 *
31 - * @version 0.2.0
 31+ * @version 0.2.1
3232 * @link http://www.mediawiki.org/wiki/Extension:WikiSync
3333 * @author Dmitriy Sintsov <questpc@rambler.ru>
3434 * @addtogroup Extensions
@@ -360,6 +360,12 @@
361361 }
362362 },
363363
 364+ /**
 365+ * parses and validates AJAX result
 366+ * always, even in case of error should return _parsed_ JSON
 367+ * @param request AJAX result
 368+ * @return parsed JSON result (JS nested object)
 369+ */
364370 getAJAXresult : function( request ) {
365371 var AJAXres = { 'ws_status' : '0', 'ws_code' : 'uninitialized', 'ws_msg' : 'uninitialized' };
366372 if ( request.status != 200 ) {
@@ -378,6 +384,12 @@
379385 return AJAXres;
380386 },
381387
 388+ /**
 389+ * scans this.AJAXresult whether AJAX events with
 390+ * assigned operation.opcode names got an response from server
 391+ * allows to check for multiple events at once, in case of concurrent AJAX calls
 392+ * @param arguments list of operation.opcode names
 393+ */
382394 isAJAXresult : function() {
383395 var found = 0;
384396 for ( var i = 0; i < arguments.length; i++ ) {
@@ -390,12 +402,17 @@
391403
392404 errorDefaultAction : function() {
393405 this.syncPercents.reset();
 406+ this.filesPercents.setVisibility( false );
394407 this.filesPercents.reset();
395408 this.showIframe( '' );
396409 // enable all but synchronization buttons
397410 this.setButtons( true, 'wikisync_synchronization_button' );
398411 },
399412
 413+ /**
 414+ * scans this.AJAXresult for unsuccessful events which have returned errors
 415+ * @return true, when there are errors; false otherwise
 416+ */
400417 assertAJAXerrors : function() {
401418 var result = false;
402419 for ( var key in this.AJAXresult ) {
@@ -411,9 +428,19 @@
412429 return result;
413430 },
414431
 432+ /**
 433+ * "pops" AJAX event result in parsed JSON format (JS nested object)
 434+ * with selected operation.opcode from this.AJAXresult
 435+ * should be called only on successful results
 436+ * after the checking with assertAJAXerrors()
 437+ * @param key operation.opcode
 438+ * @param nested_props - an JS object "path" of nested properties to return
 439+ * @return JS nested object (in parsed JSON format)
 440+ */
415441 popAJAXresult : function( key, nested_props ) {
416442 var r = this.AJAXresult[key];
417 - delete this.AJAXresult[key]; // clear events list
 443+ // remote event from the list
 444+ delete this.AJAXresult[key];
418445 if ( typeof nested_props === 'undefined' ) {
419446 return r;
420447 }
@@ -427,6 +454,10 @@
428455 },
429456
430457 getImportToken : function( operation ) {
 458+ if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
 459+ this.error( 'Bug: No operation.opcode in WikiSync.getImportToken' );
 460+ return;
 461+ }
431462 switch ( operation.opcode ) {
432463 case 'start' :
433464 // get sample page title for token importing
@@ -519,6 +550,10 @@
520551 * transfer one file in blocks of specified length
521552 */
522553 transferFile : function( operation ) {
 554+ if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
 555+ this.error( 'Bug: No operation.opcode in WikiSync.transferFile' );
 556+ return;
 557+ }
523558 switch ( operation.opcode ) {
524559 case 'start_upload' :
525560 this.currFileOffset = 0;
@@ -606,6 +641,10 @@
607642 * update new files currently available in chunk (if any)
608643 */
609644 updateNewFiles : function( operation ) {
 645+ if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
 646+ this.error( 'Bug: No operation.opcode in WikiSync.updateNewFiles' );
 647+ return;
 648+ }
610649 switch ( operation.opcode ) {
611650 case 'new_files_result' :
612651 this.log( this.AJAXresult[operation.opcode] );
@@ -648,6 +687,10 @@
649688 * synchronize xml chunks in blocks (optionally with passing through file update)
650689 */
651690 synchronize : function( operation ) {
 691+ if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
 692+ this.error( 'Bug: No operation.opcode in WikiSync.synchronize' );
 693+ return;
 694+ }
652695 switch ( operation.opcode ) {
653696 case 'start' :
654697 this.srcSyncId = operation.revid;
@@ -655,7 +698,6 @@
656699 if ( !confirm( this.formatMessage( 'synchronization_confirmation', this.srcWikiRoot, this.dstWikiRoot, operation.revid ) ) ) {
657700 this.log( 'Operation was cancelled' );
658701 this.syncPercents.reset();
659 - this.filesPercents.reset();
660702 // enable all buttons
661703 this.setButtons( true );
662704 return;
@@ -674,6 +716,7 @@
675717 'fname' : 'synchronize',
676718 'opcode' : 'xml_chunk_result'
677719 };
 720+ this.syncPercents.display( { 'desc' : this.formatMessage( 'revision', operation.startid ), 'curr' : operation.startid } );
678721 this.wsAPI( 'syncXMLchunk', clientParams, nextOp );
679722 return;
680723 case 'xml_chunk_result' :
@@ -684,8 +727,6 @@
685728 this.xmlContinueStartId = (typeof result.ws_continue_startid) === 'undefined' ? null : result.ws_continue_startid;
686729 if ( this.xmlContinueStartId === null ) {
687730 this.syncPercents.display( { 'desc' : '', 'curr' : 'max' } );
688 - } else {
689 - this.syncPercents.display( { 'desc' : this.formatMessage( 'revision', this.xmlContinueStartId ), 'curr' : this.xmlContinueStartId } );
690731 }
691732 if ( this.syncFiles && typeof result.files !== 'undefined' ) {
692733 var clientParams = {
@@ -727,7 +768,7 @@
728769 */
729770 findCommonRev : function( operation ) {
730771 if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
731 - this.error( 'Bug: No operation.opcode in WikiSync.getLastSrcRev' );
 772+ this.error( 'Bug: No operation.opcode in WikiSync.findCommonRev' );
732773 return;
733774 }
734775 switch ( operation.opcode ) {
@@ -811,7 +852,7 @@
812853 */
813854 getSrcRev : function( operation ) {
814855 if ( typeof operation === 'undefined' || typeof operation.opcode === 'undefined' ) {
815 - this.error( 'Bug: No operation.opcode in WikiSync.getLastSrcRev' );
 856+ this.error( 'Bug: No operation.opcode in WikiSync.getSrcRev' );
816857 return;
817858 }
818859 switch ( operation.opcode ) {
@@ -876,10 +917,6 @@
877918 * "Synchronize" button click handler
878919 */
879920 process : function() {
880 - this.syncPercents = new WikiSyncPercentsIndicator( 'wikisync_xml_percents' );
881 - this.filesPercents = new WikiSyncPercentsIndicator( 'wikisync_files_percents' );
882 - this.syncPercents.setVisibility( true );
883 - this.showIframe( '' );
884921 if ( wgServer.indexOf( this.remoteContext.wikiroot ) !== -1 ||
885922 this.remoteContext.wikiroot.indexOf( wgServer ) !== -1 ) {
886923 alert( this.formatMessage( 'sync_to_itself' ) );
@@ -895,10 +932,25 @@
896933 }
897934 // disable all buttons
898935 this.setButtons( false );
 936+ this.syncPercents.setVisibility( true );
899937 /* get first and last source revision in parallel */
900938 this.getSrcRev( { 'opcode' : 'start' } );
901939 this.getSrcRev( { 'opcode' : 'start', 'dir' : 'newer' } );
902940 return false;
 941+ },
 942+
 943+ onloadHandler : function() {
 944+ // {{{ switch the context
 945+ if ( typeof this._WikiSync === 'undefined' ) {
 946+ return WikiSync.onloadHandler.call( WikiSync );
 947+ }
 948+ // }}}
 949+ this.syncPercents = new WikiSyncPercentsIndicator( 'wikisync_xml_percents' );
 950+ this.filesPercents = new WikiSyncPercentsIndicator( 'wikisync_files_percents' );
 951+ this.syncPercents.setVisibility( false );
 952+ this.filesPercents.setVisibility( false );
 953+ this.showIframe( '' );
 954+ this.errorDefaultAction();
903955 }
904956
905957 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r758693rd round of i18n tweaks and follow-up r75865: Use commaList()raymond19:30, 2 November 2010
r81018v0.3.2. Suppress the creation of informational null revisions in XML importer...questpc11:18, 26 January 2011

Comments

#Comment by QuestPC (talk | contribs)   11:11, 2 February 2011

Please change the status, if possible.

#Comment by QuestPC (talk | contribs)   11:19, 26 January 2011

Should be fixed in r81018

Status & tagging log