-
Notifications
You must be signed in to change notification settings - Fork 3.2k
OPcache: Add information to the Site Health -> Server #9260
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
24a96cd
b530158
231515b
2ef962d
620c687
e35fe8a
d546cb4
1ea330c
232ea64
152e81a
63f41ea
923db6f
801cbee
5ad77f9
0887bc7
3fd57b9
4675ff5
e62c774
4320d86
4a39b00
c3ef929
b8ee643
dd325c4
0dae7c5
fc5cf45
17e5a79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2755,6 +2755,52 @@ public function get_test_search_engine_visibility() { | |||||
| return $result; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Tests if opcode cache is enabled and available. | ||||||
| * | ||||||
| * @since 7.0.0 | ||||||
| * | ||||||
| * @return array<string, string|array<string, string>> The test result. | ||||||
| */ | ||||||
| public function get_test_opcode_cache() { | ||||||
| $opcode_cache_enabled = false; | ||||||
| if ( function_exists( 'opcache_get_status' ) ) { | ||||||
| $status = @opcache_get_status( false ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discourage -- Warning emitted in failure case. | ||||||
| if ( $status && true === $status['opcache_enabled'] ) { | ||||||
westonruter marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| $opcode_cache_enabled = true; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| $result = array( | ||||||
| 'label' => __( 'Opcode cache is enabled' ), | ||||||
| 'status' => 'good', | ||||||
| 'badge' => array( | ||||||
| 'label' => __( 'Performance' ), | ||||||
| 'color' => 'blue', | ||||||
| ), | ||||||
| 'description' => sprintf( | ||||||
| '<p>%s</p>', | ||||||
| __( 'Opcode cache improves PHP performance by storing precompiled script bytecode in memory, reducing the need for PHP to load and parse scripts on each request.' ) | ||||||
| ), | ||||||
| 'actions' => sprintf( | ||||||
| '<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>', | ||||||
| 'https://www.php.net/manual/en/book.opcache.php', | ||||||
|
||||||
| 'https://www.php.net/manual/en/book.opcache.php', | |
| esc_url( 'https://www.php.net/manual/en/book.opcache.php' ), |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test identifier should be 'opcode_cache' to match the test registration in the get_tests() method at line 2898. Currently it's 'opcache_cache' which creates an inconsistency.
| 'test' => 'opcache_cache', | |
| 'test' => 'opcode_cache', |
Uh oh!
There was an error while loading. Please reload this page.