-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
64 lines (58 loc) · 1.61 KB
/
Copy pathscript.php
File metadata and controls
64 lines (58 loc) · 1.61 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @package Cybersalt.CsDiskUsage
* @subpackage com_csdiskusage
*
* @copyright Copyright (C) 2026 Cybersalt Consulting Ltd. All rights reserved.
* @license GNU General Public License version 3 or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
class Com_CsdiskusageInstallerScript
{
/**
* Clear the autoload cache to ensure namespace is registered correctly
*
* @return void
*/
protected function clearAutoloadCache(): void
{
$cacheFile = JPATH_ADMINISTRATOR . '/cache/autoload_psr4.php';
if (file_exists($cacheFile)) {
try {
@unlink($cacheFile);
} catch (\Exception $e) {
Factory::getApplication()->enqueueMessage(
'Please manually delete administrator/cache/autoload_psr4.php',
'warning'
);
}
}
}
/**
* Method to run after installation
*
* @param string $type Type of change (install, update, discover_install)
* @param InstallerAdapter $parent The parent object
*
* @return boolean
*/
public function postflight(string $type, InstallerAdapter $parent): bool
{
$this->clearAutoloadCache();
return true;
}
/**
* Method to run on uninstallation
*
* @param InstallerAdapter $parent The parent object
*
* @return boolean
*/
public function uninstall(InstallerAdapter $parent): bool
{
$this->clearAutoloadCache();
return true;
}
}