fix merge of Iec98e472
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index a611c9f..506a546 100644 (file)
@@ -82,7 +82,9 @@ class ApiEditPage extends ApiBase {
                        if ( $titleObj->isRedirect() ) {
                                $oldTitle = $titleObj;
 
-                               $titles = Revision::newFromTitle( $oldTitle )->getContent( Revision::FOR_THIS_USER )->getRedirectChain();
+                               $titles = Revision::newFromTitle( $oldTitle, false, Revision::READ_LATEST )
+                                                       ->getContent( Revision::FOR_THIS_USER )
+                                                       ->getRedirectChain();
                                // array_shift( $titles );
 
                                $redirValues = array();
@@ -126,10 +128,9 @@ class ApiEditPage extends ApiBase {
                {
                        $content = $pageObj->getContent();
 
+                       // @todo: Add support for appending/prepending to the Content interface
+
                        if ( !( $content instanceof TextContent ) ) {
-                               // @todo: ContentHandler should have an isFlat() method or some such
-                               // @todo: XXX: or perhaps there should be Content::append(), Content::prepend()
-                               // @todo: ...and Content::supportsConcatenation()
                                $mode = $contentHandler->getModelID();
                                $this->dieUsage( "Can't append to pages using content model $mode", 'appendnotsupported' );
                        }
@@ -237,7 +238,7 @@ class ApiEditPage extends ApiBase {
                if ( !is_null( $params['summary'] ) ) {
                        $requestArray['wpSummary'] = $params['summary'];
                }
-               
+
                if ( !is_null( $params['sectiontitle'] ) ) {
                        $requestArray['wpSectionTitle'] = $params['sectiontitle'];
                }
@@ -298,6 +299,9 @@ class ApiEditPage extends ApiBase {
                $articleObject = new Article( $titleObj );
                $ep = new EditPage( $articleObject );
 
+               // allow editing of non-textual content.
+               $ep->allowNonTextContent = true;
+
                $ep->setContextTitle( $titleObj );
                $ep->importFormData( $req );