* queries. If a deadlock occurs during the processing, the transaction
* will be rolled back and the callback function will be called again.
*
+ * Avoid using this method outside of Job or Maintenance classes.
+ *
* Usage:
* $dbw->deadlockLoop( callback, ... );
*
* Extra arguments are passed through to the specified callback function.
+ * This method requires that no transactions are already active to avoid
+ * causing premature commits or exceptions.
*
* Returns whatever the callback function returned on its successful,
* iteration, or false on error, for example if the retry limit was
* reached.
+ *
* @return mixed
* @throws DBUnexpectedError
* @throws Exception
}
try {
- $dbw = wfGetDB( DB_MASTER );
- return $dbw->deadlockLoop( [ $revision, 'importOldRevision' ] );
+ return $revision->importOldRevision();
} catch ( MWContentSerializationException $ex ) {
$this->notice( 'import-error-unserialize',
$revision->getTitle()->getPrefixedText(),
* @return bool
*/
public function importLogItem( $revision ) {
- $dbw = wfGetDB( DB_MASTER );
- return $dbw->deadlockLoop( [ $revision, 'importLogItem' ] );
+ return $revision->importLogItem();
}
/**
* @return bool
*/
public function importUpload( $revision ) {
- $dbw = wfGetDB( DB_MASTER );
- return $dbw->deadlockLoop( [ $revision, 'importUpload' ] );
+ return $revision->importUpload();
}
/**
if ( !$this->getTitle() ) {
wfDebug( __METHOD__ . ": skipping invalid {$this->type}/{$this->action} log time, timestamp " .
$this->timestamp . "\n" );
- return;
+ return false;
}
# Check if it exists already
// @todo FIXME: Use original log ID (better for backups)
wfDebug( __METHOD__
. ": skipping existing item for Log:{$this->type}/{$this->action}, timestamp "
. $this->timestamp . "\n" );
- return;
+ return false;
}
$log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
$data = [
'log_params' => $this->params
];
$dbw->insert( 'logging', $data, __METHOD__ );
+
+ return true;
}
/**