Enh: Added search index rebuild button

This commit is contained in:
Lucas Bartholemy 2018-07-12 00:36:03 +02:00
parent 3a39047396
commit b063f90b4b
3 changed files with 22 additions and 3 deletions

View File

@ -8,6 +8,8 @@ HumHub Change Log
- Fix: UI addition mutation observer interfering with new rich-text mutation logic
- Fix: ThemeLoader publishes assets on CLI requests
- Enh: Add possibility to delete an invitation [#2980](https://github.com/humhub/humhub/issues/2980)
- Enh: Moved search index tasks (add, update & delete) into asynchronous tasks
- Enh: Added search index rebuild button
1.3.0-beta.1 (July 4, 2018)

View File

@ -11,7 +11,9 @@ namespace humhub\modules\admin\controllers;
use humhub\modules\admin\components\Controller;
use humhub\modules\admin\components\DatabaseInfo;
use humhub\modules\admin\libs\HumHubAPI;
use humhub\modules\queue\helpers\QueueHelper;
use humhub\modules\queue\interfaces\QueueInfoInterface;
use humhub\modules\search\jobs\RebuildIndex;
use ReflectionClass;
use Yii;
@ -78,9 +80,15 @@ class InformationController extends Controller
{
$databaseInfo = new DatabaseInfo(Yii::$app->db->dsn);
$rebuildSearchJob = new RebuildIndex();
if (Yii::$app->request->isPost && Yii::$app->request->get('rebuildSearch') == 1) {
Yii::$app->queue->push($rebuildSearchJob);
}
return $this->render(
'database',
[
'rebuildSearchRunning' => QueueHelper::isQueued($rebuildSearchJob),
'databaseName' => $databaseInfo->getDatabaseName(),
'migrate' => \humhub\commands\MigrateController::webMigrateAll(),
]

View File

@ -5,20 +5,29 @@
* @license https://www.humhub.com/licences
*/
use humhub\libs\Html;
/**
* @var $this \humhub\components\View
* @var $databaseName string
* @var $migrate string
* @var $rebuildSearchRunning boolean
*/
?>
<div>
<p>
<?= \Yii::t('base', 'The current main HumHub database name is ') ?>
<i><b><?= \yii\helpers\Html::encode($databaseName) ?></b></i>
<?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' => '']); ?>
<?php endif; ?>
<?= Yii::t('AdminModule.information', 'The current main HumHub database name is ') ?>
<i><b><?= Html::encode($databaseName) ?></b></i>
</p>
</div>
<p>Database migration results:</p>
<p><?= Yii::t('AdminModule.information', 'Database migration results:'); ?></p>
<div class="well">
<pre>