Release status: experimental |
|
|---|---|
| Implementation | Special page, Database |
| Description | Adds a special page via which privileged users can administrate QuestyCaptcha questions and their answers |
| Author(s) |
|
| Latest version | 1.1 (2023-02-02) |
| MediaWiki | 1.35-1.39+ |
| Database changes | Yes |
| Tables | questycaptcha_answers questycaptcha_questions |
| License | GNU General Public License 2.0 or later |
| Download | git.legoktm.com |
|
Added rights
|
|
|
Hooks used
|
|
QuestyCaptchaEditor is an on-wiki special page interface for managing QuestyCaptcha questions and their answers.
Privileged users can view the list of existing CAPTCHA questions and their correct answers on Special:QuestyCaptchaEditor and use this special page to add and delete questions and their answers. (While direct editing of existing question+answer(s) pairings isn't supported as of version 1.1, you can delete a question and then readd it to functionally "edit" it.)
Actions taken via the special page are logged to Special:Log/captcha; access to this log is restricted only to privileged users (those who have the same edit-captchas user right needed to access the QuestyCaptchaEditor special page).
Install
Prior to installing the extension, you will need to patch a MediaWiki core file. This is needed because otherwise QuestyCaptchaEditor will not be able to properly overwrite the value of $wgCaptchaClass configuration variable and this will result in an exception being thrown, which thus breaks the wiki and we don't want that.
Apply the needed MediaWiki core hack
- Open
includes/registration/ExtensionProcessor.phpin your favorite text editor - Find the
function addConfigGlobal - Change the line
if ( array_key_exists( $key, $this->globals ) ) {toif ( array_key_exists( $key, $this->globals ) && $key !== 'wgCaptchaClass' ) { - (Optional but strongly recommended) Add a
// single-line commentor/* multi-line comment */explaining the patch, for example:
// CORE HACK for https://www.mediawiki.org/wiki/Extension:QuestyCaptchaEditor
if ( array_key_exists( $key, $this->globals ) && $key !== 'wgCaptchaClass' ) {
// END CORE HACK
5. Save changes to the file
Check out the extension via git
Go to your wiki's extensions directory and run:
git clone https://git.legoktm.com/ashley/QuestyCaptchaEditor.git
Edit LocalSettings.php to load QuestyCaptchaEditor
Add something like the following to the wiki's LocalSettings.php file:
wfLoadExtensions( [
'ConfirmEdit',
'ConfirmEdit/QuestyCaptcha',
'QuestyCaptchaEditor'
] );
Ensure that QuestyCaptchaEditor is loaded after the base ConfirmEdit includes!
Create the new database tables
Re-run the MediaWiki core updater script, maintenance/update.php, to have it create the two new, necessary database tables, questycaptcha_questions and questycaptcha_answers.
All three major DBMSes—MySQL/MariaDB, PostgreSQL and SQLite—should be supported, though support for the latter two hasn't been tested but it's present.
Done!
That's it. You should now be able to use the Special:QuestyCaptchaEditor special page as a privileged user.
Legacy support
If the $wgCaptchaQuestions variable is set in the wiki's LocalSettings.php file, questions and answers from it will override those specified on Special:QuestyCaptchaEditor and the variable should be removed or commented out from LocalSettings.php to make proper use of Special:QuestyCaptchaEditor.
User rights
The new user right edit-captchas, given to the administrator (sysop) user group by default, is needed to access Special:QuestyCaptchaEditor and the restricted log of actions taken via that page at Special:Log/captcha.
Internationalization support
The extension is fully internationalizable. As of version 1.1, the following languages are supported:
- English (en)
- Finnish (fi)
While the Special:QuestyCaptchaEditor special page supports adding question+answer(s) pairings in languages other than the wiki's content language, only the pairs in the wiki's content language will be currently used by the code (see includes/QuestyCaptchaDB.php). In the future, this will probably change so that the uselang URL parameter is properly supported to support wikis with multiple supported languages (e.g. Wikimedia Commons, Wikimedia Meta-Wiki, etc.).
Known bugs/missing features/etc.
- No pagination on
Special:QuestyCaptchaEditor - The special page UI is literally from 2006-2007 and thus not responsive, uses
<table>s, and so on - The functional fix done in version 1.1 to properly support questions with multiple correct answers is unnecessarily inefficient and needs fixing ASAP