MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog

Change-Id: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
This commit is contained in:
James D. Forrester 2021-09-03 17:36:34 -07:00
parent 7c06047203
commit 3407458ea0
8 changed files with 24 additions and 9 deletions

View file

@ -497,6 +497,8 @@ because of Phabricator reports.
- RevDelList::reloadFromMaster -> ::reloadFromPrimary()
- ExternalStoreDB::getMaster -> ::getPrimary()
- DatabaseMysqlBase::getMasterServerInfo() -> ::getPrimaryServerInfo()
- MWExceptionHandler::rollbackMasterChangesAndLog() ->
::rollbackPrimaryChangesAndLog()
* wfIncrStats(), deprecated in 1.36, now emits deprecation warnings.
* wfCanIPUseHTTPS() is now deprecated, and always returns true.
* The UserLoadFromDatabase hook has been deprecated. It had no known uses.

View file

@ -845,7 +845,7 @@ class MediaWiki {
try {
$this->restInPeace();
} catch ( Throwable $e ) {
MWExceptionHandler::rollbackMasterChangesAndLog(
MWExceptionHandler::rollbackPrimaryChangesAndLog(
$e,
MWExceptionHandler::CAUGHT_BY_ENTRYPOINT
);

View file

@ -902,7 +902,7 @@ class ApiMain extends ApiBase {
// T65145: Rollback any open database transactions
if ( !$e instanceof ApiUsageException ) {
// ApiUsageExceptions are intentional, so don't rollback if that's the case
MWExceptionHandler::rollbackMasterChangesAndLog(
MWExceptionHandler::rollbackPrimaryChangesAndLog(
$e,
MWExceptionHandler::CAUGHT_BY_ENTRYPOINT
);

View file

@ -101,7 +101,7 @@ class RefreshSecondaryDataUpdate extends DataUpdate
DeferredUpdates::attemptUpdate( $update, $this->lbFactory );
} catch ( Exception $e ) {
// Try as many updates as possible on the first pass
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
MWExceptionHandler::rollbackPrimaryChangesAndLog( $e );
}
}

View file

@ -119,11 +119,11 @@ class MWExceptionHandler {
*
* This method is used to attempt to recover from exceptions
*
* @since 1.23
* @since 1.37
* @param Throwable $e
* @param string $catcher CAUGHT_BY_* class constant indicating what caught the error
*/
public static function rollbackMasterChangesAndLog(
public static function rollbackPrimaryChangesAndLog(
Throwable $e,
$catcher = self::CAUGHT_BY_OTHER
) {
@ -147,6 +147,19 @@ class MWExceptionHandler {
self::logException( $e, $catcher );
}
/**
* @deprecated since 1.37; please use rollbackPrimaryChangesAndLog() instead.
* @param Throwable $e
* @param string $catcher CAUGHT_BY_* class constant indicating what caught the error
*/
public static function rollbackMasterChangesAndLog(
Throwable $e,
$catcher = self::CAUGHT_BY_OTHER
) {
// wfDeprecated( __METHOD__, '1.37' );
self::rollbackPrimaryChangesAndLog( $e, $catcher );
}
/**
* Callback to use with PHP's set_exception_handler.
*
@ -182,7 +195,7 @@ class MWExceptionHandler {
* @param string $catcher CAUGHT_BY_* class constant indicating what caught the error
*/
public static function handleException( Throwable $e, $catcher = self::CAUGHT_BY_OTHER ) {
self::rollbackMasterChangesAndLog( $e, $catcher );
self::rollbackPrimaryChangesAndLog( $e, $catcher );
self::report( $e );
}

View file

@ -377,7 +377,7 @@ class JobRunner implements LoggerAwareInterface {
// Run any deferred update tasks; doUpdates() manages transactions itself
DeferredUpdates::doUpdates();
} catch ( Throwable $e ) {
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
MWExceptionHandler::rollbackPrimaryChangesAndLog( $e );
$status = false;
$error = get_class( $e ) . ': ' . $e->getMessage();
$caught[] = get_class( $e );

View file

@ -121,7 +121,7 @@ class AssembleUploadChunksJob extends Job {
);
$this->setLastError( get_class( $e ) . ": " . $e->getMessage() );
// To be extra robust.
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
MWExceptionHandler::rollbackPrimaryChangesAndLog( $e );
return false;
}

View file

@ -130,7 +130,7 @@ class PublishStashedFileJob extends Job {
$this->setLastError( get_class( $e ) . ": " . $e->getMessage() );
// To prevent potential database referential integrity issues.
// See T34551.
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
MWExceptionHandler::rollbackPrimaryChangesAndLog( $e );
return false;
}