Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21360

eZFS2: binary images/files not deleted when object is removed

    Details

      Description

      After removing objects with images (ezimage) or files (ezbinaryfile) the source files are not removed from var/storage.

      • create a new image 'yourimage'
      • check that the file(s) exist in /var/storage/images/ <path/> yourimage
      • delete the image object in admin (do not move to trash)
        Result:
      • the object is deleted, the files are still present on disk

        Issue Links

          Activity

          Hide
          Bertrand Dunogier added a comment - - edited

          New pull request that takes care of empty directories: https://github.com/ezsystems/ezpublish-legacy-ee/pull/26

          Show
          Bertrand Dunogier added a comment - - edited New pull request that takes care of empty directories: https://github.com/ezsystems/ezpublish-legacy-ee/pull/26
          Hide
          Bertrand Dunogier added a comment - - edited

          In order to cleanup existing folders, use this: find var/*/storage -type d -depth | xargs rmdir --ignore-fail-on-non-empty

          I'll look into deletion from the code itself.

          Show
          Bertrand Dunogier added a comment - - edited In order to cleanup existing folders, use this: find var/*/storage -type d -depth | xargs rmdir --ignore-fail-on-non-empty I'll look into deletion from the code itself.
          Hide
          Bertrand Dunogier added a comment - - edited

          Merged to stable-4.7: https://github.com/ezsystems/ezpublish-legacy-ee/commit/27b32c5f95c66446262f639a1f2abcca5ac24b22 (doesn't apply to master since FS2 has been removed in 5.0).

          Can be backported to all 4.x branches if required.

          Cleaning up expired files

          Existing files are not removed by this patch. The easiest, and tested, way to do so is to find files modified on 1977-05-26 00:00. Using GNU find, it would work like this:

          find var/*/storage/{original,images} -newermt "1977-05-25 00:00" ! -newermt "1977-05-26 00:01" -delete

          Show
          Bertrand Dunogier added a comment - - edited Merged to stable-4.7: https://github.com/ezsystems/ezpublish-legacy-ee/commit/27b32c5f95c66446262f639a1f2abcca5ac24b22 (doesn't apply to master since FS2 has been removed in 5.0). Can be backported to all 4.x branches if required. Cleaning up expired files Existing files are not removed by this patch. The easiest, and tested, way to do so is to find files modified on 1977-05-26 00:00. Using GNU find, it would work like this: find var/*/storage/{original,images} -newermt "1977-05-25 00:00" ! -newermt "1977-05-26 00:01" -delete
          Hide
          Bertrand Dunogier added a comment -

          Pull request on ezpublish-legacy-ee: https://github.com/ezsystems/ezpublish-legacy-ee/pull/24.

          Show
          Bertrand Dunogier added a comment - Pull request on ezpublish-legacy-ee: https://github.com/ezsystems/ezpublish-legacy-ee/pull/24 .
          Hide
          Bertrand Dunogier added a comment -

          The problem here is that we can't use the approach we use in DB/DFS (they rely on a select query with a mix of scope and modification time), since we don't have an indexed list of clustered files + metadata.

          I am going to create a pull request based on Felix's patch.

          Show
          Bertrand Dunogier added a comment - The problem here is that we can't use the approach we use in DB/DFS (they rely on a select query with a mix of scope and modification time), since we don't have an indexed list of clustered files + metadata. I am going to create a pull request based on Felix's patch.

            People

            • Assignee:
              Unassigned
              Reporter:
              Joao Inacio (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour, 30 minutes
                1d 1h 30m