Merge "Allow maintenance script to work even when DiscussionToolsEnablePermalinksBackend is off"

This commit is contained in:
jenkins-bot 2023-04-17 09:18:31 +00:00 committed by Gerrit Code Review
commit 0df02e1c71
3 changed files with 6 additions and 4 deletions

View file

@ -45,7 +45,9 @@ class DataUpdatesHooks implements RevisionDataUpdatesHook {
$updates[] = new MWCallableUpdate( function () use ( $rev, $method ) {
try {
$threadItemSet = HookUtils::parseRevisionParsoidHtml( $rev, $method );
$this->threadItemStore->insertThreadItems( $rev, $threadItemSet );
if ( !$this->threadItemStore->isDisabled() ) {
$this->threadItemStore->insertThreadItems( $rev, $threadItemSet );
}
} catch ( Throwable $e ) {
// Catch errors, so that they don't cause other updates to fail (T315383), but log them.
MWExceptionHandler::logException( $e );

View file

@ -61,7 +61,7 @@ class ThreadItemStore {
*
* @return bool
*/
private function isDisabled(): bool {
public function isDisabled(): bool {
return !$this->config->get( 'DiscussionToolsEnablePermalinksBackend' );
}
@ -349,7 +349,7 @@ class ThreadItemStore {
* @return bool
*/
public function insertThreadItems( RevisionRecord $rev, ThreadItemSet $threadItemSet ): bool {
if ( $this->isDisabled() || $this->readOnlyMode->isReadOnly() ) {
if ( $this->readOnlyMode->isReadOnly() ) {
return false;
}

View file

@ -191,7 +191,7 @@ class PersistRevisionThreadItems extends Maintenance {
if ( HookUtils::isAvailableForTitle( $title ) ) {
$threadItemSet = HookUtils::parseRevisionParsoidHtml( $rev, false );
// Store permalink data
// Store permalink data (even when store is disabled - T334258)
$changed = $this->itemStore->insertThreadItems( $rev, $threadItemSet );
}
} catch ( Throwable $e ) {