https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114178

Revision: 114178
Author:   daniel
Date:     2012-03-19 20:25:48 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
getNativeData()

Modified Paths:
--------------
    branches/Wikidata/phase3/includes/Content.php
    branches/Wikidata/phase3/includes/ContentHandler.php
    branches/Wikidata/phase3/includes/EditPage.php
    branches/Wikidata/phase3/includes/WikiPage.php
    branches/Wikidata/phase3/includes/api/ApiEditPage.php
    branches/Wikidata/phase3/includes/api/ApiParse.php

Modified: branches/Wikidata/phase3/includes/Content.php
===================================================================
--- branches/Wikidata/phase3/includes/Content.php       2012-03-19 20:19:01 UTC 
(rev 114177)
+++ branches/Wikidata/phase3/includes/Content.php       2012-03-19 20:25:48 UTC 
(rev 114178)
@@ -25,8 +25,10 @@
      * as given by getDataModel().
      *
      */
-    public abstract function getRawData( );
+    public abstract function getNativeData( );
 
+    public abstract function getSize( );
+
     public abstract function getParserOutput( Title $title = null, $revId = 
null, ParserOptions $options = NULL );
 
     public function getRedirectChain() {
@@ -58,11 +60,9 @@
     }
 
     #TODO: implement specialized ParserOutput for Wikidata model
-    #TODO: provide addToParserOutput fule Multipart... somehow.
+    #TODO: provide "combined" ParserOutput for Multipart... somehow.
 
-    # TODO: EditPage::mergeChanges( Content $a, Content $b )
     # TODO: Wikipage::isCountable(Content $a)
-    # TODO: Title::newFromRedirectRecurse( $this->getRawText() );
 
     # TODO: isCacheable( )
     # TODO: getSize( )
@@ -71,7 +71,11 @@
     # TODO: WikiPage::getAutosummary( $oldtext, $text, $flags )
 
     # TODO: EditPage::getPreloadedText( $preload ) // $wgParser->getPreloadText
+    # TODO: tie into EditPage, make it use Content-objects throughout, make 
edit form aware of content model and format
+    # TODO: make model-aware diff view!
+    # TODO: handle ImagePage and CategoryPage
 
+    # TODO: Title::newFromRedirectRecurse( $this->getRawText() );
 
     # TODO: tie into API to provide contentModel for Revisions
     # TODO: tie into API to provide serialized version and contentFormat for 
Revisions
@@ -94,7 +98,7 @@
      *
      * @return String the raw text
      */
