IMP_Compose_LinkedAttachment::keepDate PHP Method

keepDate() public static method

Return UNIX timestamp of linked attachment expiration time.
public static keepDate ( boolean $past = true ) : integer | null
$past boolean If true, determine maximim creation time for expiration. If false, determine future expiration time.
return integer | null UNIX timestamp, or null if attachments are not pruned.
    public static function keepDate($past = true)
    {
        return ($damk = $GLOBALS['prefs']->getValue('delete_attachments_monthly_keep')) ? mktime(0, 0, 0, date('n') + ($past ? $damk * -1 : $damk + 1), 1, date('Y')) : null;
    }

Usage Example

Beispiel #1
0
 /**
  */
 public function gc()
 {
     if (!($keep = IMP_Compose_LinkedAttachment::keepDate(true))) {
         return;
     }
     $changed = false;
     $this->_getMetadata();
     foreach ($this->_md as $key => $val) {
         $md = new IMP_Compose_Attachment_Linked_Metadata();
         $md->data = $val;
         if ($md->time < $keep) {
             try {
                 $this->_vfs->deleteFile($this->_vfspath, $key);
             } catch (Exception $e) {
             }
             unset($this->_md[$key]);
             $changed = true;
         }
     }
     if ($changed) {
         $this->_saveMetadata();
     }
 }
All Usage Examples Of IMP_Compose_LinkedAttachment::keepDate