Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The uploader in In-Portal has temp file concept, that says: the uploaded file is considered a temp file, when it has ".tmp" sub-extension regardless where file is placed (e.g. in "/system/tmp" folder or not). This allows to delete files, that were uploaded, but not used anywhere after that. This rule is then used to automatically delete abandoned uploaded files to preserve disk space.

As it turns it it doesn't work, when file is uploaded for a sub-item.

Solution

  1. change "kDBItem::setTempID" method to replace old item id (e.g. "0") with new item id (e.g. "-1") inside pending actions (via "kDBItem::getPendingActions" and "kDBItem::setPendingActions" methods)
  2. create on time migration event, that will:
    1. scan all unit configs to determine units/fields that use "kUploadFormatter"
    2. look up through each of found unit db tables and for each field using uploader to determine if uploaded file with ".tmp" extension is present in there
    3. prepare new safe filename (without ".tmp" extension) via "FileHelper::ensureUniqueFilename" method
    4. on disk rename problematic file using prepared filename
    5. if rename was successful update database record

Related Tasks

  • No labels