Skip to content

Releases: radeno/wordpress-base-helpers

v1.4.9 — attachment size from metadata

Choose a tag to compare

@radeno radeno released this 14 Jul 04:39

Faster attachment rendering

AttachmentHelper::getAttachmentObject() fired a blocking cURL HEAD request for every attachment, so a single page render made dozens of round trips over the network to Azure. WordPress 6.0+ already stores the size in wp_get_attachment_metadata()['filesize'], so it is now read from there, and the HEAD request remains only as a fallback for attachments that still lack it.

human_size is unchanged — still a string from size_format().

Hardened HEAD fallback (FileHelper::getRemoteFileSize())

  • Accept-Encoding: identity — on a compressed response Content-Length describes the gzipped body, not the file (measured 25 994 B against a 126 558 B file).
  • HTTP 200 only — a 404 error page carries a Content-Length of its own and was being reported as the file size.
  • Timeouts (5s connect / 10s total) — the default was unbounded, so an unresponsive origin could hold a PHP worker until max_execution_time.
  • Content-Length of the final hop — FOLLOWLOCATION leaves the headers of every redirect in the buffer, so a 302's own Content-Length could win over the real one.
  • URL rebuilt from its parsed parts — the previous string-replace dropped the port and percent-encoded the query string, which corrupted any URL carrying an Azure SAS token.

Upgrading

composer update radeno/wordpress-base-helpers

Full changelog: v1.4.8...v1.4.9

v1.4.8

Choose a tag to compare

@radeno radeno released this 04 Jul 08:46

Changes since v1.4.7

  • Fix helper bugs; now requires WordPress 6.7 / PHP 8.2
  • Extend core WP REST controllers in AnyPostsRestController / AnyTermsRestController
  • Add PHPStan static-analysis setup for the REST controllers
  • Consolidate to a single composer.json
  • Replace manual includes with PSR-4 autoloading
  • Remove replace of symfony/polyfill-* (was blocking installation in consuming repositories)

v1.4.7

Choose a tag to compare

@radeno radeno released this 26 Mar 23:35

Add Localhe helpers

  • LocaleHelper::getPluginsLanguageCode() - checks for WPML or Polylang language
  • LocaleHelper::getPostMetaLanguageCode($postId) - check for _icl_lang or _pll_post_language meta values

v1.4.6

Choose a tag to compare

@radeno radeno released this 24 Jul 08:25

Remove addAllowedContentTypes
Add getMimeTypesByExtensions

v1.4.5

Choose a tag to compare

@radeno radeno released this 03 Feb 17:40

v1.4.5

  • remove comments url rewrite, this should be implemented in final product
  • add HookHelper for internal use yet

v1.4.4

Choose a tag to compare

@radeno radeno released this 11 Jan 13:36
Remove unsetting user endpoints

We need more conditionals for this

v1.4.3

Choose a tag to compare

@radeno radeno released this 05 Dec 10:29
Small fix

v1.4.2

Choose a tag to compare

@radeno radeno released this 29 Nov 15:49
v1.4.2

v1.4.1

Choose a tag to compare

@radeno radeno released this 22 Nov 09:46
Update v1.4.1

v1.4.0

Choose a tag to compare

@radeno radeno released this 22 Nov 07:55
Update to version 1.4