Skip to content

Ensure the storage is setup when using the size_sync outside of the class#1039

Merged
aatanasov-cloudinary merged 1 commit intodevelopfrom
fix/system-report-media-sync-size
May 19, 2025
Merged

Ensure the storage is setup when using the size_sync outside of the class#1039
aatanasov-cloudinary merged 1 commit intodevelopfrom
fix/system-report-media-sync-size

Conversation

@aatanasov-cloudinary
Copy link
Collaborator

The size_sync method of the storage component is used by other components. For example, when preparing a report, the report might use the size_sync method, which uses other components. If the storage isn't setup, this leads to a PHP fatal error.

Approach

  • Init the setup if $this->media is missing

QA notes

Two options:

  • Use $this->plugin->get_component( 'storage' )->size_sync( $media_id ); outside of the Storage component.
  • Find an attachment without local_size or remote_size, and generate a report. Previously, it caused errors.

@aatanasov-cloudinary aatanasov-cloudinary changed the title Ensure the storage is setup when using the size_sync outside of the clas Ensure the storage is setup when using the size_sync outside of the class May 19, 2025
@aatanasov-cloudinary aatanasov-cloudinary merged commit 9e279ba into develop May 19, 2025
4 checks passed
@aatanasov-cloudinary aatanasov-cloudinary deleted the fix/system-report-media-sync-size branch June 4, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants