mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +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: No e-mail summary immediately after installation
|
||||
- Enh: Added queuing for search updates of commments
|
||||
- Enh: Added queue clear option at Administration - Information
|
||||
|
||||
|
||||
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\DatabaseInfo;
|
||||
use humhub\modules\admin\libs\HumHubAPI;
|
||||
use humhub\modules\queue\driver\MySQL;
|
||||
use humhub\modules\queue\helpers\QueueHelper;
|
||||
use humhub\modules\queue\interfaces\QueueInfoInterface;
|
||||
use humhub\modules\search\jobs\RebuildIndex;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
@ -105,6 +107,15 @@ class InformationController extends Controller
|
||||
|
||||
$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;
|
||||
$delayedJobs = null;
|
||||
$doneJobs = null;
|
||||
@ -122,11 +133,10 @@ class InformationController extends Controller
|
||||
try {
|
||||
$reflect = new ReflectionClass($queue);
|
||||
$driverName = $reflect->getShortName();
|
||||
} catch (\ReflectionException $e) {
|
||||
} catch (ReflectionException $e) {
|
||||
Yii::error('Could not determine queue driver: '. $e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
return $this->render('background-jobs', [
|
||||
'lastRunHourly' => $lastRunHourly,
|
||||
'lastRunDaily' => $lastRunDaily,
|
||||
@ -134,8 +144,8 @@ class InformationController extends Controller
|
||||
'delayedJobs' => $delayedJobs,
|
||||
'doneJobs' => $doneJobs,
|
||||
'reservedJobs' => $reservedJobs,
|
||||
'driverName' => $driverName
|
||||
|
||||
'driverName' => $driverName,
|
||||
'canClearQueue' => $canClearQueue
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,11 @@
|
||||
* @var int|null $delayedJobs
|
||||
* @var int|null $doneJobs
|
||||
* @var int|null $reservedJobs
|
||||
* @var boolean $canClearQueue
|
||||
*/
|
||||
|
||||
use humhub\widgets\Button;
|
||||
|
||||
if (empty($lastRunHourly)) {
|
||||
$lastRunHourly = "<span style='color:red'>" . Yii::t('AdminModule.information', 'Never') . "</span>";
|
||||
} else {
|
||||
@ -39,6 +42,13 @@ if (empty($lastRunDaily)) {
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<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'); ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
@ -61,6 +71,7 @@ if (empty($lastRunDaily)) {
|
||||
<strong><?= Yii::t('AdminModule.information', 'Done'); ?></strong><br/>
|
||||
<?= $doneJobs ?><br/>
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user