-    public function getRawData( ) {
+    public function getNativeData( ) {
         $text = $this->mText;
         return $text;
     }
@@ -105,7 +109,7 @@
      * @return String the raw text
      */
     public function getSearchText( ) { #FIXME: use!
-        return $this->getRawData();
+        return $this->getNativeData();
     }
 
     /**
@@ -114,7 +118,7 @@
      * @return String the raw text
      */
     public function getWikitextForTransclusion( ) { #FIXME: use!
-        return $this->getRawData();
+        return $this->getNativeData();
     }
 
     /**
@@ -186,7 +190,7 @@
     public function getSection( $section ) {
         global $wgParser;
 
-        $text = $this->getRawData();
+        $text = $this->getNativeData();
         $sect = $wgParser->getSection( $text, $section, false );
 
         return  new WikitextContent( $sect );
@@ -212,8 +216,8 @@
             throw new MWException( "Incompatible content model for section: 
document uses $myModelName, section uses $sectionModelName." );
         }
 
-        $oldtext = $this->getRawData();
-        $text = $with->getRawData();
+        $oldtext = $this->getNativeData();
+        $text = $with->getNativeData();
 
         if ( $section == 'new' ) {
             # Inserting a new section
@@ -237,7 +241,7 @@
     }
 
     public function getRedirectChain() {
-        $text = $this->getRawData();
+        $text = $this->getNativeData();
         return Title::newFromRedirectArray( $text );
     }
 
@@ -270,7 +274,7 @@
     /**
      * Returns the message as raw text, using the options supplied to the 
constructor minus "parse" and "parseinline".
      */
-    public function getRawData( ) {
+    public function getNativeData( ) {
         $opt = array_diff( $this->mOptions, array('parse', 'parseinline') );
 
         return wfMsgExt( $this->mMessageKey, $this->mParameters, $opt );
@@ -287,7 +291,7 @@
     protected function getHtml( ) {
         $html = "";
         $html .= "<pre class=\"mw-code mw-js\" dir=\"ltr\">\n";
-        $html .= htmlspecialchars( $this->getRawData() );
+        $html .= htmlspecialchars( $this->getNativeData() );
         $html .= "\n</pre>\n";
 
         return $html;
@@ -303,7 +307,7 @@
     protected function getHtml( ) {
         $html = "";
         $html .= "<pre class=\"mw-code mw-css\" dir=\"ltr\">\n";
-        $html .= htmlspecialchars( $this->getRawData() );
+        $html .= htmlspecialchars( $this->getNativeData() );
         $html .= "\n</pre>\n";
 
         return $html;

Modified: branches/Wikidata/phase3/includes/ContentHandler.php
===================================================================
--- branches/Wikidata/phase3/includes/ContentHandler.php        2012-03-19 
20:19:01 UTC (rev 114177)
+++ branches/Wikidata/phase3/includes/ContentHandler.php        2012-03-19 
20:25:48 UTC (rev 114178)
@@ -20,7 +20,7 @@
             #XXX: or check by model name?
             #XXX: or define $content->allowRawData()?
             #XXX: or define $content->getDefaultWikiText()?
-            return $content->getRawData();
+            return $content->getNativeData();
         }
 
         #XXX: this must not be used for editing, otherwise we may loose data:
@@ -233,7 +233,7 @@
 
     public function serialize( Content $content, $format = null ) {
         #FIXME: assert format
-        return $content->getRawData();
+        return $content->getNativeData();
     }
 
     /**

Modified: branches/Wikidata/phase3/includes/EditPage.php
===================================================================
--- branches/Wikidata/phase3/includes/EditPage.php      2012-03-19 20:19:01 UTC 
(rev 114177)
+++ branches/Wikidata/phase3/includes/EditPage.php      2012-03-19 20:25:48 UTC 
(rev 114178)
@@ -866,7 +866,7 @@
                }
 
         $content = $this->mArticle->getContentObject();
-               return $content->getRawData(); # this editor is for editing the 
raw text. so use the raw text.
+               return $content->getNativeData(); # this editor is for editing 
the raw text. so use the raw text.
        }
 
        /**

Modified: branches/Wikidata/phase3/includes/WikiPage.php
===================================================================
--- branches/Wikidata/phase3/includes/WikiPage.php      2012-03-19 20:19:01 UTC 
(rev 114177)
+++ branches/Wikidata/phase3/includes/WikiPage.php      2012-03-19 20:25:48 UTC 
(rev 114178)
@@ -429,11 +429,11 @@
                return $this->getText( Revision::RAW );
        }
 
-    protected function getRawData() {
+    protected function getNativeData() {
         $content = $this->getContent( Revision::RAW );
         if ( !$content ) return null;
 
-        return $content->getRawData();
+        return $content->getNativeData();
     }
 
        /**
@@ -911,7 +911,7 @@
 
                if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                        if ( $this->mTitle->exists() ) {
-                               $text = $this->getRawData();
+                               $text = $this->getNativeData();
                        } else {
                                $text = false;
                        }
@@ -1265,7 +1265,7 @@
                $isminor = ( $flags & EDIT_MINOR ) && $user->isAllowed( 
'minoredit' );
                $bot = $flags & EDIT_FORCE_BOT;
 
-               $oldtext = $this->getRawData(); // current revision
+               $oldtext = $this->getNativeData(); // current revision
                $oldsize = strlen( $oldtext );
                $oldid = $this->getLatest();
                $oldIsRedirect = $this->isRedirect();

Modified: branches/Wikidata/phase3/includes/api/ApiEditPage.php
===================================================================
--- branches/Wikidata/phase3/includes/api/ApiEditPage.php       2012-03-19 
20:19:01 UTC (rev 114177)
+++ branches/Wikidata/phase3/includes/api/ApiEditPage.php       2012-03-19 
20:25:48 UTC (rev 114178)
@@ -112,7 +112,7 @@
                 $text = '';
                        } else {
                 $content = $articleObj->getContentObject();
-                $text = $content->getRawData();
+                $text = $content->getNativeData();
                        }
 
                        if ( !is_null( $params['section'] ) ) {

Modified: branches/Wikidata/phase3/includes/api/ApiParse.php
===================================================================
--- branches/Wikidata/phase3/includes/api/ApiParse.php  2012-03-19 20:19:01 UTC 
(rev 114177)
+++ branches/Wikidata/phase3/includes/api/ApiParse.php  2012-03-19 20:25:48 UTC 
(rev 114178)
@@ -330,7 +330,7 @@
                        $pout = $page->getParserOutput( $popts );
                        if ( $getWikitext ) {
                 $this->content = $page->getContent( Revision::RAW ); #FIXME: 
use $this->content everywhere
-                               $this->text = $this->content->getRawData(); 
#FIXME: change $this->text to $this->data?!
+                               $this->text = $this->content->getNativeData(); 
#FIXME: change $this->text to $this->data?!
                        }
                        return $pout;
                }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to