parent::tearDown();
}
- /**
- * Edits or creates a page/revision
- * @param string $pageName Page title
- * @param string $text Content of the page
- * @param string $summary Optional summary string for the revision
- * @param int $defaultNs Optional namespace id
- * @return array Array as returned by WikiPage::doEditContent()
- */
- protected function editPage( $pageName, $text, $summary = '', $defaultNs = NS_MAIN ) {
- $title = Title::newFromText( $pageName, $defaultNs );
- $page = WikiPage::factory( $title );
-
- return $page->doEditContent( ContentHandler::makeContent( $text, $title ), $summary );
- }
-
/**
* Does the API request and returns the result.
*
}
if ( $tokenType !== null ) {
+ if ( $tokenType === 'auto' ) {
+ $tokenType = ( new ApiMain() )->getModuleManager()
+ ->getModule( $params['action'], 'action' )->needsToken();
+ }
$params['token'] = ApiQueryTokens::getToken(
$wgUser, $sessionObj, ApiQueryTokens::getTokenTypeSalts()[$tokenType]
)->toString();
* @return array Result of the API call
*/
protected function doApiRequestWithToken( array $params, array $session = null,
- User $user = null, $tokenType = 'csrf'
+ User $user = null, $tokenType = 'auto'
) {
return $this->doApiRequest( $params, $session, false, $user, $tokenType );
}