Announcement

Collapse
No announcement yet.

upload folder (unused files and duplicates)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • upload folder (unused files and duplicates)

    When a CRM user creates a post, stream, or a lead / account, s/he can upload pictures for the record, but after uploading, the CRM user may choose not to 'save' or 'update' the Record in question. (by clicking cancel or navigate to somewhere else)

    In this case, the uploaded files are already in the ESPOCRM/data/upload directory, but no record is going to use them.

    Are they automatically cleaned up by Cron job? or they just stay there cluttering the entire directory?


    Thank you in advance.

  • #2
    Hello

    For now these files aren't deleted.

    In file application/Espo/Jobs/Cleanup.php change $collection definition in the method cleanupAttachments

    Code:
    $collection = $this->getEntityManager()->getRepository('Attachment')->where(array(
                'OR' => array(
                    array(
                        'role' => ['Export File']
                    ),
                    array(
                        'role' => 'Attachment',
                        'relatedId' => null,
                        'parentId' => null                    
                    )
                ),
                'createdAt<' => $dateBefore
            ))->limit(0, 100)->find();

    Comment


    • #3
      Thank you Tanya, I've made the modifications accordingly.

      Comment


      • #4
        its overwritten with each Espo Upgrade. Currently I'll just change it every time after upgrade.

        Comment


        • #5
          You can develop own job, which will delete attachments without parent

          Comment


          • #6
            thank you Tanya,

            any entry-point on how to develop 'own job'?

            Comment


            • #7
              There is a topic https://github.com/espocrm/documenta...heduled-job.md

              Comment

              Working...
              X