From 51c3ed0c7bcdb122c0709bbfc037b18008fb4d93 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 18 Sep 2024 10:52:33 +1200 Subject: [PATCH] ENH Don't use deprecated method --- src/Tasks/LDAPGroupSyncTask.php | 12 ++++++------ src/Tasks/LDAPMemberSyncOneTask.php | 8 ++++---- src/Tasks/LDAPMemberSyncTask.php | 12 ++++++------ src/Tasks/LDAPMigrateExistingMembersTask.php | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Tasks/LDAPGroupSyncTask.php b/src/Tasks/LDAPGroupSyncTask.php index f5cb1fb..ff4154c 100644 --- a/src/Tasks/LDAPGroupSyncTask.php +++ b/src/Tasks/LDAPGroupSyncTask.php @@ -85,7 +85,7 @@ public function run($request) $group = new Group(); $group->GUID = $data['objectguid']; - Deprecation::withNoReplacement(function () use ($data) { + Deprecation::withSuppressedNotice(function () use ($data) { $this->log(sprintf( 'Creating new Group (GUID: %s, sAMAccountName: %s)', $data['objectguid'], @@ -94,7 +94,7 @@ public function run($request) }); $created++; } else { - Deprecation::withNoReplacement(function () use ($group, $data) { + Deprecation::withSuppressedNotice(function () use ($group, $data) { $this->log(sprintf( 'Updating existing Group "%s" (ID: %s, GUID: %s, sAMAccountName: %s)', $group->getTitle(), @@ -109,7 +109,7 @@ public function run($request) try { $this->ldapService->updateGroupFromLDAP($group, $data); } catch (Exception $e) { - Deprecation::withNoReplacement(fn() => $this->log($e->getMessage())); + Deprecation::withSuppressedNotice(fn() => $this->log($e->getMessage())); continue; } } @@ -121,7 +121,7 @@ public function run($request) if (!isset($ldapGroups[$record['GUID']])) { $group = Group::get()->byId($record['ID']); - Deprecation::withNoReplacement(function () use ($group) { + Deprecation::withSuppressedNotice(function () use ($group) { $this->log(sprintf( 'Removing Group "%s" (GUID: %s) that no longer exists in LDAP.', $group->Title, @@ -136,7 +136,7 @@ public function run($request) } $group->delete(); } catch (Exception $e) { - Deprecation::withNoReplacement(fn() => $this->log($e->getMessage())); + Deprecation::withSuppressedNotice(fn() => $this->log($e->getMessage())); continue; } @@ -149,7 +149,7 @@ public function run($request) $end = time() - $start; - Deprecation::withNoReplacement(function () use ($created, $updated, $deleted, $end) { + Deprecation::withSuppressedNotice(function () use ($created, $updated, $deleted, $end) { $this->log(sprintf( 'Done. Created %s records. Updated %s records. Deleted %s records. Duration: %s seconds', $created, diff --git a/src/Tasks/LDAPMemberSyncOneTask.php b/src/Tasks/LDAPMemberSyncOneTask.php index a2c0072..5b1902b 100644 --- a/src/Tasks/LDAPMemberSyncOneTask.php +++ b/src/Tasks/LDAPMemberSyncOneTask.php @@ -68,7 +68,7 @@ public function run($request) // If member exists already, we're updating - otherwise we're creating if ($member->exists()) { - Deprecation::withNoReplacement(function () use ($user, $member) { + Deprecation::withSuppressedNotice(function () use ($user, $member) { $this->log(sprintf( 'Updating existing Member %s: "%s" (ID: %s, SAM Account Name: %s)', $user['objectguid'], @@ -86,16 +86,16 @@ public function run($request) )); } - Deprecation::withNoReplacement(function () use ($user) { + Deprecation::withSuppressedNotice(function () use ($user) { $this->log('User data returned from LDAP follows:'); $this->log(var_export($user)); }); try { $this->ldapService->updateMemberFromLDAP($member, $user); - Deprecation::withNoReplacement(fn() => $this->log('Done!')); + Deprecation::withSuppressedNotice(fn() => $this->log('Done!')); } catch (Exception $e) { - Deprecation::withNoReplacement(fn() => $this->log($e->getMessage())); + Deprecation::withSuppressedNotice(fn() => $this->log($e->getMessage())); } } diff --git a/src/Tasks/LDAPMemberSyncTask.php b/src/Tasks/LDAPMemberSyncTask.php index 7decfb3..1b2effd 100644 --- a/src/Tasks/LDAPMemberSyncTask.php +++ b/src/Tasks/LDAPMemberSyncTask.php @@ -83,7 +83,7 @@ public function run($request) // If member exists already, we're updating - otherwise we're creating if ($member->exists()) { $updated++; - Deprecation::withNoReplacement(function () use ($data, $member) { + Deprecation::withSuppressedNotice(function () use ($data, $member) { $this->log(sprintf( 'Updating existing Member %s: "%s" (ID: %s, SAM Account Name: %s)', $data['objectguid'], @@ -94,7 +94,7 @@ public function run($request) }); } else { $created++; - Deprecation::withNoReplacement(function () use ($data) { + Deprecation::withSuppressedNotice(function () use ($data) { $this->log(sprintf( 'Creating new Member %s: "%s" (SAM Account Name: %s)', $data['objectguid'], @@ -109,7 +109,7 @@ public function run($request) try { $this->ldapService->updateMemberFromLDAP($member, $data); } catch (Exception $e) { - Deprecation::withNoReplacement(fn() => $this->log($e->getMessage())); + Deprecation::withSuppressedNotice(fn() => $this->log($e->getMessage())); continue; } } @@ -121,7 +121,7 @@ public function run($request) $member = Member::get()->byId($record['ID']); if (!isset($users[$record['GUID']])) { - Deprecation::withNoReplacement(function () use ($member) { + Deprecation::withSuppressedNotice(function () use ($member) { $this->log(sprintf( 'Removing Member "%s" (GUID: %s) that no longer exists in LDAP.', $member->getName(), @@ -132,7 +132,7 @@ public function run($request) try { $member->delete(); } catch (Exception $e) { - Deprecation::withNoReplacement(fn() => $this->log($e->getMessage())); + Deprecation::withSuppressedNotice(fn() => $this->log($e->getMessage())); continue; } @@ -145,7 +145,7 @@ public function run($request) $end = time() - $start; - Deprecation::withNoReplacement(function () use ($created, $updated, $deleted, $end) { + Deprecation::withSuppressedNotice(function () use ($created, $updated, $deleted, $end) { $this->log(sprintf( 'Done. Created %s records. Updated %s records. Deleted %s records. Duration: %s seconds', $created, diff --git a/src/Tasks/LDAPMigrateExistingMembersTask.php b/src/Tasks/LDAPMigrateExistingMembersTask.php index 9ccf83f..205f45f 100644 --- a/src/Tasks/LDAPMigrateExistingMembersTask.php +++ b/src/Tasks/LDAPMigrateExistingMembersTask.php @@ -74,7 +74,7 @@ public function run($request) $count++; - Deprecation::withNoReplacement(function () use ($member) { + Deprecation::withSuppressedNotice(function () use ($member) { $this->log(sprintf( 'Migrated Member %s (ID: %s, Email: %s)', $member->getName(), @@ -86,7 +86,7 @@ public function run($request) $end = time() - $start; - Deprecation::withNoReplacement(function () use ($count, $end) { + Deprecation::withSuppressedNotice(function () use ($count, $end) { $this->log(sprintf('Done. Migrated %s Member records. Duration: %s seconds', $count, round($end ?? 0.0, 0))); }); }