[wp-trac] [WordPress Trac] #56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a public function
WordPress Trac
noreply at wordpress.org
Tue Jan 24 12:43:45 UTC 2023
#56975: Replace the internal `WP_Theme_JSON_Resolver::theme_has_support()` with a
public function
-------------------------------------------------+-------------------------
Reporter: oandregal | Owner:
| hellofromTonya
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.2
Component: Themes | Version:
Severity: normal | Resolution:
Keywords: gutenberg-merge has-patch has-unit- | Focuses:
tests has-testing-info | performance
-------------------------------------------------+-------------------------
Comment (by Otto42):
Replying to [comment:89 spacedmonkey]:
> It seems to me, that is there is a valid use case that the cache needs
to be invalidated.
As @flixos90 mentioned, all those cases are easily solved with a slightly
modified static variable idea, where the theme name is used a key. Easy to
write, cheap to implement.
> Maybe instead of a static variable or object cache, maybe a global.
Something I explored here.
There's no real case where using a global makes sense, because if the goal
is to centralize it in one place, then having a global just allows you to
split that up and decentralize it. Anytime you check the global value
instead of calling the function to get the value, you're decentralizing
the function.
> It is worth noting, there is a performance hit of requesting if a file
existing and is readable 170+ times per page.
I have to question, why are we doing this that many times per page? It
seems like this is a case of optimization needed. I can see maybe having
it happen like 10 times, but 100 or more is insane. Is it used in some
kind of loop structure somewhere that is unnecessary? Maybe this whole
argument could be easily solved by simply eliminating the actual problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56975#comment:90>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list