Skip to content

Commit

Permalink
Merge pull request #139 from wirecard/wdpd-190-clear-cache-on-module-…
Browse files Browse the repository at this point in the history
…deactivation

WDPD-190 Clear cache on module deactivation event
  • Loading branch information
tomazpu authored Jun 25, 2019
2 parents d1ccf59 + 8ee287f commit 45a29d9
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Core/OxidEeEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,7 @@ public static function onActivate()

self::addPaymentMethods();

$sTmpDir = getShopBasePath() . "/tmp/";
$sSmartyDir = $sTmpDir . "smarty/";

foreach (glob($sTmpDir . "*.txt") as $sFileName) {
@unlink($sFileName);
}
foreach (glob($sSmartyDir . "*.php") as $sFileName) {
@unlink($sFileName);
}
self::_clearFileCache();
}

/**
Expand All @@ -361,6 +353,25 @@ public static function onDeactivate()
{
self::$_oDb = DatabaseProvider::getDb();
self::_disablePaymentMethods();
self::_clearFileCache();
}

/**
* Clears file cache
*
* @since 1.2.0
*/
private static function _clearFileCache()
{
$sTmpDir = getShopBasePath() . "/tmp/";
$sSmartyDir = $sTmpDir . "smarty/";

foreach (glob($sTmpDir . "*.txt") as $sFileName) {
@unlink($sFileName);
}
foreach (glob($sSmartyDir . "*.php") as $sFileName) {
@unlink($sFileName);
}
}

/**
Expand Down

0 comments on commit 45a29d9

Please sign in to comment.