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

[4.x]: ResaveController ignores --offset when displaying element count in CLI output #12526

Closed
leevigraham opened this issue Jan 11, 2023 · 4 comments · Fixed by #12542
Closed
Assignees

Comments

@leevigraham
Copy link
Contributor

What happened?

Description

Total number of elements shown in CLI output does not change when using offset

Without --offset:

image

With --offset:

image

Steps to reproduce

  1. Run ./craft resave/entries to get the correct count of total entries being saved
  2. Run ./craft resave/entries --offset=10

Expected behavior

The second run should show 10 less entries than the first

Actual behavior

Total entries is not updated… however the number of entries saved is correct

Notes

I think this might be an issue with Yii count method.

Craft CMS version

4.3.6.1

PHP version

8.1

Operating system and version

OSX

Database type and version

Postgres

Image driver and version

No response

Installed plugins and versions

@brianjhanson brianjhanson self-assigned this Jan 13, 2023
brianjhanson added a commit that referenced this issue Jan 13, 2023
Yii's $query->count() [ignores things like limit and
offset](yiisoft/yii2#13846).

Fixes #12526
@brianjhanson
Copy link
Contributor

brianjhanson commented Jan 13, 2023

Looks like this is traced back to the same yii2 issue (feature?) reported by a familiar face in #6036. I've opened a PR to address it by switching $query->count() to count($query->all()).

@leevigraham
Copy link
Contributor Author

leevigraham commented Jan 13, 2023

@brianjhanson Ha… I thought it was familiar.

@brandonkelly
Copy link
Member

Fixed for the next Craft 3 and 4 releases via #12542.

@brandonkelly
Copy link
Member

Craft 3.7.64 and 4.3.7 have been released with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants