| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Secrets API: WP_Secrets_Broken_Store class 4 * 5 * @package WordPress 6 * @subpackage Secrets 7 * @since 7.2.0 8 */ 9 10 /** 11 * Stands in for the store when a drop-in leaves an invalid value behind. 12 * 13 * Installed when a secrets.php drop-in exists but $GLOBALS['wp_secrets_store'] does 14 * not hold a WP_Secrets_Store. 15 * 16 * The drop-in's presence signals the operator wants storage other than the 17 * default – falling back to WP_Secrets_Option_Store here would silently write 18 * secrets to local options against that intent, which is exactly the silent 19 * downgrade to local storage this API refuses to make. Every operation fails 20 * closed instead. 21 * 22 * @since 7.2.0 23 */ 24 final class WP_Secrets_Broken_Store implements WP_Secrets_Store { 25 26 /** 27 * Always fails closed. 28 * 29 * @since 7.2.0 30 * 31 * @param string $name Ignored. 32 * @param bool $network Ignored. 33 * @return WP_Error 34 */ 35 public function get( string $name, bool $network = false ): WP_Error { 36 return $this->error(); 37 } 38 39 /** 40 * Always fails closed. 41 * 42 * @since 7.2.0 43 * 44 * @param string $name Ignored. 45 * @param array<mixed> $record Ignored. 46 * @param bool $network Ignored. 47 * @return WP_Error 48 */ 49 public function set( string $name, array $record, bool $network = false ): WP_Error { 50 return $this->error(); 51 } 52 53 /** 54 * Always fails closed. 55 * 56 * @since 7.2.0 57 * 58 * @param string $name Ignored. 59 * @param bool $network Ignored. 60 * @return WP_Error 61 */ 62 public function delete( string $name, bool $network = false ): WP_Error { 63 return $this->error(); 64 } 65 66 /** 67 * Always fails closed. 68 * 69 * @since 7.2.0 70 * 71 * @param bool $network Ignored. 72 * @return WP_Error 73 */ 74 public function list_names( bool $network = false ): WP_Error { 75 return $this->error(); 76 } 77 78 79 /** 80 * Builds the error every method returns. 81 * 82 * @since 7.2.0 83 * 84 * @return WP_Error 85 */ 86 private function error(): WP_Error { 87 return new WP_Error( 88 WP_SECRETS_ERROR_STORE_UNAVAILABLE, 89 __( 'The secrets.php drop-in did not provide a usable store.' ) 90 ); 91 } 92 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Oct 14 08:20:33 2026 | Cross-referenced by PHPXref |