Skip to content

Commit

Permalink
Restrict double call migration with button loader (#6999)
Browse files Browse the repository at this point in the history
* Restrict double call migration with button loader

* Mute migration process when it is already executing

* Small code change

* Set 10 minute timeout for muted migration process

* Remove mutex from migration process
  • Loading branch information
yurabakhtin committed May 15, 2024
1 parent d216e22 commit 783b7a0
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions protected/humhub/modules/admin/views/information/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use humhub\libs\Html;
use humhub\modules\ui\view\components\View;
use humhub\services\MigrationService;
use humhub\widgets\Button;

/**
* @var $this View
Expand All @@ -24,7 +25,10 @@
<?php if ($rebuildSearchRunning): ?>
<div class="alert alert-info"><?= Yii::t('AdminModule.information', 'Search index rebuild in progress.'); ?></div>
<?php else: ?>
<?= Html::a('Rebuild search index', ['/admin/information/database', 'rebuildSearch' => 1], ['class' => 'btn btn-primary pull-right', 'data-method' => 'post', 'data-ui-loader' => '']); ?>
<?= Button::primary(Yii::t('AdminModule.information', 'Rebuild search index'))
->link(['/admin/information/database', 'rebuildSearch' => 1])
->options(['data-method' => 'post'])
->right() ?>
<?php endif; ?>

<?= Yii::t('AdminModule.information', 'The current main HumHub database name is ') ?>
Expand All @@ -41,14 +45,9 @@
</pre>
</div>
<p><br>
<?= Html::a(
Yii::t('AdminModule.information', 'Update Database'),
['/admin/information/database', 'migrate' => 1],
[
'id' => 'migrationRun',
'class' => 'btn btn-primary pull-right',
]
); ?>
<?= Button::primary(Yii::t('AdminModule.information', 'Update Database'))
->link(['/admin/information/database', 'migrate' => 1])
->right() ?>
</p>
<?php elseif ($migrationStatus === MigrationService::DB_ACTION_RUN): ?>
<p><?= Yii::t('AdminModule.information', 'Database migration results:'); ?></p>
Expand All @@ -58,14 +57,9 @@
</pre>
</div>
<p><br>
<?= Html::a(
Yii::t('AdminModule.information', 'Refresh'),
['/admin/information/database'],
[
'id' => 'migrationRun',
'class' => 'btn btn-primary pull-right',
]
); ?>
<?= Button::primary(Yii::t('AdminModule.information', 'Refresh'))
->link(['/admin/information/database'])
->right() ?>
</p>
<?php else: ?>
<p><?= Yii::t('AdminModule.information', 'Your database is <b>up-to-date</b>.'); ?></p>
Expand Down

0 comments on commit 783b7a0

Please sign in to comment.