r61759 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61758‎ | r61759 | r61760 >
Date:22:06, 31 January 2010
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
* (bug 20809) Expose EditFormPreloadText via the API

If page exists, don't run hook and just display ''

Comment for readable and url
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -37,7 +37,8 @@
3838
3939 private $fld_protection = false, $fld_talkid = false,
4040 $fld_subjectid = false, $fld_url = false,
41 - $fld_readable = false, $fld_watched = false;
 41+ $fld_readable = false, $fld_watched = false,
 42+ $fld_preload = false;
4243
4344 public function __construct( $query, $moduleName ) {
4445 parent :: __construct( $query, $moduleName, 'in' );
@@ -200,6 +201,7 @@
201202 $this->fld_subjectid = isset( $prop['subjectid'] );
202203 $this->fld_url = isset( $prop['url'] );
203204 $this->fld_readable = isset( $prop['readable'] );
 205+ $this->fld_preload = isset ( $prop['preload'] );
204206 }
205207
206208 $pageSet = $this->getPageSet();
@@ -321,6 +323,16 @@
322324 }
323325 if ( $this->fld_readable && $title->userCanRead() )
324326 $pageInfo['readable'] = '';
 327+
 328+ if ( $this->fld_preload ) {
 329+ if ( $title->exists() )
 330+ $pageInfo['preload'] = '';
 331+ else {
 332+ wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
 333+
 334+ $pageInfo['preload'] = $text;
 335+ }
 336+ }
325337 return $pageInfo;
326338 }
327339
@@ -553,6 +565,7 @@
554566 'subjectid',
555567 'url',
556568 'readable',
 569+ 'preload'
557570 ) ),
558571 'token' => array (
559572 ApiBase :: PARAM_DFLT => null,
@@ -570,7 +583,10 @@
571584 ' protection - List the protection level of each page',
572585 ' talkid - The page ID of the talk page for each non-talk page',
573586 ' watched - List the watched status of each page',
574 - ' subjectid - The page ID of the parent page for each talk page'
 587+ ' subjectid - The page ID of the parent page for each talk page',
 588+ ' url - Gives a full URL to the page, and also an edit URL',
 589+ ' readable - Whether the user can read this page',
 590+ ' preload - Gives the text returned by EditFormPreloadText'
575591 ),
576592 'token' => 'Request a token to perform a data-modifying action on a page',
577593 'continue' => 'When more results are available, use this to continue',
Index: trunk/phase3/RELEASE-NOTES
@@ -812,6 +812,7 @@
813813 * (bug 21922) YAML output should quote asterisk when used as key
814814 * (bug 22297) safesubst: to allow substitution without breaking transclusion
815815 * (bug 18758) API read of watchlist's wl_notificationtimestamp
 816+* (bug 20809) Expose EditFormPreloadText via the API
816817
817818 === Languages updated in 1.16 ===
818819

Follow-up revisions

RevisionCommit summaryAuthorDate
r69716Fix bug from r61759...reedy07:00, 22 July 2010

Comments

#Comment by Catrope (talk | contribs)   22:09, 31 January 2010

Marking as fixme to remind myself that we need to do this in a slightly less ugly way then just running the hook in a second place.

#Comment by Reedy (talk | contribs)   17:31, 9 June 2010

Do you want me to log a bug for this fixme? Seeing as it's not quite "broken", just could/should be done in a better way>

#Comment by Catrope (talk | contribs)   17:32, 9 June 2010

Yeah sure, go ahead.

#Comment by Reedy (talk | contribs)   17:38, 9 June 2010
#Comment by Raymond (talk | contribs)   09:37, 22 July 2010

Seen on translatewiki now:

PHP Notice: Undefined property: ApiQueryInfo::$fld_displaytitle in /www/w/includes/api/ApiQueryInfo.php on line 266

#Comment by Reedy (talk | contribs)   09:49, 22 July 2010

Was actually r69716 that caused that, but fixed in r69722

Status & tagging log