/
home
/
altere25
/
usaigc.com
/
wp-includes
/
/home/altere25/usaigc.com/wp-includes
mkdir
upload
Name
Size
Mode
Actions
abilities-api/
-
0755
rm
ai-client/
-
0755
rm
assets/
-
0755
rm
block-bindings/
-
0755
rm
block-patterns/
-
0755
rm
block-supports/
-
0755
rm
blocks/
-
0755
rm
build/
-
0755
rm
certificates/
-
0755
rm
css/
-
0755
rm
customize/
-
0755
rm
fonts/
-
0755
rm
html-api/
-
0755
rm
ID3/
-
0755
rm
images/
-
0755
rm
interactivity-api/
-
0755
rm
IXR/
-
0755
rm
js/
-
0755
rm
l10n/
-
0755
rm
php-ai-client/
-
0755
rm
php-compat/
-
0755
rm
PHPMailer/
-
0755
rm
pomo/
-
0755
rm
Requests/
-
0755
rm
rest-api/
-
0755
rm
SimplePie/
-
0755
rm
sitemaps/
-
0755
rm
sodium_compat/
-
0755
rm
style-engine/
-
0755
rm
Text/
-
0755
rm
theme-compat/
-
0755
rm
widgets/
-
0755
rm
.htaccess
178
0644
edit
dl
rm
abilities-api.php
32800
0644
edit
dl
rm
abilities.php
11797
0644
edit
dl
rm
admin-bar.php
40067
0644
edit
dl
rm
ai-client.php
2549
0644
edit
dl
rm
atomlib.php
12181
0644
edit
dl
rm
author-template.php
19844
0644
edit
dl
rm
block-bindings.php
7632
0644
edit
dl
rm
block-editor.php
28724
0644
edit
dl
rm
block-i18n.json
316
0644
edit
dl
rm
block-patterns.php
15606
0644
edit
dl
rm
block-template-utils.php
63168
0644
edit
dl
rm
block-template.php
18257
0644
edit
dl
rm
blocks.php
124205
0644
edit
dl
rm
bookmark-template.php
12768
0644
edit
dl
rm
bookmark.php
15427
0644
edit
dl
rm
cache-compat.php
11021
0644
edit
dl
rm
cache.php
13486
0644
edit
dl
rm
canonical.php
34786
0644
edit
dl
rm
capabilities.php
43584
0644
edit
dl
rm
category-template.php
56990
0644
edit
dl
rm
category.php
12834
0644
edit
dl
rm
class-avif-info.php
30008
0644
edit
dl
rm
class-feed.php
539
0644
edit
dl
rm
class-http.php
367
0644
edit
dl
rm
class-IXR.php
2609
0644
edit
dl
rm
class-json.php
43676
0644
edit
dl
rm
class-oembed.php
401
0644
edit
dl
rm
class-phpass.php
6771
0644
edit
dl
rm
class-phpmailer.php
664
0644
edit
dl
rm
class-pop3.php
21100
0644
edit
dl
rm
class-requests.php
2237
0644
edit
dl
rm
class-simplepie.php
453
0644
edit
dl
rm
class-smtp.php
457
0644
edit
dl
rm
class-snoopy.php
37715
0644
edit
dl
rm
class-walker-category-dropdown.php
2469
0644
edit
dl
rm
class-walker-category.php
8477
0644
edit
dl
rm
class-walker-comment.php
14221
0644
edit
dl
rm
class-walker-nav-menu.php
12044
0644
edit
dl
rm
class-walker-page-dropdown.php
2710
0644
edit
dl
rm
class-walker-page.php
7612
0644
edit
dl
rm
class-wp-admin-bar.php
18002
0644
edit
dl
rm
class-wp-ajax-response.php
5288
0644
edit
dl
rm
class-wp-application-passwords.php
17099
0644
edit
dl
rm
class-wp-block-bindings-registry.php
8263
0644
edit
dl
rm
class-wp-block-bindings-source.php
2992
0644
edit
dl
rm
class-wp-block-editor-context.php
1350
0644
edit
dl
rm
class-wp-block-list.php
4713
0644
edit
dl
rm
class-wp-block-metadata-registry.php
11846
0644
edit
dl
rm
class-wp-block-parser-block.php
2555
0644
edit
dl
rm
class-wp-block-parser-frame.php
1994
0644
edit
dl
rm
class-wp-block-parser.php
11525
0644
edit
dl
rm
class-wp-block-pattern-categories-registry.php
4383
0644
edit
dl
rm
class-wp-block-patterns-registry.php
10265
0644
edit
dl
rm
class-wp-block-processor.php
69914
0644
edit
dl
rm
class-wp-block-styles-registry.php
6419
0644
edit
dl
rm
class-wp-block-supports.php
7578
0644
edit
dl
rm
class-wp-block-template.php
2111
0644
edit
dl
rm
class-wp-block-templates-registry.php
7080
0644
edit
dl
rm
class-wp-block-type-registry.php
5305
0644
edit
dl
rm
class-wp-block-type.php
17222
0644
edit
dl
rm
class-wp-block.php
28236
0644
edit
dl
rm
class-wp-classic-to-block-menu-converter.php
4026
0644
edit
dl
rm
class-wp-comment-query.php
49040
0644
edit
dl
rm
class-wp-comment.php
17249
0644
edit
dl
rm
class-wp-connector-registry.php
15181
0644
edit
dl
rm
class-wp-customize-control.php
26112
0644
edit
dl
rm
class-wp-customize-manager.php
202908
0644
edit
dl
rm
class-wp-customize-nav-menus.php
58034
0644
edit
dl
rm
class-wp-customize-panel.php
10703
0644
edit
dl
rm
class-wp-customize-section.php
11209
0644
edit
dl
rm
class-wp-customize-setting.php
29956
0644
edit
dl
rm
class-wp-customize-widgets.php
72596
0644
edit
dl
rm
class-wp-date-query.php
35970
0644
edit
dl
rm
class-wp-dependencies.php
17089
0644
edit
dl
rm
class-wp-dependency.php
2653
0644
edit
dl
rm
class-wp-duotone.php
40836
0644
edit
dl
rm
class-wp-editor.php
72228
0644
edit
dl
rm
class-wp-embed.php
15908
0644
edit
dl
rm
class-wp-error.php
7514
0644
edit
dl
rm
class-wp-exception.php
253
0644
edit
dl
rm
class-wp-fatal-error-handler.php
8150
0644
edit
dl
rm
class-wp-feed-cache-transient.php
3304
0644
edit
dl
rm
class-wp-feed-cache.php
969
0644
edit
dl
rm
class-wp-filter-sentinel.php
760
0644
edit
dl
rm
class-wp-hook.php
17472
0644
edit
dl
rm
class-wp-http-cookie.php
7269
0644
edit
dl
rm
class-wp-http-curl.php
13261
0644
edit
dl
rm
class-wp-http-encoding.php
6689
0644
edit
dl
rm
class-wp-http-ixr-client.php
3516
0644
edit
dl
rm
class-wp-http-proxy.php
5980
0644
edit
dl
rm
class-wp-http-requests-hooks.php
2022
0644
edit
dl
rm
class-wp-http-requests-response.php
4243
0644
edit
dl
rm
class-wp-http-response.php
2977
0644
edit
dl
rm
class-wp-http-streams.php
16764
0644
edit
dl
rm
class-wp-http.php
41641
0644
edit
dl
rm
class-wp-icon-collections-registry.php
5805
0644
edit
dl
rm
class-wp-icons-registry.php
9903
0644
edit
dl
rm
class-wp-image-editor-gd.php
20741
0644
edit
dl
rm
class-wp-image-editor-imagick.php
43454
0644
edit
dl
rm
class-wp-image-editor.php
17456
0644
edit
dl
rm
class-wp-list-util.php
7443
0644
edit
dl
rm
class-wp-locale-switcher.php
6776
0644
edit
dl
rm
class-wp-locale.php
16848
0644
edit
dl
rm
class-wp-matchesmapregex.php
1828
0644
edit
dl
rm
class-wp-meta-query.php
30507
0644
edit
dl
rm
class-wp-metadata-lazyloader.php
6833
0644
edit
dl
rm
class-wp-navigation-fallback.php
9193
0644
edit
dl
rm
class-wp-network-query.php
19989
0644
edit
dl
rm
class-wp-network.php
12411
0644
edit
dl
rm
class-wp-object-cache.php
17524
0644
edit
dl
rm
class-wp-oembed-controller.php
6905
0644
edit
dl
rm
class-wp-oembed.php
34372
0644
edit
dl
rm
class-wp-paused-extensions-storage.php
5067
0644
edit
dl
rm
class-wp-phpmailer.php
4348
0644
edit
dl
rm
class-wp-plugin-dependencies.php
25209
0644
edit
dl
rm
class-wp-post-type.php
30672
0644
edit
dl
rm
class-wp-post.php
8806
0644
edit
dl
rm
class-wp-query.php
164148
0644
edit
dl
rm
class-wp-recovery-mode-cookie-service.php
6877
0644
edit
dl
rm
class-wp-recovery-mode-email-service.php
11162
0644
edit
dl
rm
class-wp-recovery-mode-key-service.php
4914
0644
edit
dl
rm
class-wp-recovery-mode-link-service.php
3523
0644
edit
dl
rm
class-wp-recovery-mode.php
11460
0644
edit
dl
rm
class-wp-rewrite.php
63693
0644
edit
dl
rm
class-wp-role.php
2523
0644
edit
dl
rm
class-wp-roles.php
9326
0644
edit
dl
rm
class-wp-script-modules.php
40743
0644
edit
dl
rm
class-wp-scripts.php
36754
0644
edit
dl
rm
class-wp-session-tokens.php
7319
0644
edit
dl
rm
class-wp-simplepie-file.php
3552
0644
edit
dl
rm
class-wp-simplepie-sanitize-kses.php
1903
0644
edit
dl
rm
class-wp-site-query.php
31482
0644
edit
dl
rm
class-wp-site.php
7836
0644
edit
dl
rm
class-wp-speculation-rules.php
7884
0644
edit
dl
rm
class-wp-styles.php
13316
0644
edit
dl
rm
class-wp-tax-query.php
19577
0644
edit
dl
rm
class-wp-taxonomy.php
18559
0644
edit
dl
rm
class-wp-term-query.php
40751
0644
edit
dl
rm
class-wp-term.php
5263
0644
edit
dl
rm
class-wp-text-diff-renderer-inline.php
979
0644
edit
dl
rm
class-wp-text-diff-renderer-table.php
18925
0644
edit
dl
rm
class-wp-textdomain-registry.php
10481
0644
edit
dl
rm
class-wp-theme-json-data.php
1805
0644
edit
dl
rm
class-wp-theme-json-resolver.php
35692
0644
edit
dl
rm
class-wp-theme-json-schema.php
7367
0644
edit
dl
rm
class-wp-theme-json.php
221506
0644
edit
dl
rm
class-wp-theme.php
65811
0644
edit
dl
rm
class-wp-token-map.php
29032
0644
edit
dl
rm
class-wp-url-pattern-prefixer.php
4802
0644
edit
dl
rm
class-wp-user-meta-session-tokens.php
2954
0644
edit
dl
rm
class-wp-user-query.php
44102
0644
edit
dl
rm
class-wp-user-request.php
2342
0644
edit
dl
rm
class-wp-user.php
23189
0644
edit
dl
rm
class-wp-view-config-data.php
29427
0644
edit
dl
rm
class-wp-walker.php
13292
0644
edit
dl
rm
class-wp-widget-factory.php
3343
0644
edit
dl
rm
class-wp-widget.php
18452
0644
edit
dl
rm
class-wp-xmlrpc-server.php
216272
0644
edit
dl
rm
class-wp.php
26371
0644
edit
dl
rm
class-wpdb.php
121437
0644
edit
dl
rm
class.wp-dependencies.php
373
0644
edit
dl
rm
class.wp-scripts.php
343
0644
edit
dl
rm
class.wp-styles.php
338
0644
edit
dl
rm
comment-template.php
103211
0644
edit
dl
rm
comment.php
150630
0644
edit
dl
rm
compat-utf8.php
19386
0644
edit
dl
rm
compat.php
22479
0644
edit
dl
rm
connectors.php
32922
0644
edit
dl
rm
cron.php
46266
0644
edit
dl
rm
date.php
400
0644
edit
dl
rm
default-constants.php
11365
0644
edit
dl
rm
default-filters.php
39500
0644
edit
dl
rm
default-widgets.php
2288
0644
edit
dl
rm
deprecated.php
193977
0644
edit
dl
rm
embed-template.php
338
0644
edit
dl
rm
embed.php
39215
0644
edit
dl
rm
error-protection.php
4092
0644
edit
dl
rm
feed-atom-comments.php
5504
0644
edit
dl
rm
feed-atom.php
3114
0644
edit
dl
rm
feed-rdf.php
2668
0644
edit
dl
rm
feed-rss.php
1189
0644
edit
dl
rm
feed-rss2-comments.php
4136
0644
edit
dl
rm
feed-rss2.php
3799
0644
edit
dl
rm
feed.php
25189
0644
edit
dl
rm
fonts.php
9789
0644
edit
dl
rm
formatting.php
357652
0644
edit
dl
rm
functions.php
295481
0644
edit
dl
rm
functions.wp-scripts.php
20492
0644
edit
dl
rm
functions.wp-styles.php
8654
0644
edit
dl
rm
general-template.php
183472
0644
edit
dl
rm
global-styles-and-settings.php
20780
0644
edit
dl
rm
http.php
28961
0644
edit
dl
rm
https-detection.php
5857
0644
edit
dl
rm
https-migration.php
4741
0644
edit
dl
rm
icons.php
6334
0644
edit
dl
rm
json-schema.php
7802
0644
edit
dl
rm
kses.php
88497
0644
edit
dl
rm
l10n.php
71415
0644
edit
dl
rm
link-template.php
160143
0644
edit
dl
rm
load.php
56475
0644
edit
dl
rm
locale.php
162
0644
edit
dl
rm
media-template.php
65759
0644
edit
dl
rm
media.php
236804
0644
edit
dl
rm
meta.php
66739
0644
edit
dl
rm
ms-blogs.php
26324
0644
edit
dl
rm
ms-default-constants.php
4921
0644
edit
dl
rm
ms-default-filters.php
6636
0644
edit
dl
rm
ms-deprecated.php
21787
0644
edit
dl
rm
ms-files.php
2857
0644
edit
dl
rm
ms-functions.php
92530
0644
edit
dl
rm
ms-load.php
20055
0644
edit
dl
rm
ms-network.php
3782
0644
edit
dl
rm
ms-settings.php
4197
0644
edit
dl
rm
ms-site.php
41729
0644
edit
dl
rm
nav-menu-template.php
25983
0644
edit
dl
rm
nav-menu.php
44269
0644
edit
dl
rm
option.php
105246
0644
edit
dl
rm
pluggable-deprecated.php
6324
0644
edit
dl
rm
pluggable.php
127919
0644
edit
dl
rm
plugin.php
36669
0644
edit
dl
rm
post-formats.php
7070
0644
edit
dl
rm
post-template.php
69129
0644
edit
dl
rm
post-thumbnail-template.php
10879
0644
edit
dl
rm
post.php
305215
0644
edit
dl
rm
query.php
37554
0644
edit
dl
rm
registration-functions.php
200
0644
edit
dl
rm
registration.php
200
0644
edit
dl
rm
rest-api.php
102951
0644
edit
dl
rm
revision.php
31241
0644
edit
dl
rm
rewrite.php
19567
0644
edit
dl
rm
robots-template.php
5185
0644
edit
dl
rm
rss-functions.php
277
0644
edit
dl
rm
rss.php
23203
0644
edit
dl
rm
script-loader.php
163550
0644
edit
dl
rm
script-modules.php
12311
0644
edit
dl
rm
session.php
258
0644
edit
dl
rm
shortcodes.php
24034
0644
edit
dl
rm
sitemaps.php
3238
0644
edit
dl
rm
speculative-loading.php
11880
0644
edit
dl
rm
spl-autoload-compat.php
441
0644
edit
dl
rm
style-engine.php
8045
0644
edit
dl
rm
taxonomy.php
178307
0644
edit
dl
rm
template-canvas.php
544
0644
edit
dl
rm
template-loader.php
4267
0644
edit
dl
rm
template.php
36824
0644
edit
dl
rm
theme-i18n.json
1892
0644
edit
dl
rm
theme-previews.php
2887
0644
edit
dl
rm
theme-templates.php
4060
0644
edit
dl
rm
theme.json
9480
0644
edit
dl
rm
theme.php
134641
0644
edit
dl
rm
update.php
38269
0644
edit
dl
rm
user.php
180301
0644
edit
dl
rm
utf8.php
6977
0644
edit
dl
rm
vars.php
6600
0644
edit
dl
rm
version.php
1101
0644
edit
dl
rm
view-config.php
19087
0644
edit
dl
rm
view-transitions.php
602
0644
edit
dl
rm
widgets.php
70866
0644
edit
dl
rm
wp-db.php
445
0644
edit
dl
rm
wp-diff.php
792
0644
edit
dl
rm
Edit:
/home/altere25/usaigc.com/wp-includes/ms-blogs.php
(26324B)
<?php /** * Site/blog functions that work with the blogs table and related data. * * @package WordPress * @subpackage Multisite * @since MU (3.0.0) */ // Don't load directly. if ( ! defined( 'ABSPATH' ) ) { exit; } require_once ABSPATH . WPINC . '/ms-site.php'; require_once ABSPATH . WPINC . '/ms-network.php'; /** * Updates the last_updated field for the current site. * * @since MU (3.0.0) */ function wpmu_update_blogs_date() { $site_id = get_current_blog_id(); update_blog_details( $site_id, array( 'last_updated' => current_time( 'mysql', true ) ) ); /** * Fires after the blog details are updated. * * @since MU (3.0.0) * * @param int $blog_id Site ID. */ do_action( 'wpmu_blog_updated', $site_id ); } /** * Gets a full site URL, given a site ID. * * @since MU (3.0.0) * * @param int $blog_id Site ID. * @return string Full site URL if found. Empty string if not. */ function get_blogaddress_by_id( $blog_id ) { $bloginfo = get_site( (int) $blog_id ); if ( empty( $bloginfo ) ) { return ''; } $scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME ); $scheme = empty( $scheme ) ? 'http' : $scheme; return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path ); } /** * Gets a full site URL, given a site name. * * @since MU (3.0.0) * * @param string $blogname Name of the subdomain or directory. * @return string */ function get_blogaddress_by_name( $blogname ) { if ( is_subdomain_install() ) { if ( 'main' === $blogname ) { $blogname = 'www'; } $url = rtrim( network_home_url(), '/' ); if ( ! empty( $blogname ) ) { $url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url ); } } else { $url = network_home_url( $blogname ); } return esc_url( $url . '/' ); } /** * Retrieves a site's ID given its (subdomain or directory) slug. * * @since MU (3.0.0) * @since 4.7.0 Converted to use `get_sites()`. * * @param string $slug A site's slug. * @return int|null The site ID, or null if no site is found for the given slug. */ function get_id_from_blogname( $slug ) { $current_network = get_network(); $slug = trim( $slug, '/' ); if ( is_subdomain_install() ) { $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain ); $path = $current_network->path; } else { $domain = $current_network->domain; $path = $current_network->path . $slug . '/'; } $site_ids = get_sites( array( 'number' => 1, 'fields' => 'ids', 'domain' => $domain, 'path' => $path, 'update_site_meta_cache' => false, ) ); if ( empty( $site_ids ) ) { return null; } return array_shift( $site_ids ); } /** * Retrieves the details for a blog from the blogs table and blog options. * * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * * @param int|string|array $fields Optional. A blog ID, a blog slug, or an array of fields to query against. * Defaults to the current blog ID. * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. * Default is true. * @return WP_Site|false Blog details on success. False on failure. */ function get_blog_details( $fields = null, $get_all = true ) { global $wpdb; if ( is_array( $fields ) ) { if ( isset( $fields['blog_id'] ) ) { $blog_id = $fields['blog_id']; } elseif ( isset( $fields['domain'] ) && isset( $fields['path'] ) ) { $key = md5( $fields['domain'] . $fields['path'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( str_starts_with( $fields['domain'], 'www.' ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } elseif ( isset( $fields['domain'] ) && is_subdomain_install() ) { $key = md5( $fields['domain'] ); $blog = wp_cache_get( $key, 'blog-lookup' ); if ( false !== $blog ) { return $blog; } if ( str_starts_with( $fields['domain'], 'www.' ) ) { $nowww = substr( $fields['domain'], 4 ); $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'] ) ); } else { $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) ); } if ( $blog ) { wp_cache_set( $blog->blog_id . 'short', $blog, 'blog-details' ); $blog_id = $blog->blog_id; } else { return false; } } else { return false; } } else { if ( ! $fields ) { $blog_id = get_current_blog_id(); } elseif ( ! is_numeric( $fields ) ) { $blog_id = get_id_from_blogname( $fields ); } else { $blog_id = $fields; } } $blog_id = (int) $blog_id; $all = $get_all ? '' : 'short'; $details = wp_cache_get( $blog_id . $all, 'blog-details' ); if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 === $details ) { return false; } else { // Clear old pre-serialized objects. Cache clients do better with that. wp_cache_delete( $blog_id . $all, 'blog-details' ); unset( $details ); } } else { return $details; } } // Try the other cache. if ( $get_all ) { $details = wp_cache_get( $blog_id . 'short', 'blog-details' ); } else { $details = wp_cache_get( $blog_id, 'blog-details' ); // If short was requested and full cache is set, we can return. if ( $details ) { if ( ! is_object( $details ) ) { if ( -1 === $details ) { return false; } else { // Clear old pre-serialized objects. Cache clients do better with that. wp_cache_delete( $blog_id, 'blog-details' ); unset( $details ); } } else { return $details; } } } if ( empty( $details ) ) { $details = WP_Site::get_instance( $blog_id ); if ( ! $details ) { // Set the full cache. wp_cache_set( $blog_id, -1, 'blog-details' ); return false; } } if ( ! $details instanceof WP_Site ) { $details = new WP_Site( $details ); } if ( ! $get_all ) { wp_cache_set( $blog_id . $all, $details, 'blog-details' ); return $details; } $switched_blog = false; if ( get_current_blog_id() !== $blog_id ) { switch_to_blog( $blog_id ); $switched_blog = true; } $details->blogname = get_option( 'blogname' ); $details->siteurl = get_option( 'siteurl' ); $details->post_count = get_option( 'post_count' ); $details->home = get_option( 'home' ); if ( $switched_blog ) { restore_current_blog(); } /** * Filters a blog's details. * * @since MU (3.0.0) * @deprecated 4.7.0 Use {@see 'site_details'} instead. * * @param WP_Site $details The blog details. */ $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' ); wp_cache_set( $blog_id . $all, $details, 'blog-details' ); $key = md5( $details->domain . $details->path ); wp_cache_set( $key, $details, 'blog-lookup' ); return $details; } /** * Clears the blog details cache. * * @since MU (3.0.0) * * @param int $blog_id Optional. Blog ID. Defaults to current blog. */ function refresh_blog_details( $blog_id = 0 ) { $blog_id = (int) $blog_id; if ( ! $blog_id ) { $blog_id = get_current_blog_id(); } clean_blog_cache( $blog_id ); } /** * Updates the details for a blog and the blogs table for a given blog ID. * * @since MU (3.0.0) * * @param int $blog_id Blog ID. * @param array $details Array of details keyed by blogs table field names. * @return bool True if update succeeds, false otherwise. */ function update_blog_details( $blog_id, $details = array() ) { if ( empty( $details ) ) { return false; } if ( is_object( $details ) ) { $details = get_object_vars( $details ); } $site = wp_update_site( $blog_id, $details ); if ( is_wp_error( $site ) ) { return false; } return true; } /** * Cleans the site details cache for a site. * * @since 4.7.4 * * @param int $site_id Optional. Site ID. Default is the current site ID. */ function clean_site_details_cache( $site_id = 0 ) { $site_id = (int) $site_id; if ( ! $site_id ) { $site_id = get_current_blog_id(); } wp_cache_delete( $site_id, 'site-details' ); wp_cache_delete( $site_id, 'blog-details' ); } /** * Retrieves option value for a given blog id based on name of option. * * If the option does not exist or does not have a value, then the return value * will be false. This is useful to check whether you need to install an option * and is commonly used during installation of plugin options and to test * whether upgrading is required. * * If the option was serialized then it will be unserialized when it is returned. * * @since MU (3.0.0) * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. * @param mixed $default_value Optional. Default value to return if the option does not exist. * @return mixed Value set for the option. */ function get_blog_option( $id, $option, $default_value = false ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() === $id ) { return get_option( $option, $default_value ); } switch_to_blog( $id ); $value = get_option( $option, $default_value ); restore_current_blog(); /** * Filters a blog option value. * * The dynamic portion of the hook name, `$option`, refers to the blog option name. * * @since 3.5.0 * * @param string $value The option value. * @param int $id Blog ID. */ return apply_filters( "blog_option_{$option}", $value, $id ); } /** * Adds a new option for a given blog ID. * * You do not need to serialize values. If the value needs to be serialized, then * it will be serialized before it is inserted into the database. Remember, * resources can not be serialized or added as an option. * * You can create options without values and then update the values later. * Existing options will not be updated and checks are performed to ensure that you * aren't adding a protected WordPress option. Care should be taken to not name * options the same as the ones which are protected. * * @since MU (3.0.0) * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to add. Expected to not be SQL-escaped. * @param mixed $value Option value, can be anything. Expected to not be SQL-escaped. * @return bool True if the option was added, false otherwise. */ function add_blog_option( $id, $option, $value ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() === $id ) { return add_option( $option, $value ); } switch_to_blog( $id ); $return = add_option( $option, $value ); restore_current_blog(); return $return; } /** * Removes an option by name for a given blog ID. Prevents removal of protected WordPress options. * * @since MU (3.0.0) * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to remove. Expected to not be SQL-escaped. * @return bool True if the option was deleted, false otherwise. */ function delete_blog_option( $id, $option ) { $id = (int) $id; if ( empty( $id ) ) { $id = get_current_blog_id(); } if ( get_current_blog_id() === $id ) { return delete_option( $option ); } switch_to_blog( $id ); $return = delete_option( $option ); restore_current_blog(); return $return; } /** * Updates an option for a particular blog. * * @since MU (3.0.0) * * @param int $id The blog ID. * @param string $option The option key. * @param mixed $value The option value. * @param mixed $deprecated Not used. * @return bool True if the value was updated, false otherwise. */ function update_blog_option( $id, $option, $value, $deprecated = null ) { $id = (int) $id; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } if ( get_current_blog_id() === $id ) { return update_option( $option, $value ); } switch_to_blog( $id ); $return = update_option( $option, $value ); restore_current_blog(); return $return; } /** * Switches the current blog. * * This function is useful if you need to pull posts, or other information, * from other blogs. You can switch back afterwards using restore_current_blog(). * * PHP code loaded with the originally requested site, such as code from a plugin or theme, does not switch. See #14941. * * @see restore_current_blog() * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * @global int $blog_id * @global array $_wp_switched_stack * @global bool $switched * @global string $table_prefix The database table prefix. * @global WP_Object_Cache $wp_object_cache * * @param int $new_blog_id The ID of the blog to switch to. Default: current blog. * @param bool $deprecated Not used. * @return true Always returns true. */ function switch_to_blog( $new_blog_id, $deprecated = null ) { global $wpdb; $prev_blog_id = get_current_blog_id(); if ( empty( $new_blog_id ) ) { $new_blog_id = $prev_blog_id; } $GLOBALS['_wp_switched_stack'][] = $prev_blog_id; /* * If we're switching to the same blog id that we're on, * set the right vars, do the associated actions, but skip * the extra unnecessary work */ if ( $new_blog_id === $prev_blog_id ) { /** * Fires when the blog is switched. * * @since MU (3.0.0) * @since 5.4.0 The `$context` parameter was added. * * @param int $new_blog_id New blog ID. * @param int $prev_blog_id Previous blog ID. * @param string $context Additional context. Accepts 'switch' when called from switch_to_blog() * or 'restore' when called from restore_current_blog(). */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); $GLOBALS['blog_id'] = $new_blog_id; wp_cache_switch_to_blog( $new_blog_id ); /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' ); $GLOBALS['switched'] = true; return true; } /** * Restores the current blog, after calling switch_to_blog(). * * @see switch_to_blog() * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * @global array $_wp_switched_stack * @global int $blog_id * @global bool $switched * @global string $table_prefix The database table prefix. * @global WP_Object_Cache $wp_object_cache * * @return bool True on success, false if we're already on the current blog. */ function restore_current_blog() { global $wpdb; if ( empty( $GLOBALS['_wp_switched_stack'] ) ) { return false; } $new_blog_id = array_pop( $GLOBALS['_wp_switched_stack'] ); $prev_blog_id = get_current_blog_id(); if ( $new_blog_id === $prev_blog_id ) { /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); // If we still have items in the switched stack, consider ourselves still 'switched'. $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } $wpdb->set_blog_id( $new_blog_id ); $GLOBALS['blog_id'] = $new_blog_id; $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix(); wp_cache_switch_to_blog( $new_blog_id ); /** This filter is documented in wp-includes/ms-blogs.php */ do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' ); // If we still have items in the switched stack, consider ourselves still 'switched'. $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); return true; } /** * Fallback logic for switching cache context when an object cache drop-in lacks * a switch_to_blog() method. * * Reinitializes the cache and restores global/non-persistent groups. * * Used by the wp_cache_switch_to_blog() compatibility function, abstracted only * to allow for unit testing outside of the drop-in plugin inclusion circus. * * @since 7.0.0 * * @global WP_Object_Cache $wp_object_cache Object cache global instance. */ function wp_cache_switch_to_blog_fallback() { global $wp_object_cache; $global_groups = false; $non_persistent_groups = false; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) && is_array( $wp_object_cache->global_groups ) ) { // Get the global groups as they are. $group_names = $wp_object_cache->global_groups; // Get global group keys if non-numeric array. if ( ! wp_is_numeric_array( $group_names ) ) { $group_names = array_keys( $group_names ); } $global_groups = $group_names; /* * Non-persistent groups: Check for no_mc_groups first (memcached drop-in). * Fall back to cache structure (default cache). */ if ( isset( $wp_object_cache->no_mc_groups ) && is_array( $wp_object_cache->no_mc_groups ) && ! empty( $wp_object_cache->no_mc_groups ) ) { $non_persistent_groups = $wp_object_cache->no_mc_groups; } elseif ( isset( $wp_object_cache->cache ) && is_array( $wp_object_cache->cache ) ) { $all_groups = array_keys( $wp_object_cache->cache ); $non_persistent_groups = array_values( array_diff( $all_groups, $global_groups ) ); } } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( ! is_array( $global_groups ) || empty( $global_groups ) ) { $global_groups = array( 'blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'image_editor', 'networks', 'network-queries', 'sites', 'site-details', 'site-options', 'site-queries', 'site-transient', 'theme_files', 'translation_files', 'rss', 'users', 'user-queries', 'user_meta', 'useremail', 'userlogins', 'userslugs', ); } wp_cache_add_global_groups( $global_groups ); } if ( function_exists( 'wp_cache_add_non_persistent_groups' ) ) { if ( ! is_array( $non_persistent_groups ) || empty( $non_persistent_groups ) ) { $non_persistent_groups = array( 'counts', 'plugins', 'theme_json', ); } wp_cache_add_non_persistent_groups( $non_persistent_groups ); } } /** * Switches the initialized roles and current user capabilities to another site. * * @since 4.9.0 * * @param int $new_site_id New site ID. * @param int $old_site_id Old site ID. */ function wp_switch_roles_and_user( $new_site_id, $old_site_id ) { if ( $new_site_id === $old_site_id ) { return; } if ( ! did_action( 'init' ) ) { return; } wp_roles()->for_site( $new_site_id ); wp_get_current_user()->for_site( $new_site_id ); } /** * Determines if switch_to_blog() is in effect. * * @since 3.5.0 * * @global array $_wp_switched_stack * * @return bool True if switched, false otherwise. */ function ms_is_switched() { return ! empty( $GLOBALS['_wp_switched_stack'] ); } /** * Checks if a particular blog is archived. * * @since MU (3.0.0) * * @param int $id Blog ID. * @return string Whether the blog is archived or not. */ function is_archived( $id ) { return get_blog_status( $id, 'archived' ); } /** * Updates the 'archived' status of a particular blog. * * @since MU (3.0.0) * * @param int $id Blog ID. * @param string $archived The new status. * @return string $archived */ function update_archived( $id, $archived ) { update_blog_status( $id, 'archived', $archived ); return $archived; } /** * Updates a blog details field. * * @since MU (3.0.0) * @since 5.1.0 Use wp_update_site() internally. * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $blog_id Blog ID. * @param string $pref Field name. * @param string $value Field value. * @param mixed $deprecated Not used. * @return string|false $value */ function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) { global $wpdb; if ( null !== $deprecated ) { _deprecated_argument( __FUNCTION__, '3.1.0' ); } $allowed_field_names = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ); if ( ! in_array( $pref, $allowed_field_names, true ) ) { return $value; } $result = wp_update_site( $blog_id, array( $pref => $value, ) ); if ( is_wp_error( $result ) ) { return false; } return $value; } /** * Gets a blog details field. * * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $id Blog ID. * @param string $pref Field name. * @return bool|string|null $value */ function get_blog_status( $id, $pref ) { global $wpdb; $details = get_site( $id ); if ( $details ) { return $details->$pref; } return $wpdb->get_var( $wpdb->prepare( "SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id ) ); } /** * Gets a list of most recently updated blogs. * * @since MU (3.0.0) * * @global wpdb $wpdb WordPress database abstraction object. * * @param mixed $deprecated Not used. * @param int $start Optional. Number of blogs to offset the query. Used to build LIMIT clause. * Can be used for pagination. Default 0. * @param int $quantity Optional. The maximum number of blogs to retrieve. Default 40. * @return array The list of blogs. */ function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { global $wpdb; if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, 'MU' ); // Never used. } return $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ), ARRAY_A ); } /** * Handler for updating the site's last updated date when a post is published or * an already published post is changed. * * @since 3.3.0 * * @param string $new_status The new post status. * @param string $old_status The old post status. * @param WP_Post $post Post object. */ function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) { $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } // Post was freshly published, published post was saved, or published post was unpublished. wpmu_update_blogs_date(); } /** * Handler for updating the current site's last updated date when a published * post is deleted. * * @since 3.4.0 * * @param int $post_id Post ID */ function _update_blog_date_on_post_delete( $post_id ) { $post = get_post( $post_id ); $post_type_obj = get_post_type_object( $post->post_type ); if ( ! $post_type_obj || ! $post_type_obj->public ) { return; } if ( 'publish' !== $post->post_status ) { return; } wpmu_update_blogs_date(); } /** * Handler for updating the current site's posts count when a post is deleted. * * @since 4.0.0 * @since 6.2.0 Added the `$post` parameter. * * @param int $post_id Post ID. * @param WP_Post $post Post object. */ function _update_posts_count_on_delete( $post_id, $post ) { if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { return; } update_posts_count(); } /** * Handler for updating the current site's posts count when a post status changes. * * @since 4.0.0 * @since 4.9.0 Added the `$post` parameter. * * @param string $new_status The status the post is changing to. * @param string $old_status The status the post is changing from. * @param WP_Post|null $post Post object. */ function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) { if ( $new_status === $old_status ) { return; } if ( 'post' !== get_post_type( $post ) ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } update_posts_count(); } /** * Counts number of sites grouped by site status. * * @since 5.3.0 * * @param int $network_id Optional. The network to get counts for. Default is the current network ID. * @return int[] { * Numbers of sites grouped by site status. * * @type int $all The total number of sites. * @type int $public The number of public sites. * @type int $archived The number of archived sites. * @type int $mature The number of mature sites. * @type int $spam The number of spam sites. * @type int $deleted The number of deleted sites. * } */ function wp_count_sites( $network_id = null ) { if ( empty( $network_id ) ) { $network_id = get_current_network_id(); } $counts = array(); $args = array( 'network_id' => $network_id, 'number' => 1, 'fields' => 'ids', 'no_found_rows' => false, ); $q = new WP_Site_Query( $args ); $counts['all'] = $q->found_sites; $_args = $args; $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); foreach ( $statuses as $status ) { $_args = $args; $_args[ $status ] = 1; $q = new WP_Site_Query( $_args ); $counts[ $status ] = $q->found_sites; } return $counts; }
Save
cmd:
run