From dfbabd25c763e77e04f5e0e97f0eb55ae33c10ec Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 21 Oct 2021 18:02:24 +0200 Subject: [PATCH] wip #4830 @1.5 --- .../Admin/AssetThemesCrudController.php | 28 +++++++++++++++++++ ...roller.php => ResourcesCrudController.php} | 14 ++++++---- .../Controllers/Admin/TourCrudController.php | 28 +++++++++++++++++++ app/Http/Controllers/Tools/Search.php | 11 ++++++++ .../{Admin => }/ToolsController.php | 10 ++----- app/Jobs/ProcessFluidbook.php | 5 +++- app/Jobs/SearchIndex.php | 10 +------ 7 files changed, 82 insertions(+), 24 deletions(-) create mode 100644 app/Http/Controllers/Admin/AssetThemesCrudController.php rename app/Http/Controllers/Admin/{CrudController.php => ResourcesCrudController.php} (63%) create mode 100644 app/Http/Controllers/Admin/TourCrudController.php create mode 100644 app/Http/Controllers/Tools/Search.php rename app/Http/Controllers/{Admin => }/ToolsController.php (58%) diff --git a/app/Http/Controllers/Admin/AssetThemesCrudController.php b/app/Http/Controllers/Admin/AssetThemesCrudController.php new file mode 100644 index 0000000..3c2c489 --- /dev/null +++ b/app/Http/Controllers/Admin/AssetThemesCrudController.php @@ -0,0 +1,28 @@ +pub = Publication::find(1); + if (null === $this->pub) { + return; + } /** @var Media $media */ $media = $this->pub->getMediaInField($this->pub->getAttributeValue('document'))->first(); @@ -66,7 +69,7 @@ class ProcessFluidbook extends Compiler protected function _getAssetCollection($id) { /** @var Asset $asset */ - $asset = Asset::find($id); + $asset = Asset::createdok()->find($id); if (null === $asset) { throw new \Exception('L\'élement ' . $id . ' n\'existe pas dans la médiathèque'); } diff --git a/app/Jobs/SearchIndex.php b/app/Jobs/SearchIndex.php index 517612d..110d110 100644 --- a/app/Jobs/SearchIndex.php +++ b/app/Jobs/SearchIndex.php @@ -34,17 +34,9 @@ class SearchIndex extends Index public function indexLibrary() { - $indexableTypes = ['audio', 'video']; - - $assets = Asset::all(); + $assets = Asset::createdok()->whereNotNull('theme')->whereIn('type', ['audio', 'video']); foreach ($assets as $asset) { $data = $asset->getPageData(); - if (!in_array($data->get('type'), $indexableTypes)) { - continue; - } - if (!$data->get('theme')) { - continue; - } $doc = new Document(); $doc->setType($data->get('type')); $doc->setId('media_' . $data->get('type') . '_' . $data->get('id')); -- 2.39.5