X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiEditPage.php;h=506a546531703eefc3e12311972101df41b2f2d2;hb=7af8c74e1a799f26ba81fc95d8f0f2dbead52bfc;hp=a611c9f146c923d7b0ea3547f4f454eb73027f2d;hpb=ee007485b8fa9cc56ce18bcb299408a8167dc917;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index a611c9f146..506a546531 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -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 );