https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114179
Revision: 114179
Author: daniel
Date: 2012-03-19 20:34:30 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
avoid getNativeData()
Modified Paths:
--------------
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/EditPage.php
===================================================================
--- branches/Wikidata/phase3/includes/EditPage.php 2012-03-19 20:25:48 UTC
(rev 114178)
+++ branches/Wikidata/phase3/includes/EditPage.php 2012-03-19 20:34:30 UTC
(rev 114179)
@@ -866,7 +866,7 @@
}
$content = $this->mArticle->getContentObject();
- return $content->getNativeData(); # this editor is for editing
the raw text. so use the raw text.
+ return ContentHandler::getContentText( $content ); # 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:25:48 UTC
(rev 114178)
+++ branches/Wikidata/phase3/includes/WikiPage.php 2012-03-19 20:34:30 UTC
(rev 114179)
@@ -911,7 +911,7 @@
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
if ( $this->mTitle->exists() ) {
- $text = $this->getNativeData();
+ $text = $this->getNativeData(); #FIXME: may not
be a string. check Content model!
} else {
$text = false;
}
@@ -1265,7 +1265,7 @@
$isminor = ( $flags & EDIT_MINOR ) && $user->isAllowed(
'minoredit' );
$bot = $flags & EDIT_FORCE_BOT;
- $oldtext = $this->getNativeData(); // current revision
+ $oldtext = $this->getNativeData(); // current revision #FIXME:
may not be a string. check Content model!
$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:25:48 UTC (rev 114178)
+++ branches/Wikidata/phase3/includes/api/ApiEditPage.php 2012-03-19
20:34:30 UTC (rev 114179)
@@ -112,13 +112,14 @@
$text = '';
} else {
$content = $articleObj->getContentObject();
- $text = $content->getNativeData();
+ $text = ContentHandler::getContentText( $content ); #FIXME:
serialize?! get format from params?...
}
if ( !is_null( $params['section'] ) ) {
// Process the content for section edits
$section = intval( $params['section'] );
- $text = $content->getSection( $section, false );
+ $sectionContent = $content->getSection( $section );
+ $text = ContentHandler::getContentText( $sectionContent );
#FIXME: serialize?! get format from params?...
if ( $text === false || $text === null ) {
$this->dieUsage( "There is no section
{$section}.", 'nosuchsection' );
}
Modified: branches/Wikidata/phase3/includes/api/ApiParse.php
===================================================================
--- branches/Wikidata/phase3/includes/api/ApiParse.php 2012-03-19 20:25:48 UTC
(rev 114178)
+++ branches/Wikidata/phase3/includes/api/ApiParse.php 2012-03-19 20:34:30 UTC
(rev 114179)
@@ -318,7 +318,7 @@
$page = WikiPage::factory( $titleObj );
- if ( $this->section !== false ) {
+ if ( $this->section !== false ) { #FIXME: get section Content,
get parser output, ...
$this->text = $this->getSectionText(
$page->getRawText(), !is_null( $pageId )
? 'page id ' . $pageId :
$titleObj->getText() ); #FIXME: get section...
@@ -330,13 +330,13 @@
$pout = $page->getParserOutput( $popts );
if ( $getWikitext ) {
$this->content = $page->getContent( Revision::RAW ); #FIXME:
use $this->content everywhere
- $this->text = $this->content->getNativeData();
#FIXME: change $this->text to $this->data?!
+ $this->text = ContentHandler::getContentText(
$this->content ); #FIXME: serialize, get format from params; or use object
structure in result?
}
return $pout;
}
}
- private function getSectionText( $text, $what ) {
+ private function getSectionText( $text, $what ) { #FIXME: replace with
Content::getSection
global $wgParser;
// Not cached (save or load)
$text = $wgParser->getSection( $text, $this->section, false );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs