ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilOrgUnitRemoveDeletedUsersObjective.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
25 {
26  public function __construct()
27  {
29  }
30 
31  public function getHash(): string
32  {
33  return hash('sha256', self::class);
34  }
35 
36  public function getLabel(): string
37  {
38  return 'OrgUnit assignments are removed for deleted users';
39  }
40 
41  public function isNotable(): bool
42  {
43  return true;
44  }
45 
46  public function getPreconditions(Environment $environment): array
47  {
48  return [
50  ];
51  }
52 
53  public function achieve(Environment $environment): Environment
54  {
55  $db = $environment->getResource(Environment::RESOURCE_DATABASE);
56  $query = 'DELETE FROM il_orgu_ua' . PHP_EOL
57  . 'WHERE user_id NOT IN (' . PHP_EOL
58  . 'SELECT usr_id FROM usr_data' . PHP_EOL
59  . ')';
60  $db->manipulate($query);
61  return $environment;
62  }
63 
64  public function isApplicable(Environment $environment): bool
65  {
66  return true;
67  }
68 }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
__construct(Container $dic, ilPlugin $plugin)
A configuration with no content.
Definition: NullConfig.php:26