Cleanup export files after some time

[MAILPOET-1894]
This commit is contained in:
Pavel Dohnal
2019-04-01 15:00:50 +02:00
committed by M. Shull
parent 9500c1b5d5
commit 08a3a66f4c
7 changed files with 75 additions and 4 deletions

View File

@@ -45,11 +45,19 @@ class Export {
$this->subscriber_fields,
$this->subscriber_custom_fields
);
$this->export_path = Env::$temp_path;
$this->export_path = self::getExportPath();
$this->export_file = $this->getExportFile($this->export_format_option);
$this->export_file_URL = $this->getExportFileURL($this->export_file);
}
static function getFilePrefix() {
return 'MailPoet_export_';
}
static function getExportPath() {
return Env::$temp_path;
}
function process() {
$this->default_subscribers_getter->reset();
try {
@@ -183,7 +191,7 @@ class Export {
function getExportFile($format) {
return sprintf(
$this->export_path . '/MailPoet_export_%s.%s',
$this->export_path . '/' . self::getFilePrefix() . '%s.%s',
Security::generateRandomString(15),
$format
);