Skip to content

Laravel 11.x Shift #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.dusk.testing
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DB_DATABASE=jitterbug_testing
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
CACHE_STORE=file
SESSION_DRIVER=file
SESSION_SECURE_COOKIE=false
QUEUE_DRIVER=sync
Expand Down
15 changes: 13 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DB_DATABASE=jitterbug
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
CACHE_STORE=file
SESSION_DRIVER=file
SESSION_SECURE_COOKIE=false
QUEUE_DRIVER=sync
Expand All @@ -25,6 +25,7 @@ SOLR_PATH=/

#LOG_CHANNEL_PATH=/logs/laravel.log
#LOG_CHANNEL='single'
LOG_STACK=single

#STORAGE_PATH=/opt/laravel/jitterbug

Expand All @@ -42,4 +43,14 @@ LDAP_LOGGING=true

ADMIN_USER_PASSWORD='secret'
LDAP_AUTO_CONNECT=false
APP_AUTH=ldap
APP_AUTH=ldap
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12

SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
64 changes: 33 additions & 31 deletions app/Console/Commands/AutoIncrementCollectionIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$bar = $this->output->createProgressBar(100);
$collections = Collection::withTrashed()->get();
Expand All @@ -56,40 +56,42 @@ public function handle()
$bar->advance();
$brokenIds = [];
DB::table('new_call_number_sequences')
->whereNotNull('collection_id')
->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) {
foreach ($results as $result) {
if (isset($collectionIdMapping[$result->collection_id])) {
$newCollectionId = $collectionIdMapping[$result->collection_id];
} else {
$brokenIds['sequence_id'] = $result->id;
continue;
}
->whereNotNull('collection_id')
->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) {
foreach ($results as $result) {
if (isset($collectionIdMapping[$result->collection_id])) {
$newCollectionId = $collectionIdMapping[$result->collection_id];
} else {
$brokenIds['sequence_id'] = $result->id;

DB::table('new_call_number_sequences')
->where('id', $result->id)
->update(['collection_id' => $newCollectionId]);
}
$bar->advance();
});
continue;
}

DB::table('audio_visual_items')
->whereNotNull('collection_id')
->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) {
foreach ($results as $result) {
if (isset($collectionIdMapping[$result->collection_id])) {
$newCollectionId = $collectionIdMapping[$result->collection_id];
} else {
$brokenIds['av_item_id'] = $result->id;
continue;
DB::table('new_call_number_sequences')
->where('id', $result->id)
->update(['collection_id' => $newCollectionId]);
}
$bar->advance();
});

DB::table('audio_visual_items')
->whereNotNull('collection_id')
->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) {
foreach ($results as $result) {
if (isset($collectionIdMapping[$result->collection_id])) {
$newCollectionId = $collectionIdMapping[$result->collection_id];
} else {
$brokenIds['av_item_id'] = $result->id;

continue;
}

DB::table('audio_visual_items')
->where('id', $result->id)
->update(['collection_id' => $newCollectionId]);
}
$bar->advance();
});
DB::table('audio_visual_items')
->where('id', $result->id)
->update(['collection_id' => $newCollectionId]);
}
$bar->advance();
});

