[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> ms-site.php (summary)

Site API

File Size: 1324 lines (40 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/includes/upgrade.php

Defines 27 functions

  wp_insert_site()
  wp_update_site()
  wp_delete_site()
  get_site()
  _prime_site_caches()
  wp_lazyload_site_meta()
  update_site_cache()
  update_sitemeta_cache()
  get_sites()
  wp_prepare_site_data()
  wp_normalize_site_data()
  wp_validate_site_data()
  wp_initialize_site()
  wp_uninitialize_site()
  wp_is_site_initialized()
  clean_blog_cache()
  add_site_meta()
  delete_site_meta()
  get_site_meta()
  update_site_meta()
  delete_site_meta_by_key()
  wp_maybe_update_network_site_counts_on_update()
  wp_maybe_transition_site_statuses_on_update()
  wp_maybe_clean_new_site_cache_on_update()
  wp_update_blog_public_option_on_site_update()
  wp_cache_set_sites_last_changed()
  wp_check_site_meta_support_prefilter()

Functions
Functions that are not part of a class:

wp_insert_site( array $data )   X-Ref
Inserts a new site into the database.

param: array $data {
return: int|WP_Error The new site's ID on success, or error object on failure.

wp_update_site( $site_id, array $data )   X-Ref
Updates a site in the database.

param: int   $site_id ID of the site that should be updated.
param: array $data    Site data to update. See {@see wp_insert_site()} for the list of supported keys.
return: int|WP_Error The updated site's ID on success, or error object on failure.

wp_delete_site( $site_id )   X-Ref
Deletes a site from the database.

param: int $site_id ID of the site that should be deleted.
return: WP_Site|WP_Error The deleted site object on success, or error object on failure.

get_site( $site = null )   X-Ref
Retrieves site data given a site ID or site object.

Site data will be cached and returned after being passed through a filter.
If the provided site is empty, the current site global will be used.

param: WP_Site|int|null $site Optional. Site to retrieve. Default is the current site.
return: WP_Site|null The site object or null if not found.

_prime_site_caches( $ids, $update_meta_cache = true )   X-Ref
Adds any sites from the given IDs to the cache that do not already exist in cache.

param: array $ids               ID list.
param: bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.

wp_lazyload_site_meta( array $site_ids )   X-Ref
Queue site meta for lazy-loading.

param: array $site_ids List of site IDs.

update_site_cache( $sites, $update_meta_cache = true )   X-Ref
Updates sites in cache.

param: array $sites             Array of site objects.
param: bool  $update_meta_cache Whether to update site meta cache. Default true.

update_sitemeta_cache( $site_ids )   X-Ref
Updates metadata cache for list of site IDs.

Performs SQL query to retrieve all metadata for the sites matching `$site_ids` and stores them in the cache.
Subsequent calls to `get_site_meta()` will not need to query the database.

param: array $site_ids List of site IDs.
return: array|false An array of metadata on success, false if there is nothing to update.

get_sites( $args = array()   X-Ref
Retrieves a list of sites matching requested arguments.

param: string|array $args Optional. Array or string of arguments. See WP_Site_Query::__construct()
return: WP_Site[]|int[]|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids',

wp_prepare_site_data( $data, $defaults, $old_site = null )   X-Ref
Prepares site data for insertion or update in the database.

param: array        $data     Associative array of site data passed to the respective function.
param: array        $defaults Site data defaults to parse $data against.
param: WP_Site|null $old_site Optional. Old site object if an update, or null if an insertion.
return: array|WP_Error Site data ready for a database transaction, or WP_Error in case a validation

wp_normalize_site_data( $data )   X-Ref
Normalizes data for a site prior to inserting or updating in the database.

param: array $data Associative array of site data passed to the respective function.
return: array Normalized site data.

wp_validate_site_data( $errors, $data, $old_site = null )   X-Ref
Validates data for a site prior to inserting or updating in the database.

param: WP_Error     $errors   Error object, passed by reference. Will contain validation errors if
param: array        $data     Associative array of complete site data. See {@see wp_insert_site()}
param: WP_Site|null $old_site The old site object if the data belongs to a site being updated,

wp_initialize_site( $site_id, array $args = array()   X-Ref
Runs the initialization routine for a given site.

This process includes creating the site's database tables and
populating them with defaults.

param: int|WP_Site $site_id Site ID or object.
param: array       $args    {
return: true|WP_Error True on success, or error object on failure.

wp_uninitialize_site( $site_id )   X-Ref
Runs the uninitialization routine for a given site.

This process includes dropping the site's database tables and deleting its uploads directory.

param: int|WP_Site $site_id Site ID or object.
return: true|WP_Error True on success, or error object on failure.

wp_is_site_initialized( $site_id )   X-Ref
Checks whether a site is initialized.

A site is considered initialized when its database tables are present.

param: int|WP_Site $site_id Site ID or object.
return: bool True if the site is initialized, false otherwise.

clean_blog_cache( $blog )   X-Ref
Clean the blog cache

param: WP_Site|int $blog The site object or ID to be cleared from cache.

add_site_meta( $site_id, $meta_key, $meta_value, $unique = false )   X-Ref
Adds metadata to a site.

param: int    $site_id    Site ID.
param: string $meta_key   Metadata name.
param: mixed  $meta_value Metadata value. Must be serializable if non-scalar.
param: bool   $unique     Optional. Whether the same key should not be added.
return: int|false Meta ID on success, false on failure.

delete_site_meta( $site_id, $meta_key, $meta_value = '' )   X-Ref
Removes metadata matching criteria from a site.

You can match based on the key, or key and value. Removing based on key and
value, will keep from removing duplicate metadata with the same key. It also
allows removing all metadata matching key, if needed.

param: int    $site_id    Site ID.
param: string $meta_key   Metadata name.
param: mixed  $meta_value Optional. Metadata value. If provided,
return: bool True on success, false on failure.

get_site_meta( $site_id, $key = '', $single = false )   X-Ref
Retrieves metadata for a site.

param: int    $site_id Site ID.
param: string $key     Optional. The meta key to retrieve. By default,
param: bool   $single  Optional. Whether to return a single value.
return: mixed An array of values if `$single` is false.

update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' )   X-Ref
Updates metadata for a site.

Use the $prev_value parameter to differentiate between meta fields with the
same key and site ID.

If the meta field for the site does not exist, it will be added.

param: int    $site_id    Site ID.
param: string $meta_key   Metadata key.
param: mixed  $meta_value Metadata value. Must be serializable if non-scalar.
param: mixed  $prev_value Optional. Previous value to check before updating.
return: int|bool Meta ID if the key didn't exist, true on successful update,

delete_site_meta_by_key( $meta_key )   X-Ref
Deletes everything from site meta matching meta key.

param: string $meta_key Metadata key to search for when deleting.
return: bool Whether the site meta key was deleted from the database.

wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null )   X-Ref
Updates the count of sites for a network based on a changed site.

param: WP_Site      $new_site The site object that has been inserted, updated or deleted.
param: WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous

wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null )   X-Ref
Triggers actions on site status updates.

param: WP_Site      $new_site The site object after the update.
param: WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous

wp_maybe_clean_new_site_cache_on_update( $new_site, $old_site )   X-Ref
Cleans the necessary caches after specific site data has been updated.

param: WP_Site $new_site The site object after the update.
param: WP_Site $old_site The site object prior to the update.

wp_update_blog_public_option_on_site_update( $site_id, $is_public )   X-Ref
Updates the `blog_public` option for a given site ID.

param: int    $site_id   Site ID.
param: string $is_public Whether the site is public. A numeric string,

wp_cache_set_sites_last_changed()   X-Ref
Sets the last changed time for the 'sites' cache group.


wp_check_site_meta_support_prefilter( $check )   X-Ref
Aborts calls to site meta if it is not supported.

param: mixed $check Skip-value for whether to proceed site meta function execution.
return: mixed Original value of $check, or false if site meta is not supported.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref