Skip to content

Commit

Permalink
Replace deprecated code uses
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jun 26, 2024
1 parent 446f45e commit 9a023e7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 744 deletions.
10 changes: 7 additions & 3 deletions src/EventSubscriber/EventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Acquia\DrupalEnvironmentDetector\AcquiaDrupalEnvironmentDetector;
use Drupal\Core\Cache\Cache;
use Drupal\Core\File\FileExists;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
Expand All @@ -19,6 +20,7 @@
use Drupal\default_content\Event\DefaultContentEvents;
use Drupal\default_content\Event\ImportEvent;
use Drupal\file\FileInterface;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down Expand Up @@ -187,7 +189,7 @@ protected static function updateSamlauthRoles() {
return;
}

$role_ids = array_keys(user_role_names(TRUE));
$role_ids = array_keys(Role::loadMultiple());
$role_ids = array_combine($role_ids, $role_ids);
unset($role_ids[RoleInterface::AUTHENTICATED_ID]);
asort($role_ids);
Expand Down Expand Up @@ -257,7 +259,7 @@ protected function getFile(string $file_uri): void {
'%source' => $local_file,
'%destination' => $file_uri,
]);
$this->fileSystem->copy($local_file, $file_uri, FileSystemInterface::EXISTS_REPLACE);
$this->fileSystem->copy($local_file, $file_uri, FileExists::Replace);
return;
}
catch (\Exception $e) {
Expand Down Expand Up @@ -292,7 +294,9 @@ protected function downloadFile(string $source, string $destination) {
'%source' => $source,
'%destination' => $destination,
]);
return system_retrieve_file($source, $destination, FALSE, FileSystemInterface::EXISTS_REPLACE);
$data = (string) \Drupal::httpClient()->get($source)->getBody();
return \Drupal::service('file_system')
->saveData($data, $destination, FileExists::Replace);
}

}
3 changes: 1 addition & 2 deletions stanford_profile.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Jumpstart Website Profile'
version: 11.3.8
type: profile
project: Stanford
core_version_requirement: ^9 || ^10
core_version_requirement: ^10 || ^11
install:
- 'address:address'
- 'admin_toolbar:admin_toolbar'
Expand All @@ -13,7 +13,6 @@ install:
- 'chosen:chosen'
- 'chosen:chosen_lib'
- 'components:components'
- 'config_filter:config_filter'
- 'config_pages:config_pages'
- 'config_pages_overrides:config_pages_overrides'
- 'config_readonly:config_readonly'
Expand Down
Loading

0 comments on commit 9a023e7

Please sign in to comment.