From 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 27 Jul 2020 10:05:23 +0200 Subject: Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my familly --- .../class-wp-paused-extensions-storage.php | 223 --------------------- 1 file changed, 223 deletions(-) delete mode 100644 srcs/wordpress/wp-includes/class-wp-paused-extensions-storage.php (limited to 'srcs/wordpress/wp-includes/class-wp-paused-extensions-storage.php') diff --git a/srcs/wordpress/wp-includes/class-wp-paused-extensions-storage.php b/srcs/wordpress/wp-includes/class-wp-paused-extensions-storage.php deleted file mode 100644 index 7c51db8..0000000 --- a/srcs/wordpress/wp-includes/class-wp-paused-extensions-storage.php +++ /dev/null @@ -1,223 +0,0 @@ -type = $extension_type; - } - - /** - * Records an extension error. - * - * Only one error is stored per extension, with subsequent errors for the same extension overriding the - * previously stored error. - * - * @since 5.2.0 - * - * @param string $extension Plugin or theme directory name. - * @param array $error { - * Error that was triggered. - * - * @type string $type The error type. - * @type string $file The name of the file in which the error occurred. - * @type string $line The line number in which the error occurred. - * @type string $message The error message. - * } - * @return bool True on success, false on failure. - */ - public function set( $extension, $error ) { - if ( ! $this->is_api_loaded() ) { - return false; - } - - $option_name = $this->get_option_name(); - - if ( ! $option_name ) { - return false; - } - - $paused_extensions = (array) get_option( $option_name, array() ); - - // Do not update if the error is already stored. - if ( isset( $paused_extensions[ $this->type ][ $extension ] ) && $paused_extensions[ $this->type ][ $extension ] === $error ) { - return true; - } - - $paused_extensions[ $this->type ][ $extension ] = $error; - - return update_option( $option_name, $paused_extensions ); - } - - /** - * Forgets a previously recorded extension error. - * - * @since 5.2.0 - * - * @param string $extension Plugin or theme directory name. - * - * @return bool True on success, false on failure. - */ - public function delete( $extension ) { - if ( ! $this->is_api_loaded() ) { - return false; - } - - $option_name = $this->get_option_name(); - - if ( ! $option_name ) { - return false; - } - - $paused_extensions = (array) get_option( $option_name, array() ); - - // Do not delete if no error is stored. - if ( ! isset( $paused_extensions[ $this->type ][ $extension ] ) ) { - return true; - } - - unset( $paused_extensions[ $this->type ][ $extension ] ); - - if ( empty( $paused_extensions[ $this->type ] ) ) { - unset( $paused_extensions[ $this->type ] ); - } - - // Clean up the entire option if we're removing the only error. - if ( ! $paused_extensions ) { - return delete_option( $option_name ); - } - - return update_option( $option_name, $paused_extensions ); - } - - /** - * Gets the error for an extension, if paused. - * - * @since 5.2.0 - * - * @param string $extension Plugin or theme directory name. - * - * @return array|null Error that is stored, or null if the extension is not paused. - */ - public function get( $extension ) { - if ( ! $this->is_api_loaded() ) { - return null; - } - - $paused_extensions = $this->get_all(); - - if ( ! isset( $paused_extensions[ $extension ] ) ) { - return null; - } - - return $paused_extensions[ $extension ]; - } - - /** - * Gets the paused extensions with their errors. - * - * @since 5.2.0 - * - * @return array Associative array of extension slugs to the error recorded. - */ - public function get_all() { - if ( ! $this->is_api_loaded() ) { - return array(); - } - - $option_name = $this->get_option_name(); - - if ( ! $option_name ) { - return array(); - } - - $paused_extensions = (array) get_option( $option_name, array() ); - - return isset( $paused_extensions[ $this->type ] ) ? $paused_extensions[ $this->type ] : array(); - } - - /** - * Remove all paused extensions. - * - * @since 5.2.0 - * - * @return bool - */ - public function delete_all() { - if ( ! $this->is_api_loaded() ) { - return false; - } - - $option_name = $this->get_option_name(); - - if ( ! $option_name ) { - return false; - } - - $paused_extensions = (array) get_option( $option_name, array() ); - - unset( $paused_extensions[ $this->type ] ); - - if ( ! $paused_extensions ) { - return delete_option( $option_name ); - } - - return update_option( $option_name, $paused_extensions ); - } - - /** - * Checks whether the underlying API to store paused extensions is loaded. - * - * @since 5.2.0 - * - * @return bool True if the API is loaded, false otherwise. - */ - protected function is_api_loaded() { - return function_exists( 'get_option' ); - } - - /** - * Get the option name for storing paused extensions. - * - * @since 5.2.0 - * - * @return string - */ - protected function get_option_name() { - if ( ! wp_recovery_mode()->is_active() ) { - return ''; - } - - $session_id = wp_recovery_mode()->get_session_id(); - if ( empty( $session_id ) ) { - return ''; - } - - return "{$session_id}_paused_extensions"; - } -} -- cgit