X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialChangeContentModel.php;h=87276a104185732e2728b13e349e21d29fb9c718;hb=b225a84ff95badf1e407c3952e1e0c540507a8e8;hp=dd7f0ed10cddaf870bde7f904b5b76d7def031bb;hpb=fbad7a795ff86ed9e8adf55c091d273688db039f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php index dd7f0ed10c..87276a1041 100644 --- a/includes/specials/SpecialChangeContentModel.php +++ b/includes/specials/SpecialChangeContentModel.php @@ -156,10 +156,20 @@ class SpecialChangeContentModel extends FormSpecialPage { } $this->title = Title::newFromText( $data['pagetitle'] ); + $titleWithNewContentModel = clone $this->title; + $titleWithNewContentModel->setContentModel( $data['model'] ); $user = $this->getUser(); - // Check permissions and make sure the user has permission to edit the specific page - $errors = $this->title->getUserPermissionsErrors( 'editcontentmodel', $user ); - $errors = wfMergeErrorArrays( $errors, $this->title->getUserPermissionsErrors( 'edit', $user ) ); + // Check permissions and make sure the user has permission to: + $errors = wfMergeErrorArrays( + // edit the contentmodel of the page + $this->title->getUserPermissionsErrors( 'editcontentmodel', $user ), + // edit the page under the old content model + $this->title->getUserPermissionsErrors( 'edit', $user ), + // edit the contentmodel under the new content model + $titleWithNewContentModel->getUserPermissionsErrors( 'editcontentmodel', $user ), + // edit the page under the new content model + $titleWithNewContentModel->getUserPermissionsErrors( 'edit', $user ) + ); if ( $errors ) { $out = $this->getOutput(); $wikitext = $out->formatPermissionsErrorMessage( $errors );