r23742 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23741‎ | r23742 | r23743 >
Date:15:16, 5 July 2007
Author:catrope
Status:old
Tags:
Comment:
apiedit: Merging revisions 23722, 23737, 23739 and 23741 from trunk.
Modified paths:
  • /branches/apiedit/phase3 (modified) (history)
  • /branches/apiedit/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/apiedit/phase3/includes/Skin.php (modified) (history)
  • /branches/apiedit/phase3/includes/Xml.php (modified) (history)
  • /branches/apiedit/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /branches/apiedit/phase3/maintenance/postgres/compare_schemas.pl (modified) (history)

Diff [purge]

Index: branches/apiedit/phase3/maintenance/postgres/compare_schemas.pl
@@ -35,7 +35,7 @@
3636 my $datatype = join '|' => qw(
3737 bool
3838 tinyint int bigint real float
39 -tinytext mediumtext text char varchar varbinary
 39+tinytext mediumtext text char varchar varbinary binary
4040 timestamp datetime
4141 tinyblob mediumblob blob
4242 );
Index: branches/apiedit/phase3/includes/Xml.php
@@ -330,7 +330,9 @@
331331
332332 /**
333333 * Encode a variable of unknown type to JavaScript.
334 - * Doesn't support hashtables just yet.
 334+ * Arrays are converted to JS arrays, objects are converted to JS associative
 335+ * arrays (objects). So cast your PHP associative arrays to objects before
 336+ * passing them to here.
335337 */
336338 public static function encodeJsVar( $value ) {
337339 if ( is_bool( $value ) ) {
@@ -341,13 +343,23 @@
342344 $s = $value;
343345 } elseif ( is_array( $value ) ) {
344346 $s = '[';
345 - foreach ( $value as $name => $elt ) {
 347+ foreach ( $value as $elt ) {
346348 if ( $s != '[' ) {
347349 $s .= ', ';
348350 }
349351 $s .= self::encodeJsVar( $elt );
350352 }
351353 $s .= ']';
 354+ } elseif ( is_object( $value ) ) {
 355+ $s = '{';
 356+ foreach ( (array)$value as $name => $elt ) {
 357+ if ( $s != '{' ) {
 358+ $s .= ', ';
 359+ }
 360+ $s .= '"' . self::escapeJsString( $name ) . '": ' .
 361+ self::encodeJsVar( $elt );
 362+ }
 363+ $s .= '}';
352364 } else {
353365 $s = '"' . self::escapeJsString( $value ) . '"';
354366 }
Index: branches/apiedit/phase3/includes/Skin.php
@@ -297,6 +297,7 @@
298298 global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
299299 global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
300300 global $wgBreakFrames, $wgRequest;
 301+ global $wgUseAjax, $wgAjaxWatch;
301302
302303 $ns = $wgTitle->getNamespace();
303304 $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
@@ -334,6 +335,15 @@
335336 $vars['wgLivepreviewMessageError'] = wfMsg( 'livepreview-error' );
336337 }
337338
 339+ if($wgUseAjax && $wgAjaxWatch) {
 340+ $msgNames = array( 'watch', 'unwatch', 'watching', 'unwatching' );
 341+ $msgs = (object)array();
 342+ foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching' ) as $msgName ) {
 343+ $msgs->{$msgName . 'Msg'} = wfMsg( $msgName );
 344+ }
 345+ $vars['wgAjaxWatch'] = $msgs;
 346+ }
 347+
338348 return self::makeVariablesScript( $vars );
339349 }
340350
@@ -419,20 +429,6 @@
420430 if ( !wfEmptyMsg ( 'common.js', $commonJs ) ) {
421431 $s .= $commonJs;
422432 }
423 -
424 - global $wgUseAjax, $wgAjaxWatch;
425 - if($wgUseAjax && $wgAjaxWatch) {
426 - $s .= "
427 -
428 -/* AJAX (un)watch (see /skins/common/ajaxwatch.js) */
429 -var wgAjaxWatch = {
430 - watchMsg: '". str_replace( array("'", "\n"), array("\\'", ' '), wfMsgExt( 'watch', array() ) )."',
431 - unwatchMsg: '". str_replace( array("'", "\n"), array("\\'", ' '), wfMsgExt( 'unwatch', array() ) )."',
432 - watchingMsg: '". str_replace( array("'", "\n"), array("\\'", ' '), wfMsgExt( 'watching', array() ) )."',
433 - unwatchingMsg: '". str_replace( array("'", "\n"), array("\\'", ' '), wfMsgExt( 'unwatching', array() ) )."'
434 -};";
435 - }
436 -
437433 wfProfileOut( __METHOD__ );
438434 return $s;
439435 }
Index: branches/apiedit/phase3/includes/GlobalFunctions.php
@@ -1667,7 +1667,7 @@
16681668 return true;
16691669 if( file_exists( $fullDir ) )
16701670 return true;
1671 - return mkdir( $fullDir, $mode, true );
 1671+ return mkdir( str_replace('/',DIRECTORY_SEPARATOR,$fullDir) , $mode, true );
16721672 }
16731673
16741674 /**
Index: branches/apiedit/phase3/includes/api/ApiQueryUserContributions.php
@@ -135,6 +135,9 @@
136136 $this->addWhereRange('rev_timestamp',
137137 $this->params['dir'], $this->params['start'], $this->params['end'] );
138138
 139+ if(count($this->params['namespace']) > 0)
 140+ $this->addWhereFld('page_namespace', $this->params['namespace']);
 141+
139142 $show = $this->params['show'];
140143 if (!is_null($show)) {
141144 $show = array_flip($show);
@@ -226,6 +229,10 @@
227230 'older'
228231 )
229232 ),
 233+ 'namespace' => array (
 234+ ApiBase :: PARAM_ISMULTI => true,
 235+ ApiBase :: PARAM_TYPE => 'namespace'
 236+ ),
230237 'prop' => array (
231238 ApiBase :: PARAM_ISMULTI => true,
232239 ApiBase :: PARAM_DFLT => 'ids|title|timestamp|flags|comment',
@@ -254,13 +261,14 @@
255262 'end' => 'The end timestamp to return to.',
256263 'user' => 'The user to retrieve contributions for.',
257264 'dir' => 'The direction to search (older or newer).',
 265+ 'namespace' => 'Only list contributions in these namespaces',
258266 'prop' => 'Include additional pieces of information',
259267 'show' => 'Show only items that meet this criteria, e.g. non minor edits only: show=!minor',
260268 );
261269 }
262270
263271 protected function getDescription() {
264 - return 'Get edits by a user..';
 272+ return 'Get all edits by a user';
265273 }
266274
267275 protected function getExamples() {
Property changes on: branches/apiedit/phase3
___________________________________________________________________
Modified: svnmerge-integrated
268276 - /trunk/phase3:1-23720
269277 + /trunk/phase3:1-23741

Status & tagging log