mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 06:08:21 +01:00
Enh: Added queue clear option at Administration - Information
This commit is contained in:
parent
04e6e3a9c4
commit
97d4fe5d3c
@ -8,6 +8,7 @@ HumHub Change Log
|
|||||||
- Fix: Disabled Notification E-Mails for installation sample contents
|
- Fix: Disabled Notification E-Mails for installation sample contents
|
||||||
- Fix: No e-mail summary immediately after installation
|
- Fix: No e-mail summary immediately after installation
|
||||||
- Enh: Added queuing for search updates of commments
|
- Enh: Added queuing for search updates of commments
|
||||||
|
- Enh: Added queue clear option at Administration - Information
|
||||||
|
|
||||||
|
|
||||||
1.3.1 (August 7, 2018)
|
1.3.1 (August 7, 2018)
|
||||||
|
@ -11,10 +11,12 @@ namespace humhub\modules\admin\controllers;
|
|||||||
use humhub\modules\admin\components\Controller;
|
use humhub\modules\admin\components\Controller;
|
||||||
use humhub\modules\admin\components\DatabaseInfo;
|
use humhub\modules\admin\components\DatabaseInfo;
|
||||||
use humhub\modules\admin\libs\HumHubAPI;
|
use humhub\modules\admin\libs\HumHubAPI;
|
||||||
|
use humhub\modules\queue\driver\MySQL;
|
||||||
use humhub\modules\queue\helpers\QueueHelper;
|
use humhub\modules\queue\helpers\QueueHelper;
|
||||||
use humhub\modules\queue\interfaces\QueueInfoInterface;
|
use humhub\modules\queue\interfaces\QueueInfoInterface;
|
||||||
use humhub\modules\search\jobs\RebuildIndex;
|
use humhub\modules\search\jobs\RebuildIndex;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
use ReflectionException;
|
||||||
use Yii;
|
use Yii;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,6 +107,15 @@ class InformationController extends Controller
|
|||||||
|
|
||||||
$queue = Yii::$app->queue;
|
$queue = Yii::$app->queue;
|
||||||
|
|
||||||
|
$canClearQueue = false;
|
||||||
|
if ($queue instanceof MySQL) {
|
||||||
|
$canClearQueue = true;
|
||||||
|
$queue->clear();
|
||||||
|
if (Yii::$app->request->isPost && Yii::$app->request->get('clearQueue') == 1) {
|
||||||
|
$this->view->setStatusMessage('success', Yii::t('AdminModule.information', 'Queue successfully cleared.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$waitingJobs = null;
|
$waitingJobs = null;
|
||||||
$delayedJobs = null;
|
$delayedJobs = null;
|
||||||
$doneJobs = null;
|
$doneJobs = null;
|
||||||
@ -122,11 +133,10 @@ class InformationController extends Controller
|
|||||||
try {
|
try {
|
||||||
$reflect = new ReflectionClass($queue);
|
$reflect = new ReflectionClass($queue);
|
||||||
$driverName = $reflect->getShortName();
|
$driverName = $reflect->getShortName();
|
||||||
} catch (\ReflectionException $e) {
|
} catch (ReflectionException $e) {
|
||||||
Yii::error('Could not determine queue driver: '. $e->getMessage());
|
Yii::error('Could not determine queue driver: '. $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->render('background-jobs', [
|
return $this->render('background-jobs', [
|
||||||
'lastRunHourly' => $lastRunHourly,
|
'lastRunHourly' => $lastRunHourly,
|
||||||
'lastRunDaily' => $lastRunDaily,
|
'lastRunDaily' => $lastRunDaily,
|
||||||
@ -134,8 +144,8 @@ class InformationController extends Controller
|
|||||||
'delayedJobs' => $delayedJobs,
|
'delayedJobs' => $delayedJobs,
|
||||||
'doneJobs' => $doneJobs,
|
'doneJobs' => $doneJobs,
|
||||||
'reservedJobs' => $reservedJobs,
|
'reservedJobs' => $reservedJobs,
|
||||||
'driverName' => $driverName
|
'driverName' => $driverName,
|
||||||
|
'canClearQueue' => $canClearQueue
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,11 @@
|
|||||||
* @var int|null $delayedJobs
|
* @var int|null $delayedJobs
|
||||||
* @var int|null $doneJobs
|
* @var int|null $doneJobs
|
||||||
* @var int|null $reservedJobs
|
* @var int|null $reservedJobs
|
||||||
|
* @var boolean $canClearQueue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use humhub\widgets\Button;
|
||||||
|
|
||||||
if (empty($lastRunHourly)) {
|
if (empty($lastRunHourly)) {
|
||||||
$lastRunHourly = "<span style='color:red'>" . Yii::t('AdminModule.information', 'Never') . "</span>";
|
$lastRunHourly = "<span style='color:red'>" . Yii::t('AdminModule.information', 'Never') . "</span>";
|
||||||
} else {
|
} else {
|
||||||
@ -39,6 +42,13 @@ if (empty($lastRunDaily)) {
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
|
<?php if ($canClearQueue): ?>
|
||||||
|
<?= Button::danger('Clear queue')
|
||||||
|
->link(['background-jobs', 'clearQueue' => 1])
|
||||||
|
->options(['data-method' => 'POST'])
|
||||||
|
->xs()->right();
|
||||||
|
?>
|
||||||
|
<?php endif; ?>
|
||||||
<?= Yii::t('AdminModule.information', '<strong>Queue</strong> Status'); ?>
|
<?= Yii::t('AdminModule.information', '<strong>Queue</strong> Status'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
@ -61,6 +71,7 @@ if (empty($lastRunDaily)) {
|
|||||||
<strong><?= Yii::t('AdminModule.information', 'Done'); ?></strong><br/>
|
<strong><?= Yii::t('AdminModule.information', 'Done'); ?></strong><br/>
|
||||||
<?= $doneJobs ?><br/>
|
<?= $doneJobs ?><br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user