$headers = ['table => id'];
$this->table($headers, $brokenIds);
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/BackfillImportActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public function __construct()
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$importTransactions = ImportTransaction::all();
$bar = $this->output->createProgressBar($importTransactions->count());
foreach ($importTransactions as $importTransaction) {
$bar->advance();
// grab revisions related to the import
$relatedRevisions = DB::table('revisions')
->where('transaction_id', $importTransaction->transaction_id)->get();
->where('transaction_id', $importTransaction->transaction_id)->get();
// determine unique field values
$fields = $relatedRevisions->pluck('field')->unique();
// if any of the fields are created_at, then it's a create, so skip
Expand Down
16 changes: 8 additions & 8 deletions app/Console/Commands/BackfillNewCollectionTypesSequences.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public function __construct()
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$collectionTypeId = $this->argument('collection_type_id');
$prefixes = DB::table('prefixes')->select('label')
->where('collection_type_id', '=', $collectionTypeId)
->distinct()
->get();
->where('collection_type_id', '=', $collectionTypeId)
->distinct()
->get();

$collections = DB::table('collections')->where('collection_type_id', '=', $collectionTypeId)->get();
$bar = $this->output->createProgressBar($collections->count());
Expand All @@ -52,12 +52,12 @@ public function handle()
$bar->advance();
foreach ($prefixes as $prefix) {
$sequenceExists = DB::table('new_call_number_sequences')
->where('prefix', '=', $prefix->label)
->where('collection_id', '=', $collection->id)
->exists();
->where('prefix', '=', $prefix->label)
->where('collection_id', '=', $collection->id)
->exists();

if (! $sequenceExists) {
$sequence = new NewCallNumberSequence();
$sequence = new NewCallNumberSequence;
$sequence->prefix = $prefix->label;
$sequence->collection_id = $collection->id;
$sequence->archival_identifier = $collection->archival_identifier;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Inspire.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Inspire extends Command
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
Expand Down
14 changes: 7 additions & 7 deletions app/Console/Commands/SetCollectionToLegacyCallNumberSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ public function __construct()
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$archivalIdentifier = $this->argument('archival_identifier');

// Find all new call number sequences that have been used and get their associated prefix
$usedSequencePrefixes = DB::table('new_call_number_sequences')
->where('archival_identifier', $archivalIdentifier)
->where('next', '>', 1)
->pluck('prefix');
->where('archival_identifier', $archivalIdentifier)
->where('next', '>', 1)
->pluck('prefix');

// Only delete the new call number sequences that have never been used
DB::table('new_call_number_sequences')
->where('archival_identifier', $archivalIdentifier)
->where('next', '=', 1)
->delete();
->where('archival_identifier', $archivalIdentifier)
->where('next', '=', 1)
->delete();

if ($usedSequencePrefixes->count() > 0) {
$this->info('Done! The sequences with the following prefixes were not deleted because they have been used: '.$usedSequencePrefixes);
Expand Down
39 changes: 0 additions & 39 deletions app/Console/Kernel.php

This file was deleted.

1 change: 0 additions & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Handler extends ExceptionHandler
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
Expand Down
4 changes: 2 additions & 2 deletions app/Export/InstancesExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function exportableFields()
// record types. For example, if all the records are AudioItems, we
// don't want to return fields that are specific to film.
$types = DB::table('preservation_instances')
->select(DB::raw('TRIM(TRAILING "Instance" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
->select(DB::raw('TRIM(TRAILING "Instance" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
$fields = [];
// Fields at index 0 are intended to be rendered on the left in the
// export dialog, and those at index 1 on the right.
Expand Down
4 changes: 2 additions & 2 deletions app/Export/ItemsExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function exportableFields()
// record types. For example, if all the records are AudioItems, we
// don't want to return fields that are specific to film.
$types = DB::table('audio_visual_items')
->select(DB::raw('TRIM(TRAILING "Item" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
->select(DB::raw('TRIM(TRAILING "Item" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
$fields = [];
// Fields at index 0 are intended to be rendered on the left in the
// export dialog, and those at index 1 on the right.
Expand Down
4 changes: 2 additions & 2 deletions app/Export/TransfersExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function exportableFields()
// record types. For example, if all the records are AudioItems, we
// don't want to return fields that are specific to film.
$types = DB::table('transfers')
->select(DB::raw('TRIM(TRAILING "Transfer" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
->select(DB::raw('TRIM(TRAILING "Transfer" FROM subclass_type) AS type'))
->whereIn('id', $this->ids)->distinct()->get()->pluck('type');
$fields = [];
// Fields at index 0 are intended to be rendered on the left in the
// export dialog, and those at index 1 on the right.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function makeAdmin(Request $request)

return response()->json(['status' => 'success'], 200);
}
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'That user is inactive, so they cannot be made admin.');

return response()->json($bag, 422);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/CollectionTypesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that collection type is currently '.
'in use. Change the collection type of the related collections '.
'and/or prefixes before deleting.');
Expand Down
10 changes: 5 additions & 5 deletions app/Http/Controllers/Admin/CollectionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public function store(CollectionRequest $request)
// Since this is a new collection, create new sequences
// for all prefixes with the same collection type ID
$results = DB::table('prefixes')->select('label')
->where('collection_type_id', '=', $collection->collection_type_id)
->distinct()
->get();
->where('collection_type_id', '=', $collection->collection_type_id)
->distinct()
->get();
foreach ($results as $result) {
$prefix = $result->label;
$sequence = new NewCallNumberSequence;
Expand Down Expand Up @@ -97,7 +97,7 @@ public function update($id, CollectionRequest $request)
DB::transaction(function () use ($id, $collection, &$affectedItems) {
if ($collection->isDirty('archival_identifier')) {
NewCallNumberSequence::where('collection_id', $id)
->update(['archival_identifier' => $collection->archival_identifier]);
->update(['archival_identifier' => $collection->archival_identifier]);
}

$collection->save();
Expand Down Expand Up @@ -132,7 +132,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that collection is currently in use. '.
'Remove audio visual items from the collection before deleting.');
$response = $bag;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/DepartmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that department is currently in use. '.
'Change the department of the related preservation instances before '.
'deleting.');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/FormatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that format is currently in use. '.
'Change the format of the related audio visual items before '.
'deleting.');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/PlaybackMachinesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that playback machine is '.
'currently in use. Change the playback machine of the '.
'related transfers before deleting.');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/PmSpeedsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that PM speed is currently '.
'in use. Change the PM speed of the related preservation '.
'instances before deleting.');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/ProjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that project is currently in use. '.
'Change the project of the related preservation instances before '.
'deleting.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function destroy($id, Request $request)

return response()->json($response);
} else {
$bag = new MessageBag();
$bag = new MessageBag;
$bag->add('status', 'Looks like that reproduction machine is '.
'currently in use. Change the reproduction machine of the '.
'related preservation instances before deleting.');
Expand Down
Loading