Skip to content

Commit

Permalink
Update uninstall.php
Browse files Browse the repository at this point in the history
  • Loading branch information
schuer authored Apr 23, 2018
1 parent cd2530d commit 42d29a8
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions uninstall.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/** @var rex_addon $this */

// update config
// remove additional config from base config
$config = array_diff_recursive(
rex_file::getConfig($this->getPath('package.yml')),
rex_file::getConfig($this->getPath('package.setup.yml'))
);

rex_file::putConfig($this->getPath('package.yml'), $config);


// Computes the difference of two arrays recursively
// https://gist.github.com/t3chnik/6b3b14d3859d810c02f4
function array_diff_recursive($aArray1, $aArray2)
{
$aReturn = array();
foreach ($aArray1 as $mKey => $mValue) {
if (array_key_exists($mKey, $aArray2)) {
if (is_array($mValue)) {
$aRecursiveDiff = array_diff_recursive($mValue, $aArray2[$mKey]);
if (count($aRecursiveDiff)) {
$aReturn[$mKey] = $aRecursiveDiff;
}
} else {
if ($mValue != $aArray2[$mKey]) {
$aReturn[$mKey] = $mValue;
}
}
} else {
$aReturn[$mKey] = $mValue;
}
}
return $aReturn;
}

0 comments on commit 42d29a8

Please sign in to comment.