forked from FriendsOfREDAXO/demo_fullpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
36 lines (32 loc) · 1.05 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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;
}