Commit | Line | Data |
---|---|---|
4bcd4c62 TO |
1 | <?php |
2 | /** | |
3 | * @file | |
4 | * | |
5 | * Remove the civicrm.settings.php file. | |
6 | */ | |
7 | ||
8 | if (!defined('CIVI_SETUP')) { | |
9 | exit("Installation plugins must only be loaded by the installer.\n"); | |
10 | } | |
11 | ||
12 | \Civi\Setup::dispatcher() | |
13 | ->addListener('civi.setup.uninstallFiles', function (\Civi\Setup\Event\UninstallFilesEvent $e) { | |
14 | \Civi\Setup::log()->info(sprintf('[%s] Handle %s', basename(__FILE__), 'uninstallFiles')); | |
15 | ||
16 | $file = $e->getModel()->settingsPath; | |
17 | if (file_exists($file)) { | |
18 | if (!\Civi\Setup\FileUtil::isDeletable($file)) { | |
19 | throw new \Exception("Cannot remove \"$file\". Please check permissions on the file and directory."); | |
20 | } | |
21 | unlink($file); | |
22 | } | |
23 | }); |