Storage: Log when saveRevision() is hook-aborted
Gives some visibility into hooks like TemplateData onMultiContentSave, which can prevent save due to syntax errors. We want to understand how often this happens, and under what circumstances. Configuration should be set to log the SavePage channel at debug level. Bug: T305821 Change-Id: Idfac599182c216e5bdb405d3722e68a50d8b9168
This commit is contained in:
parent
bc3a5ad329
commit
ae33d06060
2 changed files with 11 additions and 2 deletions
|
|
@ -50,6 +50,7 @@ use MediaWiki\User\UserEditTracker;
|
|||
use MediaWiki\User\UserGroupManager;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use MWException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RecentChange;
|
||||
use RuntimeException;
|
||||
use Status;
|
||||
|
|
@ -210,6 +211,9 @@ class PageUpdater {
|
|||
/** @var string[] */
|
||||
private $softwareTags = [];
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* @param UserIdentity $author
|
||||
* @param WikiPage $wikiPage
|
||||
|
|
@ -225,6 +229,7 @@ class PageUpdater {
|
|||
* @param ServiceOptions $serviceOptions
|
||||
* @param string[] $softwareTags Array of currently enabled software change tags. Can be
|
||||
* obtained from ChangeTags::getSoftwareTags()
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(
|
||||
UserIdentity $author,
|
||||
|
|
@ -239,7 +244,8 @@ class PageUpdater {
|
|||
UserGroupManager $userGroupManager,
|
||||
TitleFormatter $titleFormatter,
|
||||
ServiceOptions $serviceOptions,
|
||||
array $softwareTags
|
||||
array $softwareTags,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$serviceOptions->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
|
||||
$this->serviceOptions = $serviceOptions;
|
||||
|
|
@ -271,6 +277,7 @@ class PageUpdater {
|
|||
)
|
||||
);
|
||||
$this->softwareTags = $softwareTags;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -916,6 +923,7 @@ class PageUpdater {
|
|||
}
|
||||
|
||||
$this->status = $hookStatus;
|
||||
$this->logger->info( "Hook prevented page save", [ 'status' => $hookStatus ] );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,8 @@ class PageUpdaterFactory {
|
|||
PageUpdater::CONSTRUCTOR_OPTIONS,
|
||||
$this->options
|
||||
),
|
||||
$this->softwareTags
|
||||
$this->softwareTags,
|
||||
$this->logger
|
||||
);
|
||||
|
||||
$pageUpdater->setUsePageCreationLog(
|
||||
|
|
|
|||
Loading…
Reference in a new issue