first commit
This commit is contained in:
52
administrator/modules/mod_cachecleaner/script.install.php
Normal file
52
administrator/modules/mod_cachecleaner/script.install.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Cache Cleaner
|
||||
* @version 8.2.2
|
||||
*
|
||||
* @author Peter van Westen <info@regularlabs.com>
|
||||
* @link http://regularlabs.com
|
||||
* @copyright Copyright © 2022 Regular Labs All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class Mod_CacheCleanerInstallerScript
|
||||
{
|
||||
public function postflight($install_type, $adapter)
|
||||
{
|
||||
if ( ! in_array($install_type, ['install', 'update']))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
self::deleteJoomla3Files();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function delete($files = [])
|
||||
{
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (is_dir($file))
|
||||
{
|
||||
JFolder::delete($file);
|
||||
}
|
||||
|
||||
if (is_file($file))
|
||||
{
|
||||
JFile::delete($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function deleteJoomla3Files()
|
||||
{
|
||||
self::delete(
|
||||
[
|
||||
JPATH_ADMINISTRATOR . '/modules/mod_cachecleaner/helper.php',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user