]> BookStack Code Mirror - bookstack/commitdiff
Fixed formatting via phpcbf
authorDan Brown <redacted>
Fri, 21 Sep 2018 17:48:47 +0000 (18:48 +0100)
committerDan Brown <redacted>
Fri, 21 Sep 2018 17:48:47 +0000 (18:48 +0100)
app/Bookshelf.php
app/Console/Commands/CleanupImages.php
app/Http/Controllers/BookshelfController.php
app/Image.php
app/Repos/EntityRepo.php
app/Services/ImageService.php
app/Services/LdapService.php
app/Services/PermissionService.php

index ce2acbf0cb5291bc3962dbd985167b09341cce9e..9468575c3b9473e557f46ba0e278ba5d61b1acdb 100644 (file)
@@ -1,6 +1,5 @@
 <?php namespace BookStack;
 
-
 class Bookshelf extends Entity
 {
     protected $table = 'bookshelves';
index e05508d5e31803626fe4aa148c674cd4676ebc8e..8e1539702bd23e29b67b63c9bbd4ca01a2c38287 100644 (file)
@@ -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:');
         }
index d1752d180690567241c9729fd536b83e3cf3b0f0..8c7f7819e42904d21408e8965b3f6c03599dd07c 100644 (file)
@@ -240,5 +240,4 @@ class BookshelfController extends Controller
         session()->flash('success', trans('entities.shelves_copy_permission_success', ['count' => $updateCount]));
         return redirect($bookshelf->getUrl());
     }
-
 }
index 412beea9071aa4d5e314909990e46181c7049f48..acc82df90a1ec7fcb572dcf3c636499c9ba5b94e 100644 (file)
@@ -19,5 +19,4 @@ class Image extends Ownable
     {
         return Images::getThumbnail($this, $width, $height, $keepRatio);
     }
-
 }
index 11f89fc34a4ac015dbf14569d2048c0dbc8dc6c9..1167ea7daa849c5b34ee8b5bd61da6b8eb722c2d 100644 (file)
@@ -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);
index 73a677ac23ecf144634b3447aff95c83b45c1fd8..7b73c457c08ec76e5d490e1971b7bb1e230b8189 100644 (file)
@@ -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;
     }
 
index 11223433bd113041a8edd3138d92dbd6445ef867..16cee9f7dea1c08e7a5c258a7a2a6812143bc2b0 100644 (file)
@@ -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);
     }
-
 }
index dade68290569d4ad5548cb7607dcaad73d5ff1c0..045824517e3542b21501ad41d465fcb0800c91a3 100644 (file)
@@ -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);
+            });
     }
 
     /**