[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

Site API

File Size: 1303 lines (40 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 26 functions

  wp_insert_site()
  wp_update_site()
  wp_delete_site()
  get_site()
  _prime_site_caches()
  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.
since: 5.1.0

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.
since: 5.1.0

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.
since: 5.1.0

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.
since: 4.6.0

_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.
since: 4.6.0
since: 5.1.0 Introduced the `$update_meta_cache` parameter.

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.
since: 4.6.0
since: 5.1.0 Introduced the `$update_meta_cache` parameter.

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.
since: 5.1.0

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: array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids',
since: 4.6.0
since: 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters.

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
since: 5.1.0

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.
since: 5.1.0

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,
since: 5.1.0

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.
since: 5.1.0

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.
since: 5.1.0

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.
since: 5.1.0

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.
since: 3.5.0

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.
since: 5.1.0

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.
since: 5.1.0

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.
since: 5.1.0

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,
since: 5.1.0

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.
since: 5.1.0

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
since: 5.1.0

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
since: 5.1.0

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 obejct prior to the update.
since: 5.1.0

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

param: int    $site_id Site ID.
param: string $public  The value of the site status.
since: 5.1.0

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

since: 5.1.0

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.
since: 5.1.0



Generated: Tue Nov 5 01:00:02 2024 Cross-referenced by PHPXref 0.7.1