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

Bug on trashed content removal when using trashpurge.php script

    XMLWordPrintable

    Details

      Description

      On a recent work for a client we had to set a cronjob to run the bin/php/trashpurge.php script every day to remove trashed objects older than a year.

      On a bridge eZ installation we ran the trashpurge script using the following command:

      /usr/bin/php ezpublish/console ezpublish:legacy:script --env=dev bin/php/trashpurge.php --siteaccess=amnh_admin --trashed-days=365

      But instead of getting:

      Running script 'bin/php/trashpurge.php' in eZ Publish legacy context
      Purging trash items:
      Found XX object(s) in trash for at least 356 days.

      We were getting

      ... for at least 1231231234 days

      The fix was to remove an additional strtotime from the trashpurge script

      Wrong:

      $options['trashed-days'] ? strtotime( "-{$options['trashed-days']} days" ) : null

      Good:

      $options['trashed-days'] ? (int)$options['trashed-days'] : null

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            carlos@mugo.ca Carlos Mauri
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: