diff --git a/app/Bookshelf.php b/app/Bookshelf.php index ce2acbf0c..9468575c3 100644 --- a/app/Bookshelf.php +++ b/app/Bookshelf.php @@ -1,6 +1,5 @@ <?php namespace BookStack; - class Bookshelf extends Entity { protected $table = 'bookshelves'; diff --git a/app/Console/Commands/CleanupImages.php b/app/Console/Commands/CleanupImages.php index e05508d5e..8e1539702 100644 --- a/app/Console/Commands/CleanupImages.php +++ b/app/Console/Commands/CleanupImages.php @@ -72,7 +72,9 @@ class CleanupImages extends Command protected function showDeletedImages($paths) { - if ($this->getOutput()->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) return; + if ($this->getOutput()->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) { + return; + } if (count($paths) > 0) { $this->line('Images to delete:'); } diff --git a/app/Http/Controllers/BookshelfController.php b/app/Http/Controllers/BookshelfController.php index d1752d180..8c7f7819e 100644 --- a/app/Http/Controllers/BookshelfController.php +++ b/app/Http/Controllers/BookshelfController.php @@ -240,5 +240,4 @@ class BookshelfController extends Controller session()->flash('success', trans('entities.shelves_copy_permission_success', ['count' => $updateCount])); return redirect($bookshelf->getUrl()); } - } diff --git a/app/Image.php b/app/Image.php index 412beea90..acc82df90 100644 --- a/app/Image.php +++ b/app/Image.php @@ -19,5 +19,4 @@ class Image extends Ownable { return Images::getThumbnail($this, $width, $height, $keepRatio); } - } diff --git a/app/Repos/EntityRepo.php b/app/Repos/EntityRepo.php index 11f89fc34..1167ea7da 100644 --- a/app/Repos/EntityRepo.php +++ b/app/Repos/EntityRepo.php @@ -1297,7 +1297,9 @@ class EntityRepo $updatedBookCount = 0; foreach ($shelfBooks as $book) { - if (!userCan('restrictions-manage', $book)) continue; + if (!userCan('restrictions-manage', $book)) { + continue; + } $book->permissions()->delete(); $book->restricted = $bookshelf->restricted; $book->permissions()->createMany($shelfPermissions); diff --git a/app/Services/ImageService.php b/app/Services/ImageService.php index 73a677ac2..7b73c457c 100644 --- a/app/Services/ImageService.php +++ b/app/Services/ImageService.php @@ -316,25 +316,25 @@ class ImageService extends UploadService $deletedPaths = []; $this->image->newQuery()->whereIn('type', $types) - ->chunk(1000, function($images) use ($types, $checkRevisions, &$deletedPaths, $dryRun) { - foreach ($images as $image) { - $searchQuery = '%' . basename($image->path) . '%'; - $inPage = DB::table('pages') + ->chunk(1000, function ($images) use ($types, $checkRevisions, &$deletedPaths, $dryRun) { + foreach ($images as $image) { + $searchQuery = '%' . basename($image->path) . '%'; + $inPage = DB::table('pages') ->where('html', 'like', $searchQuery)->count() > 0; - $inRevision = false; - if ($checkRevisions) { - $inRevision = DB::table('page_revisions') + $inRevision = false; + if ($checkRevisions) { + $inRevision = DB::table('page_revisions') ->where('html', 'like', $searchQuery)->count() > 0; - } + } - if (!$inPage && !$inRevision) { - $deletedPaths[] = $image->path; - if (!$dryRun) { - $this->destroy($image); - } - } - } - }); + if (!$inPage && !$inRevision) { + $deletedPaths[] = $image->path; + if (!$dryRun) { + $this->destroy($image); + } + } + } + }); return $deletedPaths; } diff --git a/app/Services/LdapService.php b/app/Services/LdapService.php index 11223433b..16cee9f7d 100644 --- a/app/Services/LdapService.php +++ b/app/Services/LdapService.php @@ -330,14 +330,14 @@ class LdapService $groupNames[$i] = str_replace(' ', '-', trim(strtolower($groupName))); } - $roles = Role::query()->where(function(Builder $query) use ($groupNames) { + $roles = Role::query()->where(function (Builder $query) use ($groupNames) { $query->whereIn('name', $groupNames); foreach ($groupNames as $groupName) { $query->orWhere('external_auth_id', 'LIKE', '%' . $groupName . '%'); } })->get(); - $matchedRoles = $roles->filter(function(Role $role) use ($groupNames) { + $matchedRoles = $roles->filter(function (Role $role) use ($groupNames) { return $this->roleMatchesGroupNames($role, $groupNames); }); @@ -366,5 +366,4 @@ class LdapService $roleName = str_replace(' ', '-', trim(strtolower($role->display_name))); return in_array($roleName, $groupNames); } - } diff --git a/app/Services/PermissionService.php b/app/Services/PermissionService.php index dade68290..045824517 100644 --- a/app/Services/PermissionService.php +++ b/app/Services/PermissionService.php @@ -48,10 +48,15 @@ class PermissionService * @param Page $page */ public function __construct( - JointPermission $jointPermission, EntityPermission $entityPermission, Role $role, Connection $db, - Bookshelf $bookshelf, Book $book, Chapter $chapter, Page $page - ) - { + JointPermission $jointPermission, + EntityPermission $entityPermission, + Role $role, + Connection $db, + Bookshelf $bookshelf, + Book $book, + Chapter $chapter, + Page $page + ) { $this->db = $db; $this->jointPermission = $jointPermission; $this->entityPermission = $entityPermission; @@ -169,8 +174,8 @@ class PermissionService // Chunk through all bookshelves $this->bookshelf->newQuery()->select(['id', 'restricted', 'created_by']) ->chunk(50, function ($shelves) use ($roles) { - $this->buildJointPermissionsForShelves($shelves, $roles); - }); + $this->buildJointPermissionsForShelves($shelves, $roles); + }); } /**