Last modified: 2012-03-19 20:41:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24922, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22922 - Aborting a block using BlockIp hook shows <hookaborted> on the block form
Aborting a block using BlockIp hook shows <hookaborted> on the block form
Status: NEW
Product: MediaWiki
Classification: Unclassified
User blocking (Other open bugs)
1.15.x
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 14261 35331
  Show dependency treegraph
 
Reported: 2010-03-22 17:19 UTC by Nikola Kovacs
Modified: 2012-03-19 20:41 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Screenshot (54.19 KB, image/png)
2010-03-22 17:19 UTC, Nikola Kovacs
Details
Quick and dirty hack (569 bytes, patch)
2011-10-13 18:15 UTC, Nikola Kovacs
Details

Description Nikola Kovacs 2010-03-22 17:19:15 UTC
Created attachment 7237 [details]
Screenshot

The following simple extension will cancel the block, and the message "Block aborted" will be displayed at the top of the block form. However a large red <hookaborted> message will also be displayed, below blockiptext. The latter shouldn't be shown if the extension already returns an error message of its own, and should be something more user-friendly otherwise.

<?php

if ( !defined( 'MEDIAWIKI' ) ) {
	exit;
}

$wgHooks['BlockIp'][] = 'BlockIpTest';

function BlockIpTest( &$ban, &$user ) {
  return 'Block aborted';
}
Comment 1 Happy-melon 2011-06-27 23:00:04 UTC
Can you confirm whether this still occurs in trunk?  The blocking system has been completely rewritten since 1.15.
Comment 2 Nikola Kovacs 2011-10-13 18:10:16 UTC
It's slightly better in that it displays the message "The modification you tried to make was aborted by an extension hook." instead of <hookabort>, but it still doesn't allow the extension to customize that message, instead the extension's error message is outputted at the top and the title of the page changes to "internal error".
Comment 3 Nikola Kovacs 2011-10-13 18:15:51 UTC
Created attachment 9228 [details]
Quick and dirty hack

Here's a patch to show you a rough idea of what I'd like. Instead of returning a string, the extension can set the third parameter of the blockip hook and return false. The problem with this patch though is that it requires error to be a message key.
Comment 4 Nikola Kovacs 2011-10-13 18:17:01 UTC
And the extension to test this:

<?php

if ( !defined( 'MEDIAWIKI' ) ) {
    exit;
}

$wgHooks['BlockIp'][] = 'BlockIpTest';

$wgExtensionMessagesFiles['PageList'] = dirname( __FILE__ ) . '/blocktest.i18n.php';

function BlockIpTest( &$ban, &$user, &$error ) {
  $error = 'test-abort';
  return false;
}

and blocktest.i18n.php is:

<?php

$messages = array();

$messages['en'] = array(
	'test-abort'   => 'Testing block abort',
);

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links