Index: src/wp-includes/option.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/option.php	(revision 42623)
+++ src/wp-includes/option.php	(date 1517908658000)
@@ -1652,10 +1652,65 @@
  *
  * @since 2.9.0
  *
+ * @see delete_network_transient
+ *
  * @param string $transient Transient name. Expected to not be SQL-escaped.
+ *
  * @return bool True if successful, false otherwise
  */
 function delete_site_transient( $transient ) {
+	return delete_network_transient( null, $transient );
+}
+
+/**
+ * Get the value of a site transient.
+ *
+ * If the transient does not exist, does not have a value, or has expired,
+ * then the return value will be false.
+ *
+ * @since 2.9.0
+ *
+ * @see get_network_transient()
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ *
+ * @return mixed Value of transient.
+ */
+function get_site_transient( $transient ) {
+	return get_network_transient( null, $transient );
+}
+
+/**
+ * Set/update the value of a site transient.
+ *
+ * You do not need to serialize values, if the value needs to be serialize, then
+ * it will be serialized before it is set.
+ *
+ * @since 2.9.0
+ *
+ * @see set_network_transient()
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped. Must be
+ *                           167 characters or fewer in length.
+ * @param mixed $value Transient value. Expected to not be SQL-escaped.
+ * @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
+ *
+ * @return bool False if value was not set and true if value was set.
+ */
+function set_site_transient( $transient, $value, $expiration = 0 ) {
+	return set_network_transient( null, $value, $expiration = 0 );
+}
+
+/**
+ * Delete a network transient.
+ *
+ * @since 5.0.0
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return bool True if successful, false otherwise
+ * @param int    $network_id ID of the network.
+ */
+function delete_network_transient( $network_id, $transient ) {
 
 	/**
 	 * Fires immediately before a specific site transient is deleted.
@@ -1663,19 +1718,22 @@
 	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
 	 *
 	 * @since 3.0.0
+	 * @since 5.0.0 The `$network_id` parameter was added.
 	 *
 	 * @param string $transient Transient name.
+	 * @param int    $network_id ID of the network.
 	 */
-	do_action( "delete_site_transient_{$transient}", $transient );
+	do_action( "delete_site_transient_{$transient}", $transient, $network_id );
 
 	if ( wp_using_ext_object_cache() ) {
-		$result = wp_cache_delete( $transient, 'site-transient' );
+		$cache_key = "$network_id:$transient";
+		$result    = wp_cache_delete( $cache_key, 'site-transient' );
 	} else {
 		$option_timeout = '_site_transient_timeout_' . $transient;
 		$option         = '_site_transient_' . $transient;
-		$result         = delete_site_option( $option );
+		$result         = delete_network_option( $network_id, $option );
 		if ( $result ) {
-			delete_site_option( $option_timeout );
+			delete_network_option( $network_id, $option_timeout );
 		}
 	}
 	if ( $result ) {
@@ -1686,30 +1744,32 @@
 		 * @since 3.0.0
 		 *
 		 * @param string $transient Deleted transient name.
+		 * @param int    $network_id ID of the network.
 		 */
-		do_action( 'deleted_site_transient', $transient );
+		do_action( 'deleted_site_transient', $transient, $network_id );
 	}
 
 	return $result;
 }
 
 /**
- * Get the value of a site transient.
+ * Get the value of a network transient.
  *
  * If the transient does not exist, does not have a value, or has expired,
  * then the return value will be false.
  *
- * @since 2.9.0
+ * @since 5.0.0
  *
  * @see get_transient()
- *
+
+ * @param int    $network_id ID of the network.
  * @param string $transient Transient name. Expected to not be SQL-escaped.
  * @return mixed Value of transient.
  */
