Manual:removeInvalidEmails.php
MediaWiki version: | ≥ 1.25 |
MediaWiki file: removeInvalidEmails.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.42.4 • 1.41.5 • 1.39.11 |
Classes: | RemoveInvalidEmails |
Details
editremoveInvalidEmails.php is a maintenance script.
Emails are validated before users can add them, but this was not always the case so older users may have invalid ones.
This script can be used to remove emails that are invalid from the user_email
column of the user
table.
The script is checking all users, who have provided an email address, which has not yet been authenticated. It validates an email address using an HTML5 specification found at: http://www.whatwg.org/html/states-of-the-type-attribute.html#valid-e-mail-address
The implementation is not 100% identical to, but comes close to RFC 2822. The script can be used to remove all invalid email addresses.
Options/Arguments
editOption | Description | Required? |
---|---|---|
--commit | Whether to actually update the database. Defaults to false so that the script, if --commit is not provided, is run in dry-run mode.
|
Optional |
Usage
editphp maintenance/run.php removeInvalidEmails
Terminal
$ php maintenance/run.php removeInvalidEmails --commit Found bad email: email@example@example.com for user #5 Removing 1 emails from the database. Done
In MediaWiki version 1.39.10 and earlier, you must invoke maintenance scripts using
php maintenance/scriptName.php
instead of php maintenance/run.php scriptName
.