getUserInput(QueueItem::TYPE, 0, UserInput::UINT); } /** * @return void * @throws AjaxException * @throws DBException * @throws IOException * @throws InvalidArgumentException */ public function execute(): void { $query = QueueItem::query(); if($this->getType()) $query->where([QueueItem::TYPE, '=', $this->getType()]); if($filter = $this->getFilter()) $query->search(['progress.message'], $filter); $output = $this->isCLI() ? [] : [ 'items' => [], 'total' => count($query->getQuery()->fetch()) ]; if($this->getLimit()) $query->limit($this->getLimit()); if($this->getSkip()) $query->skip($this->getSkip()); if($this->getSort()) $query->orderBy($this->getSort()); $list = $query->getQuery()->fetch(); foreach($list as $item_details) { try { $item = new QueueItem($item_details[JetBackup::ID_FIELD]); if($this->isCLI()) $output[] = $item->getDisplayCLI(); else $output['items'][] = $item->getDisplay(); } catch (\Throwable $e) { // Skip corrupted items but continue listing others if(!$this->isCLI()) $output['items'][] = [ JetBackup::ID_FIELD => $item_details[JetBackup::ID_FIELD] ?? 'unknown', 'error' => 'Failed to load item: ' . $e->getMessage() ]; } } $this->setResponseData($output); } }