Skip to content

Commit b2e9bb9

Browse files
committed
Доработки.
1 parent c35602a commit b2e9bb9

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

src/Base/WordpressableTestCase.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -343,48 +343,6 @@ protected function wpDieHandler($message) : void
343343
throw new WPDieException($message);
344344
}
345345

346-
/**
347-
* Flushes the WordPress object cache.
348-
*
349-
* @return void
350-
*/
351-
public static function flushCache() : void
352-
{
353-
global $wp_object_cache;
354-
355-
$wp_object_cache->group_ops = [];
356-
$wp_object_cache->stats = [];
357-
$wp_object_cache->memcache_debug = [];
358-
$wp_object_cache->cache = [];
359-
360-
if (method_exists($wp_object_cache, '__remoteset')) {
361-
$wp_object_cache->__remoteset();
362-
}
363-
364-
wp_cache_flush();
365-
wp_cache_add_global_groups([
366-
'users',
367-
'userlogins',
368-
'usermeta',
369-
'user_meta',
370-
'useremail',
371-
'userslugs',
372-
'site-transient',
373-
'site-options',
374-
'blog-lookup',
375-
'blog-details',
376-
'rss',
377-
'global-posts',
378-
'blog-id-cache',
379-
'networks',
380-
'sites',
381-
'site-details',
382-
'blog_meta',
383-
]);
384-
385-
wp_cache_add_non_persistent_groups(['comment', 'counts', 'plugins']);
386-
}
387-
388346
/**
389347
* Clean up any registered meta keys.
390348
*

src/Traits/WordpressTrait.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,48 @@
1717
trait WordpressTrait
1818
{
1919

20+
/**
21+
* Flushes the WordPress object cache.
22+
*
23+
* @return void
24+
*/
25+
public static function flushCache() : void
26+
{
27+
global $wp_object_cache;
28+
29+
$wp_object_cache->group_ops = [];
30+
$wp_object_cache->stats = [];
31+
$wp_object_cache->memcache_debug = [];
32+
$wp_object_cache->cache = [];
33+
34+
if (method_exists($wp_object_cache, '__remoteset')) {
35+
$wp_object_cache->__remoteset();
36+
}
37+
38+
wp_cache_flush();
39+
wp_cache_add_global_groups([
40+
'users',
41+
'userlogins',
42+
'usermeta',
43+
'user_meta',
44+
'useremail',
45+
'userslugs',
46+
'site-transient',
47+
'site-options',
48+
'blog-lookup',
49+
'blog-details',
50+
'rss',
51+
'global-posts',
52+
'blog-id-cache',
53+
'networks',
54+
'sites',
55+
'site-details',
56+
'blog_meta',
57+
]);
58+
59+
wp_cache_add_non_persistent_groups(['comment', 'counts', 'plugins']);
60+
}
61+
2062
/**
2163
* Asserts that the given value is an instance of WP_Error.
2264
*

0 commit comments

Comments
 (0)