Removed the source code and the test code.
Bug: T220656
Change-Id: I3674da6d9c33c08ec2f1774cb793b3a952480571
protocol-relative URL, or full scheme URL), and will instead pass them to the
client where they will likely 404. This usage was deprecated in 1.24.
* Database::reportConnectionError, deprecated in 1.32, has been removed.
+* APIEditBeforeSave hook, deprecated in 1.28, has been removed. Please see
+ EditFilterMergedContent hook for an alternative way to use this feature.
* …
=== Deprecations in 1.34 ===
&$msgs: Message[] Messages to include in the help. Multiple messages will be
joined with spaces.
-'APIEditBeforeSave': DEPRECATED since 1.28! Use EditFilterMergedContent instead.
-Before saving a page with api.php?action=edit, after
-processing request parameters. Return false to let the request fail, returning
-an error message or an <edit result="Failure"> tag if $resultArr was filled.
-Unlike for example 'EditFilterMergedContent' this also being run on undo.
-Since MediaWiki 1.25, 'EditFilterMergedContent' can also return error details
-for the API and it's recommended to use it instead of this hook.
-$editPage: the EditPage object
-$text: the text passed to the API. Note that this includes only the single
- section for section edit, and is not necessarily the final text in case of
- automatically resolved edit conflicts.
-&$resultArr: data in this array will be added to the API result
-
'ApiFeedContributions::feedItem': Called to convert the result of ContribsPager
into a FeedItem instance that ApiFeedContributions can consume. Implementors of
this hook may cancel the hook to signal that the item is not viewable in the
$ep->importFormData( $req );
$content = $ep->textbox1;
- // Run hooks
- // Handle APIEditBeforeSave parameters
- $r = [];
- // Deprecated in favour of EditFilterMergedContent
- if ( !Hooks::run( 'APIEditBeforeSave', [ $ep, $content, &$r ], '1.28' ) ) {
- if ( count( $r ) ) {
- $r['result'] = 'Failure';
- $apiResult->addValue( null, $this->getModuleName(), $r );
-
- return;
- }
-
- $this->dieWithError( 'hookaborted' );
- }
-
// Do the actual save
$oldRevId = $articleObject->getRevIdFetched();
$result = null;
}
}
- public function testEditAbortedByHook() {
- $name = 'Help:' . ucfirst( __FUNCTION__ );
-
- $this->setExpectedException( ApiUsageException::class,
- 'The modification you tried to make was aborted by an extension.' );
-
- $this->hideDeprecated( 'APIEditBeforeSave hook (used in ' .
- 'hook-APIEditBeforeSave-closure)' );
-
- $this->setTemporaryHook( 'APIEditBeforeSave',
- function () {
- return false;
- }
- );
-
- try {
- $this->doApiRequestWithToken( [
- 'action' => 'edit',
- 'title' => $name,
- 'text' => 'Some text',
- ] );
- } finally {
- $this->assertFalse( Title::newFromText( $name )->exists() );
- }
- }
-
- public function testEditAbortedByHookWithCustomOutput() {
- $name = 'Help:' . ucfirst( __FUNCTION__ );
-
- $this->hideDeprecated( 'APIEditBeforeSave hook (used in ' .
- 'hook-APIEditBeforeSave-closure)' );
-
- $this->setTemporaryHook( 'APIEditBeforeSave',
- function ( $unused1, $unused2, &$r ) {
- $r['msg'] = 'Some message';
- return false;
- } );
-
- $result = $this->doApiRequestWithToken( [
- 'action' => 'edit',
- 'title' => $name,
- 'text' => 'Some text',
- ] );
- Wikimedia\restoreWarnings();
-
- $this->assertSame( [ 'msg' => 'Some message', 'result' => 'Failure' ],
- $result[0]['edit'] );
-
- $this->assertFalse( Title::newFromText( $name )->exists() );
- }
-
public function testEditAbortedByEditPageHookWithResult() {
$name = 'Help:' . ucfirst( __FUNCTION__ );