-function get_site_transient( $transient ) {
+function get_network_transient( $network_id, $transient ) {
 
 	/**
-	 * Filters the value of an existing site transient.
+	 * Filters the value of an existing network transient.
 	 *
 	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
 	 *
@@ -1718,36 +1778,39 @@
 	 *
 	 * @since 2.9.0
 	 * @since 4.4.0 The `$transient` parameter was added.
+	 * @since 5.0.0 The `$network_id` parameter was added.
 	 *
 	 * @param mixed  $pre_site_transient The default value to return if the site transient does not exist.
 	 *                                   Any value other than false will short-circuit the retrieval
 	 *                                   of the transient, and return the returned value.
 	 * @param string $transient          Transient name.
+	 * @param int    $network_id ID of the network.
 	 */
-	$pre = apply_filters( "pre_site_transient_{$transient}", false, $transient );
+	$pre = apply_filters( "pre_site_transient_{$transient}", false, $transient, $network_id );
 
 	if ( false !== $pre ) {
 		return $pre;
 	}
 
 	if ( wp_using_ext_object_cache() ) {
-		$value = wp_cache_get( $transient, 'site-transient' );
+		$cache_key = "$network_id:$transient";
+		$value = wp_cache_get( $cache_key, 'site-transient' );
 	} else {
 		// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
 		$no_timeout       = array( 'update_core', 'update_plugins', 'update_themes' );
 		$transient_option = '_site_transient_' . $transient;
 		if ( ! in_array( $transient, $no_timeout ) ) {
 			$transient_timeout = '_site_transient_timeout_' . $transient;
-			$timeout           = get_site_option( $transient_timeout );
+			$timeout           = get_network_option( $network_id, $transient_timeout );
 			if ( false !== $timeout && $timeout < time() ) {
-				delete_site_option( $transient_option );
-				delete_site_option( $transient_timeout );
+				delete_network_option( $network_id, $transient_option );
+				delete_network_option( $network_id, $transient_timeout );
 				$value = false;
 			}
 		}
 
 		if ( ! isset( $value ) ) {
-			$value = get_site_option( $transient_option );
+			$value = get_network_option( $network_id, $transient_option );
 		}
 	}
 
@@ -1758,20 +1821,22 @@
 	 *
 	 * @since 2.9.0
 	 * @since 4.4.0 The `$transient` parameter was added.
+	 * @since 5.0.0 The `$network_id` parameter was added.
 	 *
 	 * @param mixed  $value     Value of site transient.
 	 * @param string $transient Transient name.
+	 * @param int    $network_id ID of the network.
 	 */
-	return apply_filters( "site_transient_{$transient}", $value, $transient );
+	return apply_filters( "site_transient_{$transient}", $value, $transient, $network_id );
 }
 
 /**
- * Set/update the value of a site transient.
+ * Set/update the value of a network transient.
  *
  * You do not need to serialize values, if the value needs to be serialize, then
  * it will be serialized before it is set.
  *
- * @since 2.9.0
+ * @since 5.0.0
  *
  * @see set_transient()
  *
@@ -1781,79 +1846,88 @@
  * @param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
  * @return bool False if value was not set and true if value was set.
  */
-function set_site_transient( $transient, $value, $expiration = 0 ) {
+function set_network_transient( $network_id, $transient, $value, $expiration = 0 ) {
 
 	/**
-	 * Filters the value of a specific site transient before it is set.
+	 * Filters the value of a specific network transient before it is set.
 	 *
 	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
 	 *
 	 * @since 3.0.0
 	 * @since 4.4.0 The `$transient` parameter was added.
+	 * @since 5.0.0 The `$network_id` parameter was added.
 	 *
 	 * @param mixed  $value     New value of site transient.
 	 * @param string $transient Transient name.
+	 * @param int    $network_id ID of the network.
 	 */
-	$value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient );
+	$value = apply_filters( "pre_set_site_transient_{$transient}", $value, $transient, $network_id );
 
 	$expiration = (int) $expiration;
 
 	/**
-	 * Filters the expiration for a site transient before its value is set.
+	 * Filters the expiration for a network transient before its value is set.
 	 *
 	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
 	 *
 	 * @since 4.4.0
+	 * @since 5.0.0 The `$network_id` parameter was added.
 	 *
 	 * @param int    $expiration Time until expiration in seconds. Use 0 for no expiration.
 	 * @param mixed  $value      New value of site transient.
 	 * @param string $transient  Transient name.
+	 * @param int    $network_id ID of the network.
 	 */
-	$expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient );
+	$expiration = apply_filters( "expiration_of_site_transient_{$transient}", $expiration, $value, $transient, $network_id );
 
 	if ( wp_using_ext_object_cache() ) {
-		$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
+		$cache_key = "$network_id:$transient";
+		$result = wp_cache_set( $cache_key, $value, 'site-transient', $expiration );
 	} else {
 		$transient_timeout = '_site_transient_timeout_' . $transient;
 		$option            = '_site_transient_' . $transient;
-		if ( false === get_site_option( $option ) ) {
+		if ( false === get_network_option( $network_id, $option ) ) {
 			if ( $expiration ) {
-				add_site_option( $transient_timeout, time() + $expiration );
+				add_network_option( $network_id, $transient_timeout, time() + $expiration );
 			}
-			$result = add_site_option( $option, $value );
+			$result = add_network_option( $network_id, $option, $value );
 		} else {
 			if ( $expiration ) {
-				update_site_option( $transient_timeout, time() + $expiration );
+				update_network_option( $network_id, $transient_timeout, time() + $expiration );
 			}
-			$result = update_site_option( $option, $value );
+			$result = update_network_option( $network_id, $option, $value );
 		}
 	}
 	if ( $result ) {
 
 		/**
-		 * Fires after the value for a specific site transient has been set.
+		 * Fires after the value for a specific network transient has been set.
 		 *
 		 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
 		 *
 		 * @since 3.0.0
 		 * @since 4.4.0 The `$transient` parameter was added
+		 * @since 5.0.0 The `$network_id` parameter was added.
 		 *
 		 * @param mixed  $value      Site transient value.
 		 * @param int    $expiration Time until expiration in seconds.
 		 * @param string $transient  Transient name.
+		 * @param int    $network_id ID of the network.
 		 */
-		do_action( "set_site_transient_{$transient}", $value, $expiration, $transient );
+		do_action( "set_site_transient_{$transient}", $value, $expiration, $transient, $network_id );
 
 		/**
-		 * Fires after the value for a site transient has been set.
+		 * Fires after the value for a network transient has been set.
 		 *
 		 * @since 3.0.0
+		 * @since 5.0.0 The `$network_id` parameter was added.
 		 *
 		 * @param string $transient  The name of the site transient.
 		 * @param mixed  $value      Site transient value.
 		 * @param int    $expiration Time until expiration in seconds.
+		 * @param int    $network_id ID of the network.
 		 */
-		do_action( 'setted_site_transient', $transient, $value, $expiration );
+		do_action( 'setted_site_transient', $transient, $value, $expiration, $network_id );
 	}
 	return $result;
 }
