diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 0a324ac17..f34a49a3f 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1053,9 +1053,9 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ), - 'inline_image_garbage_collector_interval' => array( + 'draft_attachments_lifetime' => array( 'type' => 'integer', - 'description' => 'Frequency (in seconds) at which the inline image garbage collector will run.', + 'description' => 'Lifetime (in seconds) of drafts\' attachments and inline images: after this duration, the garbage collector will delete them.', 'default' => 3600, 'value' => '', 'source_of_value' => '', diff --git a/core/inlineimage.class.inc.php b/core/inlineimage.class.inc.php index 396ce4f29..690616ca6 100644 --- a/core/inlineimage.class.inc.php +++ b/core/inlineimage.class.inc.php @@ -497,10 +497,10 @@ EOF */ class InlineImageGC implements iBackgroundProcess { - public function GetPeriodicity() - { - return MetaModel::GetConfig()->Get('inline_image_garbage_collector_interval'); // run every definied time - } + public function GetPeriodicity() + { + return 3600; // Runs every hour + } public function Process($iTimeLimit) { diff --git a/datamodels/2.x/itop-attachments/ajax.attachment.php b/datamodels/2.x/itop-attachments/ajax.attachment.php index 754cb6081..037749754 100755 --- a/datamodels/2.x/itop-attachments/ajax.attachment.php +++ b/datamodels/2.x/itop-attachments/ajax.attachment.php @@ -67,7 +67,7 @@ try { $oDoc = utils::ReadPostedDocument('file'); $oAttachment = MetaModel::NewObject('Attachment'); - $oAttachment->Set('expire', time() + 3600); // one hour... + $oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sObjClass); $oAttachment->SetDefaultOrgId(); diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php index 0af740729..51064b543 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php @@ -1455,7 +1455,7 @@ class ObjectController extends AbstractController { $oDocument = utils::ReadPostedDocument($sFieldName); $oAttachment = MetaModel::NewObject('Attachment'); - $oAttachment->Set('expire', time() + 3600); // one hour... + $oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); // one hour... $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sObjectClass); $oAttachment->SetDefaultOrgId(); diff --git a/pages/ajax.render.php b/pages/ajax.render.php index f8eb8f038..773f722ed 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -2386,7 +2386,7 @@ EOF $aDimensions = null; $oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions); $oAttachment = MetaModel::NewObject('InlineImage'); - $oAttachment->Set('expire', time() + 3600); // one hour... + $oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sObjClass); $oAttachment->SetDefaultOrgId(); @@ -2427,7 +2427,7 @@ EOF $aDimensions = null; $oDoc = InlineImage::ResizeImageToFit($oDoc, $aDimensions); $oAttachment = MetaModel::NewObject('InlineImage'); - $oAttachment->Set('expire', time() + 3600); // one hour... + $oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sObjClass); $oAttachment->SetDefaultOrgId();