From b77ab6f3af996f924bd2ddbac6e88f61a8bf6cf9 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 7 Feb 2024 22:41:45 +0000 Subject: [PATCH] Queries: Moved out or removed some class-level items Also ran auto-removal of unused imports across app folder. --- .../Controllers/CommentController.php | 1 - app/Api/ApiDocsGenerator.php | 1 - app/App/HomeController.php | 1 - app/App/Providers/ThemeServiceProvider.php | 1 - .../Commands/CopyShelfPermissionsCommand.php | 1 - app/Entities/Controllers/BookController.php | 1 - .../ChapterExportApiController.php | 1 - app/Entities/Controllers/PageController.php | 1 - .../Controllers/PageExportApiController.php | 1 - app/Entities/Models/BookChild.php | 15 ------ app/Entities/Models/Chapter.php | 9 ---- app/Entities/Models/Page.php | 12 ----- app/Entities/Queries/BookQueries.php | 7 ++- app/Entities/Queries/BookshelfQueries.php | 6 ++- app/Entities/Queries/ChapterQueries.php | 3 +- app/Entities/Queries/EntityQueries.php | 24 ++++++++-- app/Entities/Queries/PageQueries.php | 30 ++++++++---- .../Queries/ProvidesEntityQueries.php | 13 +++++ app/Entities/Repos/BaseRepo.php | 1 - app/Permissions/JointPermissionBuilder.php | 1 - app/References/ReferenceController.php | 4 -- app/Search/SearchController.php | 1 - app/Search/SearchRunner.php | 48 ++++++++----------- app/Uploads/AttachmentService.php | 1 - .../Controllers/AttachmentApiController.php | 1 - .../Controllers/GalleryImageController.php | 2 - .../Controllers/ImageGalleryApiController.php | 1 - app/Uploads/ImageRepo.php | 1 - app/Uploads/ImageService.php | 3 -- 29 files changed, 85 insertions(+), 107 deletions(-) diff --git a/app/Activity/Controllers/CommentController.php b/app/Activity/Controllers/CommentController.php index 0e8db9eaf..52ccc8238 100644 --- a/app/Activity/Controllers/CommentController.php +++ b/app/Activity/Controllers/CommentController.php @@ -3,7 +3,6 @@ namespace BookStack\Activity\Controllers; use BookStack\Activity\CommentRepo; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Http\Controller; use Illuminate\Http\Request; diff --git a/app/Api/ApiDocsGenerator.php b/app/Api/ApiDocsGenerator.php index bffc38623..9cae80617 100644 --- a/app/Api/ApiDocsGenerator.php +++ b/app/Api/ApiDocsGenerator.php @@ -7,7 +7,6 @@ use Exception; use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; use Illuminate\Validation\Rules\Password; diff --git a/app/App/HomeController.php b/app/App/HomeController.php index 6a4cb0176..56f3d81a8 100644 --- a/app/App/HomeController.php +++ b/app/App/HomeController.php @@ -3,7 +3,6 @@ namespace BookStack\App; use BookStack\Activity\ActivityQueries; -use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\EntityQueries; use BookStack\Entities\Queries\RecentlyViewed; diff --git a/app/App/Providers/ThemeServiceProvider.php b/app/App/Providers/ThemeServiceProvider.php index c15b43a6b..4c657d912 100644 --- a/app/App/Providers/ThemeServiceProvider.php +++ b/app/App/Providers/ThemeServiceProvider.php @@ -4,7 +4,6 @@ namespace BookStack\App\Providers; use BookStack\Theming\ThemeEvents; use BookStack\Theming\ThemeService; -use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; class ThemeServiceProvider extends ServiceProvider diff --git a/app/Console/Commands/CopyShelfPermissionsCommand.php b/app/Console/Commands/CopyShelfPermissionsCommand.php index 8463ccd03..c5e2d504e 100644 --- a/app/Console/Commands/CopyShelfPermissionsCommand.php +++ b/app/Console/Commands/CopyShelfPermissionsCommand.php @@ -2,7 +2,6 @@ namespace BookStack\Console\Commands; -use BookStack\Entities\Models\Bookshelf; use BookStack\Entities\Queries\BookshelfQueries; use BookStack\Entities\Tools\PermissionsUpdater; use Illuminate\Console\Command; diff --git a/app/Entities/Controllers/BookController.php b/app/Entities/Controllers/BookController.php index a0b98636f..a1c586f47 100644 --- a/app/Entities/Controllers/BookController.php +++ b/app/Entities/Controllers/BookController.php @@ -6,7 +6,6 @@ use BookStack\Activity\ActivityQueries; use BookStack\Activity\ActivityType; use BookStack\Activity\Models\View; use BookStack\Activity\Tools\UserEntityWatchOptions; -use BookStack\Entities\Models\Bookshelf; use BookStack\Entities\Queries\BookQueries; use BookStack\Entities\Queries\BookshelfQueries; use BookStack\Entities\Repos\BookRepo; diff --git a/app/Entities/Controllers/ChapterExportApiController.php b/app/Entities/Controllers/ChapterExportApiController.php index 08aa959b3..ceb2522b2 100644 --- a/app/Entities/Controllers/ChapterExportApiController.php +++ b/app/Entities/Controllers/ChapterExportApiController.php @@ -2,7 +2,6 @@ namespace BookStack\Entities\Controllers; -use BookStack\Entities\Models\Chapter; use BookStack\Entities\Queries\ChapterQueries; use BookStack\Entities\Tools\ExportFormatter; use BookStack\Http\ApiController; diff --git a/app/Entities/Controllers/PageController.php b/app/Entities/Controllers/PageController.php index 44ba999e8..eab53bb25 100644 --- a/app/Entities/Controllers/PageController.php +++ b/app/Entities/Controllers/PageController.php @@ -7,7 +7,6 @@ use BookStack\Activity\Tools\CommentTree; use BookStack\Activity\Tools\UserEntityWatchOptions; use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Chapter; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\EntityQueries; use BookStack\Entities\Queries\PageQueries; use BookStack\Entities\Repos\PageRepo; diff --git a/app/Entities/Controllers/PageExportApiController.php b/app/Entities/Controllers/PageExportApiController.php index 8737f2f3e..693760bc8 100644 --- a/app/Entities/Controllers/PageExportApiController.php +++ b/app/Entities/Controllers/PageExportApiController.php @@ -2,7 +2,6 @@ namespace BookStack\Entities\Controllers; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Entities\Tools\ExportFormatter; use BookStack\Http\ApiController; diff --git a/app/Entities/Models/BookChild.php b/app/Entities/Models/BookChild.php index d19a2466a..ad54fb926 100644 --- a/app/Entities/Models/BookChild.php +++ b/app/Entities/Models/BookChild.php @@ -13,24 +13,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property int $priority * @property string $book_slug * @property Book $book - * - * @method Builder whereSlugs(string $bookSlug, string $childSlug) */ abstract class BookChild extends Entity { - /** - * Scope a query to find items where the child has the given childSlug - * where its parent has the bookSlug. - */ - public function scopeWhereSlugs(Builder $query, string $bookSlug, string $childSlug) - { - return $query->with('book') - ->whereHas('book', function (Builder $query) use ($bookSlug) { - $query->where('slug', '=', $bookSlug); - }) - ->where('slug', '=', $childSlug); - } - /** * Get the book this page sits in. */ diff --git a/app/Entities/Models/Chapter.php b/app/Entities/Models/Chapter.php index 422c82442..c926aaa64 100644 --- a/app/Entities/Models/Chapter.php +++ b/app/Entities/Models/Chapter.php @@ -69,13 +69,4 @@ class Chapter extends BookChild ->orderBy('priority', 'asc') ->get(); } - - /** - * Get a visible chapter by its book and page slugs. - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public static function getBySlugs(string $bookSlug, string $chapterSlug): self - { - return static::visible()->whereSlugs($bookSlug, $chapterSlug)->firstOrFail(); - } } diff --git a/app/Entities/Models/Page.php b/app/Entities/Models/Page.php index 17d6f9a01..3a433338b 100644 --- a/app/Entities/Models/Page.php +++ b/app/Entities/Models/Page.php @@ -32,9 +32,6 @@ class Page extends BookChild { use HasFactory; - public static $listAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'text', 'created_at', 'updated_at', 'priority']; - public static $contentAttributes = ['name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', 'template', 'html', 'text', 'created_at', 'updated_at', 'priority']; - protected $fillable = ['name', 'priority']; public string $textField = 'text'; @@ -145,13 +142,4 @@ class Page extends BookChild return $refreshed; } - - /** - * Get a visible page by its book and page slugs. - * @throws \Illuminate\Database\Eloquent\ModelNotFoundException - */ - public static function getBySlugs(string $bookSlug, string $pageSlug): self - { - return static::visible()->whereSlugs($bookSlug, $pageSlug)->firstOrFail(); - } } diff --git a/app/Entities/Queries/BookQueries.php b/app/Entities/Queries/BookQueries.php index 2ffff5eca..8f62e513c 100644 --- a/app/Entities/Queries/BookQueries.php +++ b/app/Entities/Queries/BookQueries.php @@ -8,6 +8,10 @@ use Illuminate\Database\Eloquent\Builder; class BookQueries implements ProvidesEntityQueries { + protected static array $listAttributes = [ + 'id', 'slug', 'name', 'description', 'created_at', 'updated_at', 'image_id' + ]; + public function start(): Builder { return Book::query(); @@ -40,7 +44,8 @@ class BookQueries implements ProvidesEntityQueries public function visibleForList(): Builder { - return $this->start()->scopes('visible'); + return $this->start()->scopes('visible') + ->select(static::$listAttributes); } public function visibleForListWithCover(): Builder diff --git a/app/Entities/Queries/BookshelfQueries.php b/app/Entities/Queries/BookshelfQueries.php index f2fe50531..47ff068a9 100644 --- a/app/Entities/Queries/BookshelfQueries.php +++ b/app/Entities/Queries/BookshelfQueries.php @@ -8,6 +8,10 @@ use Illuminate\Database\Eloquent\Builder; class BookshelfQueries implements ProvidesEntityQueries { + protected static array $listAttributes = [ + 'id', 'slug', 'name', 'description', 'created_at', 'updated_at', 'image_id' + ]; + public function start(): Builder { return Bookshelf::query(); @@ -46,7 +50,7 @@ class BookshelfQueries implements ProvidesEntityQueries public function visibleForList(): Builder { - return $this->start()->scopes('visible'); + return $this->start()->scopes('visible')->select(static::$listAttributes); } public function visibleForListWithCover(): Builder diff --git a/app/Entities/Queries/ChapterQueries.php b/app/Entities/Queries/ChapterQueries.php index 31193c7ea..34f762a15 100644 --- a/app/Entities/Queries/ChapterQueries.php +++ b/app/Entities/Queries/ChapterQueries.php @@ -10,8 +10,7 @@ class ChapterQueries implements ProvidesEntityQueries { protected static array $listAttributes = [ 'id', 'slug', 'name', 'description', 'priority', - 'created_at', 'updated_at', - 'created_by', 'updated_by', 'owned_by', + 'created_at', 'updated_at' ]; public function start(): Builder diff --git a/app/Entities/Queries/EntityQueries.php b/app/Entities/Queries/EntityQueries.php index 31e5b913a..36dc6c0bc 100644 --- a/app/Entities/Queries/EntityQueries.php +++ b/app/Entities/Queries/EntityQueries.php @@ -3,6 +3,8 @@ namespace BookStack\Entities\Queries; use BookStack\Entities\Models\Entity; +use Illuminate\Database\Eloquent\Builder; +use InvalidArgumentException; class EntityQueries { @@ -25,9 +27,25 @@ class EntityQueries $explodedId = explode(':', $identifier); $entityType = $explodedId[0]; $entityId = intval($explodedId[1]); + $queries = $this->getQueriesForType($entityType); + return $queries->findVisibleById($entityId); + } + + /** + * Start a query of visible entities of the given type, + * suitable for listing display. + */ + public function visibleForList(string $entityType): Builder + { + $queries = $this->getQueriesForType($entityType); + return $queries->visibleForList(); + } + + protected function getQueriesForType(string $type): ProvidesEntityQueries + { /** @var ?ProvidesEntityQueries $queries */ - $queries = match ($entityType) { + $queries = match ($type) { 'page' => $this->pages, 'chapter' => $this->chapters, 'book' => $this->books, @@ -36,9 +54,9 @@ class EntityQueries }; if (is_null($queries)) { - return null; + throw new InvalidArgumentException("No entity query class configured for {$type}"); } - return $queries->findVisibleById($entityId); + return $queries; } } diff --git a/app/Entities/Queries/PageQueries.php b/app/Entities/Queries/PageQueries.php index e22769c3a..ec27ba4aa 100644 --- a/app/Entities/Queries/PageQueries.php +++ b/app/Entities/Queries/PageQueries.php @@ -8,6 +8,15 @@ use Illuminate\Database\Eloquent\Builder; class PageQueries implements ProvidesEntityQueries { + protected static array $contentAttributes = [ + 'name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', + 'template', 'html', 'text', 'created_at', 'updated_at', 'priority' + ]; + protected static array $listAttributes = [ + 'name', 'id', 'slug', 'book_id', 'chapter_id', 'draft', + 'template', 'text', 'created_at', 'updated_at', 'priority' + ]; + public function start(): Builder { return Page::query(); @@ -60,22 +69,14 @@ class PageQueries implements ProvidesEntityQueries { return $this->start() ->scopes('visible') - ->select(array_merge(Page::$listAttributes, ['book_slug' => function ($builder) { - $builder->select('slug') - ->from('books') - ->whereColumn('books.id', '=', 'pages.book_id'); - }])); + ->select($this->mergeBookSlugForSelect(static::$listAttributes)); } public function visibleWithContents(): Builder { return $this->start() ->scopes('visible') - ->select(array_merge(Page::$contentAttributes, ['book_slug' => function ($builder) { - $builder->select('slug') - ->from('books') - ->whereColumn('books.id', '=', 'pages.book_id'); - }])); + ->select($this->mergeBookSlugForSelect(static::$contentAttributes)); } public function currentUserDraftsForList(): Builder @@ -90,4 +91,13 @@ class PageQueries implements ProvidesEntityQueries return $this->visibleForList() ->where('template', '=', true); } + + protected function mergeBookSlugForSelect(array $columns): array + { + return array_merge($columns, ['book_slug' => function ($builder) { + $builder->select('slug') + ->from('books') + ->whereColumn('books.id', '=', 'pages.book_id'); + }]); + } } diff --git a/app/Entities/Queries/ProvidesEntityQueries.php b/app/Entities/Queries/ProvidesEntityQueries.php index 103352244..611d0ae52 100644 --- a/app/Entities/Queries/ProvidesEntityQueries.php +++ b/app/Entities/Queries/ProvidesEntityQueries.php @@ -16,6 +16,19 @@ use Illuminate\Database\Eloquent\Builder; */ interface ProvidesEntityQueries { + /** + * Start a new query for this entity type. + */ public function start(): Builder; + + /** + * Find the entity of the given ID, or return null if not found. + */ public function findVisibleById(int $id): ?Entity; + + /** + * Start a query for items that are visible, with selection + * configured for list display of this item. + */ + public function visibleForList(): Builder; } diff --git a/app/Entities/Repos/BaseRepo.php b/app/Entities/Repos/BaseRepo.php index 6674f559a..033350743 100644 --- a/app/Entities/Repos/BaseRepo.php +++ b/app/Entities/Repos/BaseRepo.php @@ -8,7 +8,6 @@ use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\HasCoverImage; use BookStack\Entities\Models\HasHtmlDescription; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\ImageUploadException; use BookStack\References\ReferenceStore; diff --git a/app/Permissions/JointPermissionBuilder.php b/app/Permissions/JointPermissionBuilder.php index 49eaf0774..c2922cdc9 100644 --- a/app/Permissions/JointPermissionBuilder.php +++ b/app/Permissions/JointPermissionBuilder.php @@ -4,7 +4,6 @@ namespace BookStack\Permissions; use BookStack\Entities\Models\Book; use BookStack\Entities\Models\BookChild; -use BookStack\Entities\Models\Bookshelf; use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\Page; diff --git a/app/References/ReferenceController.php b/app/References/ReferenceController.php index 57dbcce3c..2fe86fd59 100644 --- a/app/References/ReferenceController.php +++ b/app/References/ReferenceController.php @@ -2,10 +2,6 @@ namespace BookStack\References; -use BookStack\Entities\Models\Book; -use BookStack\Entities\Models\Bookshelf; -use BookStack\Entities\Models\Chapter; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\EntityQueries; use BookStack\Http\Controller; diff --git a/app/Search/SearchController.php b/app/Search/SearchController.php index 08f0826dd..b94ec1ec7 100644 --- a/app/Search/SearchController.php +++ b/app/Search/SearchController.php @@ -2,7 +2,6 @@ namespace BookStack\Search; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Entities\Queries\Popular; use BookStack\Entities\Tools\SiblingFetcher; diff --git a/app/Search/SearchRunner.php b/app/Search/SearchRunner.php index aac9d1000..94518dbf7 100644 --- a/app/Search/SearchRunner.php +++ b/app/Search/SearchRunner.php @@ -3,9 +3,9 @@ namespace BookStack\Search; use BookStack\Entities\EntityProvider; -use BookStack\Entities\Models\BookChild; use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\Page; +use BookStack\Entities\Queries\EntityQueries; use BookStack\Permissions\PermissionApplicator; use BookStack\Users\Models\User; use Illuminate\Database\Connection; @@ -20,9 +20,6 @@ use SplObjectStorage; class SearchRunner { - protected EntityProvider $entityProvider; - protected PermissionApplicator $permissions; - /** * Acceptable operators to be used in a query. * @@ -38,10 +35,11 @@ class SearchRunner */ protected $termAdjustmentCache; - public function __construct(EntityProvider $entityProvider, PermissionApplicator $permissions) - { - $this->entityProvider = $entityProvider; - $this->permissions = $permissions; + public function __construct( + protected EntityProvider $entityProvider, + protected PermissionApplicator $permissions, + protected EntityQueries $entityQueries, + ) { $this->termAdjustmentCache = new SplObjectStorage(); } @@ -72,10 +70,9 @@ class SearchRunner continue; } - $entityModelInstance = $this->entityProvider->get($entityType); - $searchQuery = $this->buildQuery($searchOpts, $entityModelInstance); + $searchQuery = $this->buildQuery($searchOpts, $entityType); $entityTotal = $searchQuery->count(); - $searchResults = $this->getPageOfDataFromQuery($searchQuery, $entityModelInstance, $page, $count); + $searchResults = $this->getPageOfDataFromQuery($searchQuery, $entityType, $page, $count); if ($entityTotal > ($page * $count)) { $hasMore = true; @@ -108,8 +105,7 @@ class SearchRunner continue; } - $entityModelInstance = $this->entityProvider->get($entityType); - $search = $this->buildQuery($opts, $entityModelInstance)->where('book_id', '=', $bookId)->take(20)->get(); + $search = $this->buildQuery($opts, $entityType)->where('book_id', '=', $bookId)->take(20)->get(); $results = $results->merge($search); } @@ -122,8 +118,7 @@ class SearchRunner public function searchChapter(int $chapterId, string $searchString): Collection { $opts = SearchOptions::fromString($searchString); - $entityModelInstance = $this->entityProvider->get('page'); - $pages = $this->buildQuery($opts, $entityModelInstance)->where('chapter_id', '=', $chapterId)->take(20)->get(); + $pages = $this->buildQuery($opts, 'page')->where('chapter_id', '=', $chapterId)->take(20)->get(); return $pages->sortByDesc('score'); } @@ -131,17 +126,17 @@ class SearchRunner /** * Get a page of result data from the given query based on the provided page parameters. */ - protected function getPageOfDataFromQuery(EloquentBuilder $query, Entity $entityModelInstance, int $page = 1, int $count = 20): EloquentCollection + protected function getPageOfDataFromQuery(EloquentBuilder $query, string $entityType, int $page = 1, int $count = 20): EloquentCollection { $relations = ['tags']; - if ($entityModelInstance instanceof BookChild) { + if ($entityType === 'page' || $entityType === 'chapter') { $relations['book'] = function (BelongsTo $query) { $query->scopes('visible'); }; } - if ($entityModelInstance instanceof Page) { + if ($entityType === 'page') { $relations['chapter'] = function (BelongsTo $query) { $query->scopes('visible'); }; @@ -157,18 +152,13 @@ class SearchRunner /** * Create a search query for an entity. */ - protected function buildQuery(SearchOptions $searchOpts, Entity $entityModelInstance): EloquentBuilder + protected function buildQuery(SearchOptions $searchOpts, string $entityType): EloquentBuilder { - $entityQuery = $entityModelInstance->newQuery()->scopes('visible'); - - if ($entityModelInstance instanceof Page) { - $entityQuery->select(array_merge($entityModelInstance::$listAttributes, ['owned_by'])); - } else { - $entityQuery->select(['*']); - } + $entityModelInstance = $this->entityProvider->get($entityType); + $entityQuery = $this->entityQueries->visibleForList($entityType); // Handle normal search terms - $this->applyTermSearch($entityQuery, $searchOpts, $entityModelInstance); + $this->applyTermSearch($entityQuery, $searchOpts, $entityType); // Handle exact term matching foreach ($searchOpts->exacts as $inputTerm) { @@ -198,7 +188,7 @@ class SearchRunner /** * For the given search query, apply the queries for handling the regular search terms. */ - protected function applyTermSearch(EloquentBuilder $entityQuery, SearchOptions $options, Entity $entity): void + protected function applyTermSearch(EloquentBuilder $entityQuery, SearchOptions $options, string $entityType): void { $terms = $options->searches; if (count($terms) === 0) { @@ -216,7 +206,7 @@ class SearchRunner $subQuery->addBinding($scoreSelect['bindings'], 'select'); - $subQuery->where('entity_type', '=', $entity->getMorphClass()); + $subQuery->where('entity_type', '=', $entityType); $subQuery->where(function (Builder $query) use ($terms) { foreach ($terms as $inputTerm) { $inputTerm = str_replace('\\', '\\\\', $inputTerm); diff --git a/app/Uploads/AttachmentService.php b/app/Uploads/AttachmentService.php index 72f78e347..bd319fbd7 100644 --- a/app/Uploads/AttachmentService.php +++ b/app/Uploads/AttachmentService.php @@ -4,7 +4,6 @@ namespace BookStack\Uploads; use BookStack\Exceptions\FileUploadException; use Exception; -use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Contracts\Filesystem\Filesystem as Storage; use Illuminate\Filesystem\FilesystemManager; use Illuminate\Support\Facades\Log; diff --git a/app/Uploads/Controllers/AttachmentApiController.php b/app/Uploads/Controllers/AttachmentApiController.php index 2832fa8e1..9040ba6d3 100644 --- a/app/Uploads/Controllers/AttachmentApiController.php +++ b/app/Uploads/Controllers/AttachmentApiController.php @@ -2,7 +2,6 @@ namespace BookStack\Uploads\Controllers; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\FileUploadException; use BookStack\Http\ApiController; diff --git a/app/Uploads/Controllers/GalleryImageController.php b/app/Uploads/Controllers/GalleryImageController.php index 258f2bef6..1bc9da2d7 100644 --- a/app/Uploads/Controllers/GalleryImageController.php +++ b/app/Uploads/Controllers/GalleryImageController.php @@ -8,8 +8,6 @@ use BookStack\Uploads\ImageRepo; use BookStack\Uploads\ImageResizer; use BookStack\Util\OutOfMemoryHandler; use Illuminate\Http\Request; -use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\Log; use Illuminate\Validation\ValidationException; class GalleryImageController extends Controller diff --git a/app/Uploads/Controllers/ImageGalleryApiController.php b/app/Uploads/Controllers/ImageGalleryApiController.php index cec47feb0..6d4657a7a 100644 --- a/app/Uploads/Controllers/ImageGalleryApiController.php +++ b/app/Uploads/Controllers/ImageGalleryApiController.php @@ -2,7 +2,6 @@ namespace BookStack\Uploads\Controllers; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Http\ApiController; use BookStack\Uploads\Image; diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php index 160a02fa1..1e58816a4 100644 --- a/app/Uploads/ImageRepo.php +++ b/app/Uploads/ImageRepo.php @@ -2,7 +2,6 @@ namespace BookStack\Uploads; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\PageQueries; use BookStack\Exceptions\ImageUploadException; use BookStack\Permissions\PermissionApplicator; diff --git a/app/Uploads/ImageService.php b/app/Uploads/ImageService.php index ee2cb8a35..8d8da61ec 100644 --- a/app/Uploads/ImageService.php +++ b/app/Uploads/ImageService.php @@ -2,9 +2,6 @@ namespace BookStack\Uploads; -use BookStack\Entities\Models\Book; -use BookStack\Entities\Models\Bookshelf; -use BookStack\Entities\Models\Page; use BookStack\Entities\Queries\EntityQueries; use BookStack\Exceptions\ImageUploadException; use Exception;