티스토리 수익 글 보기
{{ message }}
Enhance object-cache.php drop-in placement logic to support updating to a newer version of the file
#1047
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
See #1042 (comment): Given that PR contains changes to the
object-cache.phpdrop-in which require updating it in order for the underlying Server-Timing logic to still be loaded correctly, the logic to place that file needs to support updating an older version of the file to its latest version that comes with Performance Lab.So far, the logic was naively checking for purely the existence of the drop-in via its version constant, without checking whether that version is the latest version though.
Relevant technical choices
PERFLAB_OBJECT_CACHE_DROPIN_LATEST_VERSIONcontains always the latest version of the drop-in. For that, we need a separate constant as we can’t access thePERFLAB_OBJECT_CACHE_DROPIN_VERSIONconstant defined in the plugin’s ownobject-cache.copy.phpfile, as that file is never actually loaded.perflab_object_cache_dropin_versionis introduced, purely to facilitate unit testing related to thePERFLAB_OBJECT_CACHE_DROPIN_VERSIONconstant. This filter is needed because constants can’t be “un-defined”, so code relying on constants is otherwise untestable.Checklist
[Focus]orInfrastructurelabel.[Type]label.no milestonelabel.