mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-03 20:06:59 +00:00
Fix installer error when the task is run a second time
Fix task idempotency. Check if a table exists before running the schema patch. Bug: T352113 Change-Id: If6f0930ea327df35fe118d4a08993c6383f9d579
This commit is contained in:
parent
441ca70fbf
commit
105f2a3845
|
@ -33,10 +33,11 @@ class InstallSchemaTask extends Task {
|
|||
}
|
||||
|
||||
public function execute(): Status {
|
||||
$status = Status::newGood();
|
||||
$cluster = $this->getConfigVar( 'EchoCluster' );
|
||||
if ( !$cluster ) {
|
||||
// This case is adequately handled by LoadExtensionSchemaUpdates
|
||||
return Status::newGood();
|
||||
return $status;
|
||||
}
|
||||
|
||||
// Get the load balancer
|
||||
|
@ -54,7 +55,10 @@ class InstallSchemaTask extends Task {
|
|||
// Create tables
|
||||
$dbw = $echoLB->getMaintenanceConnectionRef( DB_PRIMARY );
|
||||
$dbw->setSchemaVars( $this->getContext()->getSchemaVars() );
|
||||
return $this->applySourceFile( $dbw, 'tables-generated.sql' );
|
||||
if ( !$dbw->tableExists( 'echo_event' ) ) {
|
||||
$status = $this->applySourceFile( $dbw, 'tables-generated.sql' );
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue