[ 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.

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

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

return: int|WP_Error The updated site's ID on success, or error object on failure.
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.

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

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

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.

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

_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.

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

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

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

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

return: array|WP_Error Site data ready for a database transaction, or WP_Error in case a validation
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.

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

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

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.

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

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.

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

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.

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

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.

return: int|false Meta ID on success, false on failure.
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.

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.

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

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

return: mixed An array of values if `$single` is false.
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.

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.

return: int|bool Meta ID if the key didn't exist, true on successful update,
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.

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

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

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.

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



Generated : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref