X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=blobdiff_plain;f=includes%2Fapi%2FApiDelete.php;h=2a6e2e7b380ce7a6cec107ab37b661b2c81a8c13;hb=af28c6f55abdf3d00b18cc44af8ca41e22955491;hp=eb83432d979624e9343422276d1bafbad76b3f7f;hpb=4c1973e52e8d3c3b7aa6203a985ff1cdf0de6d86;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index eb83432d97..2a6e2e7b38 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -46,24 +46,11 @@ class ApiDelete extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - $this->requireOnlyOneParameter( $params, 'title', 'pageid' ); - - if ( isset( $params['title'] ) ) { - $titleObj = Title::newFromText( $params['title'] ); - if ( !$titleObj ) { - $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); - } - $pageObj = WikiPage::factory( $titleObj ); - $pageObj->loadPageData( 'fromdbmaster' ); - if ( !$pageObj->exists() ) { - $this->dieUsageMsg( 'notanarticle' ); - } - } elseif ( isset( $params['pageid'] ) ) { - $pageObj = WikiPage::newFromID( $params['pageid'] ); - if ( !$pageObj ) { - $this->dieUsageMsg( array( 'nosuchpageid', $params['pageid'] ) ); - } - $titleObj = $pageObj->getTitle(); + $titleObj = $this->getTitleOrPageId( $params ); + $pageObj = WikiPage::factory( $titleObj ); + $pageObj->loadPageData( 'fromdbmaster' ); + if ( !$pageObj->exists() ) { + $this->dieUsageMsg( 'notanarticle' ); } $reason = ( isset( $params['reason'] ) ? $params['reason'] : null ); @@ -241,7 +228,7 @@ class ApiDelete extends ApiBase { public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), - $this->getRequireOnlyOneParameterErrorMessages( array( 'title', 'pageid' ) ), + $this->getTitleOrPageIdErrorMessage(), array( array( 'invalidtitle', 'title' ), array( 'nosuchpageid', 'pageid' ),