2007-06-21 19:11:24 +00:00
|
|
|
<?php
|
2010-09-03 18:24:42 +00:00
|
|
|
/**
|
2012-05-04 06:29:11 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
2010-09-03 18:24:42 +00:00
|
|
|
* @file
|
|
|
|
|
*/
|
2007-06-21 19:11:24 +00:00
|
|
|
|
2023-03-01 20:33:26 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2023-09-19 12:13:45 +00:00
|
|
|
use MediaWiki\User\User;
|
2023-03-01 20:33:26 +00:00
|
|
|
|
2007-06-21 19:11:24 +00:00
|
|
|
/**
|
2022-09-23 15:10:58 +00:00
|
|
|
* Send an email notification.
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*
|
|
|
|
|
* @ingroup JobQueue
|
mail: Improve docs, fix file headers, widen `@covers`
* Add missing `ingroup` to class blocks (and remove from any file blocks)
as otherwise the file is indexed twice (e.g. in Doxygen) which makes
navigation on doc.wikimedia.org rather messy.
Remove duplicate descriptions from file blocks in favour of class
doc blocks. This reduces needless duplication and was often
incorrect or outdated, and helps make file headers more consistently
(visually) ignorable.
Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged
* Widen `@covers` tags in phpunit tests
Given all called methods are de-facto and liberally claimed, and
that we keep the coverage limited to the subject class, it maintains
the spirit and intent by listing the class explicitly instead.
PHPUnit offers a more precise tool when you need it (i.e. when testing
legacy monster/god classes), but for well-written code, the
class-wide tag is exactly what you want.
We lose useful coverage and waste valuable time on keeping tags
accurate through refactors (or worse, forget to do so).
Tracking tiny per-method details wastes time in realizing (and
fixing) when people inevitably don't keep them in sync, and time
lost in finding uncovered code to write tests to realize it was
already covered but "not yet claimed".
Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen
While at it, improve purposes and explainations of several mail-related
classes, and set `@since`:
- EmailNotification introduced in r22110 (1.11.0), git a6f6e04841,
later moved to a separate file in bf8810d6bc (Ic435bbdbb6).
- MailAddress introduced in r12082 (1.6.0, 1.5.7), git 5cfddf9a82.
- UserMailer converted to class with ::send in r26357 (1.12.0),
git 353f203ce2.
Change-Id: I1216781240bcfabdebf109cef8f995355db0f659
2024-05-10 17:46:24 +00:00
|
|
|
* @ingroup Mail
|
2007-06-21 19:11:24 +00:00
|
|
|
*/
|
|
|
|
|
class EnotifNotifyJob extends Job {
|
2019-11-30 23:03:59 +00:00
|
|
|
public function __construct( Title $title, array $params ) {
|
2013-12-17 08:26:57 +00:00
|
|
|
parent::__construct( 'enotifNotify', $title, $params );
|
2007-06-21 19:11:24 +00:00
|
|
|
}
|
|
|
|
|
|
2019-12-09 20:06:55 +00:00
|
|
|
public function run() {
|
2008-12-23 18:08:43 +00:00
|
|
|
$enotif = new EmailNotification();
|
2008-05-17 23:34:28 +00:00
|
|
|
// Get the user from ID (rename safe). Anons are 0, so defer to name.
|
2013-04-20 17:18:13 +00:00
|
|
|
if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
|
2008-05-17 23:34:28 +00:00
|
|
|
$editor = User::newFromId( $this->params['editorID'] );
|
|
|
|
|
// B/C, only the name might be given.
|
|
|
|
|
} else {
|
2013-11-25 17:12:42 +00:00
|
|
|
# @todo FIXME: newFromName could return false on a badly configured wiki.
|
2008-05-17 23:34:28 +00:00
|
|
|
$editor = User::newFromName( $this->params['editor'], false );
|
|
|
|
|
}
|
2008-12-23 18:08:43 +00:00
|
|
|
$enotif->actuallyNotifyOnPageChange(
|
2008-05-17 23:34:28 +00:00
|
|
|
$editor,
|
|
|
|
|
$this->title,
|
|
|
|
|
$this->params['timestamp'],
|
|
|
|
|
$this->params['summary'],
|
|
|
|
|
$this->params['minorEdit'],
|
2009-03-02 12:15:28 +00:00
|
|
|
$this->params['oldid'],
|
2012-05-18 21:01:12 +00:00
|
|
|
$this->params['watchers'],
|
|
|
|
|
$this->params['pageStatus']
|
2007-06-21 19:11:24 +00:00
|
|
|
);
|
2013-11-25 14:38:37 +00:00
|
|
|
|
2007-06-21 19:11:24 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
}
|