-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ORGU: 42725, include a setup objective process to remove assigned met…
…a data sets from OrgUnit types if the meta data sets are already deleted but are still assigned to OrgUnit types. https://mantis.ilias.de/view.php?id=42725 Please note that you have to run 'php cli/setup.php achieve orgunit.removeDeletedMDSetsFromOrgUnitTypes'.
- Loading branch information
1 parent
da6a478
commit b5c71dd
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
components/ILIAS/OrgUnit/classes/Setup/ilOrgUnitRemoveDeletedMDSetsObjective.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
*********************************************************************/ | ||
|
||
declare(strict_types=1); | ||
|
||
use ILIAS\Setup\Environment; | ||
use ILIAS\Setup\NullConfig; | ||
|
||
class ilOrgUnitRemoveDeletedMDSetsObjective extends ilSetupObjective | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(new NullConfig()); | ||
} | ||
|
||
public function getHash(): string | ||
{ | ||
return hash('sha256', self::class); | ||
} | ||
|
||
public function getLabel(): string | ||
{ | ||
return 'Deleted meta data set assignments are removed for OrgUnit types'; | ||
} | ||
|
||
public function isNotable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getPreconditions(Environment $environment): array | ||
{ | ||
return [ | ||
new ilDatabaseInitializedObjective() | ||
]; | ||
} | ||
|
||
public function achieve(Environment $environment): Environment | ||
{ | ||
$db = $environment->getResource(Environment::RESOURCE_DATABASE); | ||
$query = 'DELETE FROM orgu_types_adv_md_rec' . PHP_EOL | ||
. 'WHERE rec_id NOT IN (' . PHP_EOL | ||
. 'SELECT record_id FROM adv_md_record' . PHP_EOL | ||
. ')'; | ||
$db->manipulate($query); | ||
return $environment; | ||
} | ||
|
||
public function isApplicable(Environment $environment): bool | ||
{ | ||
return true; | ||
} | ||
} |