...
The module is disabled by default when installed.
Settings:
Field | Options | Comment |
---|---|---|
Enabled | Yes/No | |
Period of storing files in days | ||
Cleaning files cron schedule expression | Default: 0 0 15 * * | |
Cleaning files patterns | Default: report/* | The base directory is var/ Currently stored files amount: /var/www/projects/creativeshop/var/report/*: 34 |
Backend
Note |
---|
Documentation is in progress |
Cron
vendor/creativestyle/magesuite-report-file-cleaner/Cron/CleanFiles.php:33
Code Block |
---|
class CleanFiles
{
public function execute()
{
.....
$this->logFilesCleaner->cleanFiles();
return true;
}
} |
Command
system:clean_report_files
vendor/creativestyle/magesuite-report-file-cleaner/Console/Command/CleanFiles.php:38
Code Block |
---|
class CleanFiles extends \Symfony\Component\Console\Command\Command
{
protected function execute(
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
) {
.....
$logFilesCleaner = $this->logFilesCleanerFactory->create();
$logFilesCleaner->cleanFiles();
return true;
}
} |
Service for removing files
Code Block | ||
---|---|---|
| ||
class LogFilesCleaner
{
public function cleanFiles()
{
$period = $this->configuration->getStoringFilesPeriodInDays();
$searchPatterns = $this->configuration->getSearchPatterns();
foreach ($searchPatterns as $searchPattern) {
$this->cleanFilesForPattern($searchPattern, $period);
}
}
public function cleanFilesForPattern(string $searchPattern, ?int $period)
{
$pattern = sprintf('%s/%s', $this->directory->getDirectoryAbsolutePath(\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR), ltrim($searchPattern, '/'));
$filesPaths = $this->directory->getItemsForPattern($pattern);
$this->removeFiles($filesPaths, $period);
}
} |
Frontend
There is no frontend functionality in this module.