Skip to content
Snippets Groups Projects
Commit 3267da24 authored by Rich Lott / Artful Robot's avatar Rich Lott / Artful Robot
Browse files

Clean up better when uninstalling inlay. Fix #13

parent a2d4e8f7
Branches
Tags
No related merge requests found
......@@ -23,13 +23,13 @@ class CRM_Inlay_Upgrader extends CRM_Extension_Upgrader_Base {
if (!$optionGroupID) {
$optionGroupID = \Civi\Api4\OptionGroup::create(FALSE)
->setCheckPermissions(FALSE)
->addValue('name', 'inlay_cors_origins')
->addValue('title', ts('Inlay CORS origins'))
->addValue('description', 'List of origins that are valid CORS origins for Inlays (from the Inlay extension)')
->addValue('data_type', 'String')
->addValue('is_active', TRUE)
->execute()->first()['id'];
->setCheckPermissions(FALSE)
->addValue('name', 'inlay_cors_origins')
->addValue('title', ts('Inlay CORS origins'))
->addValue('description', 'List of origins that are valid CORS origins for Inlays (from the Inlay extension)')
->addValue('data_type', 'String')
->addValue('is_active', TRUE)
->execute()->first()['id'];
}
}
......@@ -57,6 +57,21 @@ class CRM_Inlay_Upgrader extends CRM_Extension_Upgrader_Base {
*/
public function uninstall() {
$this->executeSqlFile('sql/dropAssetTable.sql');
$filenameStub = Civi::paths()->getPath("[civicrm.files]/inlay-");
$foundFiles = glob($filenameStub . '*.js');
foreach ($foundFiles as $file) {
\Civi::log()->warning("Uninstalling Inlay: deleting bundle: $file");
unlink($file);
}
$assetDir = Civi::paths()->getPath("[civicrm.files]/inlay");
if (is_dir($assetDir)) {
foreach (glob("$assetDir/*") as $file) {
\Civi::log()->warning("Uninstalling Inlay: deleting asset: $file");
unlink($file);
}
\Civi::log()->warning("Uninstalling Inlay: deleting asset dir: $assetDir");
rmdir($assetDir);
}
}
/**
......
DROP TABLE IF EXISTS inlay_asset;
DROP TABLE IF EXISTS civicrm_inlay_asset;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment