Skip to content

Commit

Permalink
Merge branch '5.x' into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Aug 14, 2024
2 parents d6cb3fb + 7b96476 commit 3747bf6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/console/controllers/LogsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace craft\feedme\console\controllers;

use craft\console\Controller;
use craft\feedme\Plugin;
use yii\console\ExitCode;

class LogsController extends Controller
{
public function actionClear(): int
{
Plugin::$plugin->getLogs()->clear();

return ExitCode::OK;
}
}
3 changes: 0 additions & 3 deletions src/controllers/LogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function actionLogs(): Response
$show = Craft::$app->getRequest()->getParam('show');
$logEntries = Plugin::$plugin->getLogs()->getLogEntries($show);

// Limit to 300 for UI
$logEntries = array_slice($logEntries, 0, 300);

return $this->renderTemplate('feed-me/logs/index', [
'show' => $show,
'logEntries' => $logEntries,
Expand Down
5 changes: 4 additions & 1 deletion src/services/Logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ public function getLogEntries($type = null): array
->select('*')
->where(['category' => self::LOG_CATEGORY])
->orderBy(['log_time' => SORT_DESC])
->from(self::LOG_TABLE);
->from(self::LOG_TABLE)

// Hard-coded until pagination is implemented
->limit(300);

if ($type) {
$query->andWhere(['level' => self::logLevelInt($type)]);
Expand Down

0 comments on commit 3747bf6

Please sign in to comment.