| Current Path : /var/www/html/Joomla/administrator/components/com_dbreplacer/ |
| Current File : /var/www/html/Joomla/administrator/components/com_dbreplacer/script.install.php |
<?php
/**
* @package DB Replacer
* @version 7.5.1
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://regularlabs.com
* @copyright Copyright © 2023 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Filesystem\File as JFile;
use Joomla\CMS\Filesystem\Folder as JFolder;
class Com_DBReplacerInstallerScript
{
public function postflight($install_type, $adapter)
{
if ( ! in_array($install_type, ['install', 'update']))
{
return true;
}
self::deleteOldFiles();
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 deleteOldFiles()
{
self::delete(
[
JPATH_SITE . '/components/com_dbreplacer',
]
);
}
}