Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-30834: remove strtotime function from the trashed-days option #1441

Merged
merged 1 commit into from
Nov 1, 2019

Conversation

carlosmauri
Copy link
Contributor

@carlosmauri carlosmauri commented Aug 9, 2019

On a recent client work we noticed that the trashpurge.php wasn't working as expected.

This PR fix that issue.

Summary:
The following line within the trashpurge.php script:
$options['trashed-days'] ? strtotime( "-{$options['trashed-days']} days" ) : null

Is converting the trashed days into the wrong value.
This is because we already have the same strtotime function in here:
https://github.com/ezsystems/ezpublish-legacy/blob/2019.03/kernel/private/classes/ezscripttrashpurge.php#L88

The commit fix that issue.

More info within the Jira ticket:
JIRA ticket: https://jira.ez.no/browse/EZP-30834

Thanks!

Copy link
Contributor

@mateuszbieniek mateuszbieniek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! $trashedDays indeed should be an integer with number of days, not a timestamp (

* @param int|null $trashedDays Number of days an object should had been in trash to be purged, use null to use a default value so any object in the trash will be purged.
).
That's +1 from me.

PS: Thank you for your contribution!

@mateuszbieniek
Copy link
Contributor

Please note that the test fails to reasons not related to this PR.

Copy link
Member

@glye glye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! But could you please rebase on 2017.12? We merge forwards from there.

@carlosmauri
Copy link
Contributor Author

Hi @glye ,
Thanks for taking this PR into consideration.

About the rebase you are asking for. Are you sure about rebase on 2017.12? this branch is kind of 100 commits behind 2019.03 and it does not include any of the work done here:
#1351

I can also

  1. git checkout -b 201908-680_trashpurge_bug_rebase origin/2017.12
  2. git cherry-pick 2100905
    and push this creating a new PR.

Does it make sense?
Looking forward to your feedback,

Thank you :)

@andrerom
Copy link
Contributor

andrerom commented Nov 1, 2019

Merging, indeed this only makes sense on 2019.03 as this is bug fix for new feature added in 2019.03/2.5.
Thanks for contributing :)

@andrerom andrerom merged commit dffc4fd into ezsystems:2019.03 Nov 1, 2019
@carlosmauri
Copy link
Contributor Author

Beautiful!
Thank you all :)

@glye
Copy link
Member

glye commented Nov 4, 2019

Great. Sorry I missed your answer, @carlosmauri

Opencontent pushed a commit to Opencontent/ezpublish-legacy that referenced this pull request Mar 17, 2020
* commit 'c49eef93f50c665a3d7a6b2aa6387ccd46e059f5':
  Removed invalid constructor call
  Fixed wrong old-style constructor usage
  EZP-31040: Remote Code Execution in file uploads
  Show images after used url_prefix (ezsystems#1453)
  improve php 7 bc doc (ezsystems#1452)
  Fix notice when checking for anonymous  classes in autoload generator (ezsystems#1450)
  Do not support literal HTML in the Administration Interface (ezsystems#1408)
  Fix transformURI() on ignoreIndexDir & ! htmlEscape (ezsystems#1449)
  Make autoloads ignore anonymous classes (ezsystems#1448)
  Update php7.md
  Fixing search in media lib which used to loose context (ezsystems#1433)
  [Travis] Add testing for PHP 7.2 and 7.3 (ezsystems#1446)
  EZP-30834: remove strtotime function from the trashed-days option (ezsystems#1441)
  Fix instances of count() that would cause a warning in 7.2
  Updated dbupdate scripts so they will no longer fail when there are multiple users with the same e-mail (ezsystems#1445)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants