r114178 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114177‎ | r114178 | r114179 >
Date:20:25, 19 March 2012
Author:daniel
Status:deferred
Tags:
Comment:
getNativeData()
Modified paths:
  • /branches/Wikidata/phase3/includes/Content.php (modified) (history)
  • /branches/Wikidata/phase3/includes/ContentHandler.php (modified) (history)
  • /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/EditPage.php
@@ -866,7 +866,7 @@
867867 }
868868
869869 $content = $this->mArticle->getContentObject();
870 - return $content->getRawData(); # this editor is for editing the raw text. so use the raw text.
 870+ return $content->getNativeData(); # this editor is for editing the raw text. so use the raw text.
871871 }
872872
873873 /**
Index: branches/Wikidata/phase3/includes/Content.php
@@ -25,8 +25,10 @@
2626 * as given by getDataModel().
2727 *
2828 */
29 - public abstract function getRawData( );
 29+ public abstract function getNativeData( );
3030
 31+ public abstract function getSize( );
 32+
3133 public abstract function getParserOutput( Title $title = null, $revId = null, ParserOptions $options = NULL );
3234
3335 public function getRedirectChain() {
@@ -58,11 +60,9 @@
5961 }
6062
6163 #TODO: implement specialized ParserOutput for Wikidata model
62 - #TODO: provide addToParserOutput fule Multipart... somehow.
 64+ #TODO: provide "combined" ParserOutput for Multipart... somehow.
6365
64 - # TODO: EditPage::mergeChanges( Content $a, Content $b )
6566 # TODO: Wikipage::isCountable(Content $a)
66 - # TODO: Title::newFromRedirectRecurse( $this->getRawText() );
6767
6868 # TODO: isCacheable( )
6969 # TODO: getSize( )
@@ -71,7 +71,11 @@
7272 # TODO: WikiPage::getAutosummary( $oldtext, $text, $flags )
7373
7474 # TODO: EditPage::getPreloadedText( $preload ) // $wgParser->getPreloadText
 75+ # TODO: tie into EditPage, make it use Content-objects throughout, make edit form aware of content model and format
 76+ # TODO: make model-aware diff view!
 77+ # TODO: handle ImagePage and CategoryPage
7578
 79+ # TODO: Title::newFromRedirectRecurse( $this->getRawText() );
7680
7781 # TODO: tie into API to provide contentModel for Revisions
7882 # TODO: tie into API to provide serialized version and contentFormat for Revisions
@@ -94,7 +98,7 @@
9599 *
96100 * @return String the raw text
97101 */
98 - public function getRawData( ) {
 102+ public function getNativeData( ) {
99103 $text = $this->mText;
100104 return $text;
101105 }
@@ -105,7 +109,7 @@
106110 * @return String the raw text
107111 */
108112 public function getSearchText( ) { #FIXME: use!
109 - return $this->getRawData();
 113+ return $this->getNativeData();
110114 }
111115
112116 /**
@@ -114,7 +118,7 @@
115119 * @return String the raw text
116120 */
117121 public function getWikitextForTransclusion( ) { #FIXME: use!
118 - return $this->getRawData();
 122+ return $this->getNativeData();
119123 }
120124
121125 /**
@@ -186,7 +190,7 @@
187191 public function getSection( $section ) {
188192 global $wgParser;
189193
190 - $text = $this->getRawData();
 194+ $text = $this->getNativeData();
191195 $sect = $wgParser->getSection( $text, $section, false );
192196
193197 return new WikitextContent( $sect );
@@ -212,8 +216,8 @@
213217 throw new MWException( "Incompatible content model for section: document uses $myModelName, section uses $sectionModelName." );
214218 }
215219
216 - $oldtext = $this->getRawData();
217 - $text = $with->getRawData();
 220+ $oldtext = $this->getNativeData();
 221+ $text = $with->getNativeData();
218222
219223 if ( $section == 'new' ) {
220224 # Inserting a new section
@@ -237,7 +241,7 @@
238242 }
239243
240244 public function getRedirectChain() {
241 - $text = $this->getRawData();
 245+ $text = $this->getNativeData();
242246 return Title::newFromRedirectArray( $text );
243247 }
244248
@@ -270,7 +274,7 @@
271275 /**
272276 * Returns the message as raw text, using the options supplied to the constructor minus "parse" and "parseinline".
273277 */
274 - public function getRawData( ) {
 278+ public function getNativeData( ) {
275279 $opt = array_diff( $this->mOptions, array('parse', 'parseinline') );
276280
277281 return wfMsgExt( $this->mMessageKey, $this->mParameters, $opt );
@@ -287,7 +291,7 @@
288292 protected function getHtml( ) {
289293 $html = "";
290294 $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
291 - $html .= htmlspecialchars( $this->getRawData() );
 295+ $html .= htmlspecialchars( $this->getNativeData() );
292296 $html .= "\n</pre>\n";
293297
294298 return $html;
@@ -303,7 +307,7 @@
304308 protected function getHtml( ) {
305309 $html = "";
306310 $html .= "<pre class=\"mw-code mw-css\" dir=\"ltr\">\n";
307 - $html .= htmlspecialchars( $this->getRawData() );
 311+ $html .= htmlspecialchars( $this->getNativeData() );
308312 $html .= "\n</pre>\n";
309313
310314 return $html;
Index: branches/Wikidata/phase3/includes/WikiPage.php
@@ -429,11 +429,11 @@
430430 return $this->getText( Revision::RAW );
431431 }
432432
433 - protected function getRawData() {
 433+ protected function getNativeData() {
434434 $content = $this->getContent( Revision::RAW );
435435 if ( !$content ) return null;
436436
437 - return $content->getRawData();
 437+ return $content->getNativeData();
438438 }
439439
440440 /**
@@ -911,7 +911,7 @@
912912
913913 if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
914914 if ( $this->mTitle->exists() ) {
915 - $text = $this->getRawData();
 915+ $text = $this->getNativeData();
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->getRawData(); // current revision
 1269+ $oldtext = $this->getNativeData(); // current revision
12701270 $oldsize = strlen( $oldtext );
12711271 $oldid = $this->getLatest();
12721272 $oldIsRedirect = $this->isRedirect();
Index: branches/Wikidata/phase3/includes/api/ApiEditPage.php
@@ -112,7 +112,7 @@
113113 $text = '';
114114 } else {
115115 $content = $articleObj->getContentObject();
116 - $text = $content->getRawData();
 116+ $text = $content->getNativeData();
117117 }
118118
119119 if ( !is_null( $params['section'] ) ) {
Index: branches/Wikidata/phase3/includes/api/ApiParse.php
@@ -330,7 +330,7 @@
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->getRawData(); #FIXME: change $this->text to $this->data?!
 334+ $this->text = $this->content->getNativeData(); #FIXME: change $this->text to $this->data?!
335335 }
336336 return $pout;
337337 }
Index: branches/Wikidata/phase3/includes/ContentHandler.php
@@ -20,7 +20,7 @@
2121 #XXX: or check by model name?
2222 #XXX: or define $content->allowRawData()?
2323 #XXX: or define $content->getDefaultWikiText()?
24 - return $content->getRawData();
 24+ return $content->getNativeData();
2525 }
2626
2727 #XXX: this must not be used for editing, otherwise we may loose data:
@@ -233,7 +233,7 @@
234234
235235 public function serialize( Content $content, $format = null ) {
236236 #FIXME: assert format
237 - return $content->getRawData();
 237+ return $content->getNativeData();
238238 }
239239
240240 /**

Status & tagging log