aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api')
-rw-r--r--includes/api/ApiEditPage.php13
-rw-r--r--includes/api/ApiParse.php5
-rw-r--r--includes/api/ApiPurge.php2
3 files changed, 11 insertions, 9 deletions
diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php
index 9ed6d08da732..cd07e30dd1e1 100644
--- a/includes/api/ApiEditPage.php
+++ b/includes/api/ApiEditPage.php
@@ -108,21 +108,22 @@ class ApiEditPage extends ApiBase {
// We do want getContent()'s behavior for non-existent
// MediaWiki: pages, though
if ( $articleObj->getID() == 0 && $titleObj->getNamespace() != NS_MEDIAWIKI ) {
- $content = '';
+ $content = null;
+ $text = '';
} else {
- $content = $articleObj->getContent();
+ $content = $articleObj->getContentObject();
+ $text = $content->getRawData();
}
if ( !is_null( $params['section'] ) ) {
// Process the content for section edits
- global $wgParser;
$section = intval( $params['section'] );
- $content = $wgParser->getSection( $content, $section, false );
- if ( $content === false ) {
+ $text = $content->getSection( $section, false );
+ if ( $text === false || $text === null ) {
$this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
}
}
- $params['text'] = $params['prependtext'] . $content . $params['appendtext'];
+ $params['text'] = $params['prependtext'] . $text . $params['appendtext'];
$toMD5 = $params['prependtext'] . $params['appendtext'];
}
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index 893491b9c45f..7824c355e872 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -320,7 +320,7 @@ class ApiParse extends ApiBase {
if ( $this->section !== false ) {
$this->text = $this->getSectionText( $page->getRawText(), !is_null( $pageId )
- ? 'page id ' . $pageId : $titleObj->getText() );
+ ? 'page id ' . $pageId : $titleObj->getText() ); #FIXME: get section...
// Not cached (save or load)
return $wgParser->parse( $this->text, $titleObj, $popts );
@@ -329,7 +329,8 @@ class ApiParse extends ApiBase {
// getParserOutput will save to Parser cache if able
$pout = $page->getParserOutput( $popts );
if ( $getWikitext ) {
- $this->text = $page->getRawText();
+ $this->content = $page->getContent( Revision::RAW ); #FIXME: use $this->content everywhere
+ $this->text = $this->content->getRawData(); #FIXME: change $this->text to $this->data?!
}
return $pout;
}
diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 9e9320fb6c22..c43c03277e40 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -90,7 +90,7 @@ class ApiPurge extends ApiBase {
$popts = ParserOptions::newFromContext( $this->getContext() );
$p_result = $wgParser->parse( $page->getRawText(), $title, $popts,
- true, true, $page->getLatest() );
+ true, true, $page->getLatest() ); #FIXME: content!
# Update the links tables
$u = new LinksUpdate( $title, $p_result );