2024.8.23
Loading...
Searching...
No Matches
class.action.clearFolders.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2024 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
10
/**
11
* Handles the action of clearing specific temporary folders within the application.
12
*
13
* This class is responsible for clearing out temporary files and directories that are not
14
* essential for immediate functionality but may accumulate over time and use disk space.
15
* It targets temporary directories used by various components like Composer, OpenSSL, and others.
16
*/
17
class
ActionClearFolders
18
{
19
/**
20
* Constructor for the ActionClearFolders class.
21
*
22
* Upon instantiation, it clears specified temporary folders in both the root and core temporary paths.
23
* It excludes certain files and folders from being deleted to prevent essential data loss.
24
*
25
* @param array $args Arguments that might be used for further extension of constructor functionality.
26
*/
27
public
function
__construct
($args)
28
{
29
global
$bearsamppRoot
,
$bearsamppCore
;
30
31
/**
32
* Clears specific temporary folders in the root temporary path.
33
*
34
* Util::clearFolder is used to clear the contents of the root temporary path, excluding
35
* certain essential items such as 'cachegrind', 'composer', 'openssl', 'mailpit', 'xlight', 'npm-cache',
36
* 'pip', 'yarn', and '.gitignore'. This ensures that important data and configurations are not lost.
37
*
38
* @param string $bearsamppRoot->getTmpPath() The root temporary path to be cleared.
39
* @param array $exclusions List of folders and files to be excluded from deletion.
40
*/
41
Util::clearFolder
(
$bearsamppRoot
->getTmpPath(), array(
'cachegrind'
,
'composer'
,
'openssl'
,
'mailhog'
,
'mailpit'
,
'xlight'
,
'npm-cache'
,
'pip'
,
'yarn'
,
'.gitignore'
));
42
43
// Clear logs
44
Util::clearFolder
(
$bearsamppRoot
->getLogsPath(), array(
'mailpit.err.log'
,
'mailpit.out.log'
,
'memcached.err.log'
,
'memcached.out.log'
,
'xlight.err.log'
,
'xlight.log'
,
'.gitignore'
) );
45
46
/**
47
* Clears the core temporary path.
48
*
49
* Util::clearFolder is used to clear the contents of the core temporary path, excluding
50
* the '.gitignore' file. This ensures that the core temporary path is cleaned without
51
* removing the '.gitignore' file which might be necessary for version control.
52
*
53
* @param string $bearsamppCore->getTmpPath() The core temporary path to be cleared.
54
* @param array $exclusions List of folders and files to be excluded from deletion.
55
*/
56
Util::clearFolder
(
$bearsamppCore
->getTmpPath(), array(
'.gitignore'
));
57
}
58
}
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
ActionClearFolders
Definition
class.action.clearFolders.php:18
ActionClearFolders\__construct
__construct($args)
Definition
class.action.clearFolders.php:27
Util\clearFolder
static clearFolder($path, $exclude=array())
Definition
class.util.php:241
Bearsampp-development
sandbox
core
classes
actions
class.action.clearFolders.php
Generated by
1.11.0