r114179 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114178‎ | r114179 | r114180 >
Date:20:34, 19 March 2012
Author:daniel
Status:deferred
Tags:
Comment:
avoid getNativeData()
Modified paths:
  • /branches/Wikidata/phase3/includes/EditPage.php (modified) (history)
  • /branches/Wikidata/phase3/includes/WikiPage.php (modified) (history)
  • /branches/Wikidata/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /branches/Wikidata/phase3/includes/api/ApiParse.php (modified) (history)

Diff [purge]

Index: branches/Wikidata/phase3/includes/WikiPage.php
@@ -911,7 +911,7 @@
912912
913913 if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
914914 if ( $this->mTitle->exists() ) {
915 - $text = $this->getNativeData();
 915+ $text = $this->getNativeData(); #FIXME: may not be a string. check Content model!
916916 } else {
917917 $text = false;
918918 }
@@ -1265,7 +1265,7 @@
12661266 $isminor = ( $flags & EDIT_MINOR ) && $user->isAllowed( 'minoredit' );
12671267 $bot = $flags & EDIT_FORCE_BOT;
12681268
1269 - $oldtext = $this->getNativeData(); // current revision
 1269+ $oldtext = $this->getNativeData(); // current revision #FIXME: may not be a string. check Content model!
12701270 $oldsize = strlen( $oldtext );
12711271 $oldid = $this->getLatest();
12721272 $oldIsRedirect = $this->isRedirect();
Index: branches/Wikidata/phase3/includes/api/ApiParse.php
@@ -318,7 +318,7 @@
319319
320320 $page = WikiPage::factory( $titleObj );
321321
322 - if ( $this->section !== false ) {
 322+ if ( $this->section !== false ) { #FIXME: get section Content, get parser output, ...
323323 $this->text = $this->getSectionText( $page->getRawText(), !is_null( $pageId )
324324 ? 'page id ' . $pageId : $titleObj->getText() ); #FIXME: get section...
325325
@@ -330,13 +330,13 @@
331331 $pout = $page->getParserOutput( $popts );
332332 if ( $getWikitext ) {
333333 $this->content = $page->getContent( Revision::RAW ); #FIXME: use $this->content everywhere
334 - $this->text = $this->content->getNativeData(); #FIXME: change $this->text to $this->data?!
 334+ $this->text = ContentHandler::getContentText( $this->content ); #FIXME: serialize, get format from params; or use object structure in result?
335335 }
336336 return $pout;
337337 }
338338 }
339339
340 - private function getSectionText( $text, $what ) {
 340+ private function getSectionText( $text, $what ) { #FIXME: replace with Content::getSection
341341 global $wgParser;
342342 // Not cached (save or load)
343343 $text = $wgParser->getSection( $text, $this->section, false );
Index: branches/Wikidata/phase3/includes/api/ApiEditPage.php
@@ -112,13 +112,14 @@
113113 $text = '';
114114 } else {
115115 $content = $articleObj->getContentObject();
116 - $text = $content->getNativeData();
 116+ $text = ContentHandler::getContentText( $content ); #FIXME: serialize?! get format from params?...
117117 }
118118
119119 if ( !is_null( $params['section'] ) ) {
120120 // Process the content for section edits
121121 $section = intval( $params['section'] );
122 - $text = $content->getSection( $section, false );
 122+ $sectionContent = $content->getSection( $section );
 123+ $text = ContentHandler::getContentText( $sectionContent ); #FIXME: serialize?! get format from params?...
123124 if ( $text === false || $text === null ) {
124125 $this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
125126 }
Index: branches/Wikidata/phase3/includes/EditPage.php
@@ -866,7 +866,7 @@
867867 }
868868
869869 $content = $this->mArticle->getContentObject();
870 - return $content->getNativeData(); # this editor is for editing the raw text. so use the raw text.
 870+ return ContentHandler::getContentText( $content ); # this editor is for editing the raw text. so use the raw text.
871871 }
872872
873873 /**

Status & tagging log