* @since-jetpack 5.8.0 * * @module sync * * @param string $plugin , Plugin slug * @param string Error code * @param string Error message */ do_action( 'jetpack_plugin_update_failed', $this->get_plugin_info( $slug ), $errors['code'], $errors['message'], $this->state ); } return; } $this->plugins_updated = array_map( array( $this, 'get_plugin_info' ), $plugins ); add_action( 'shutdown', array( $this, 'sync_plugins_updated' ), 9 ); break; case 'install': /** * Signals to the sync listener that a plugin was installed and a sync action * reflecting the installation and the plugin info should be sent * * @since 1.6.3 * @since-jetpack 5.8.0 * * @module sync * * @param array () $plugin, Plugin Data */ do_action( 'jetpack_plugin_installed', array_map( array( $this, 'get_plugin_info' ), $plugins ) ); } } /** * Retrieve the plugin information by a plugin slug. * * @access private * * @param string $slug Plugin slug. * @return array Plugin information. */ private function get_plugin_info( $slug ) { $plugins = get_plugins(); // Get the most up to date info. if ( isset( $plugins[ $slug ] ) ) { return array_merge( array( 'slug' => $slug ), $plugins[ $slug ] ); } // Try grabbing the info from before the update. return isset( $this->plugins[ $slug ] ) ? array_merge( array( 'slug' => $slug ), $this->plugins[ $slug ] ) : array( 'slug' => $slug ); } /** * Retrieve upgrade errors. * * @access private * * @param \Automatic_Upgrader_Skin|\WP_Upgrader_Skin $skin The upgrader skin being used. * @return array|boolean Error on error, false otherwise. */ private function get_errors( $skin ) { // @phan-suppress-next-line PhanUndeclaredMethod -- Checked before being called. See also https://github.com/phan/phan/issues/1204. $errors = method_exists( $skin, 'get_errors' ) ? $skin->get_errors() : null; if ( is_wp_error( $errors ) ) { $error_code = $errors->get_error_code(); if ( ! empty( $error_code ) ) { return array( 'code' => $error_code, 'message' => $errors->get_error_message(), ); } } if ( isset( $skin->result ) ) { $errors = $skin->result; if ( is_wp_error( $errors ) ) { return array( 'code' => $errors->get_error_code(), 'message' => $errors->get_error_message(), ); } if ( empty( $skin->result ) ) { return array( 'code' => 'unknown', 'message' => __( 'Unknown Plugin Update Failure', 'jetpack-sync' ), ); } } return false; } /** * Handle plugin ajax edit in the administration. * * @access public * * @todo Update this method to use WP_Filesystem instead of fopen/fclose. */ public function plugin_edit_ajax() { // This validation is based on wp_edit_theme_plugin_file(). if ( empty( $_POST['file'] ) ) { return; } $file = wp_unslash( $_POST['file'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Validated manually just after. if ( 0 !== validate_file( $file ) ) { return; } if ( ! isset( $_POST['newcontent'] ) ) { return; } if ( ! isset( $_POST['nonce'] ) ) { return; } if ( empty( $_POST['plugin'] ) ) { return; } $plugin = wp_unslash( $_POST['plugin'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Validated manually just after. if ( ! current_user_can( 'edit_plugins' ) ) { return; } if ( ! wp_verify_nonce( $_POST['nonce'], 'edit-plugin_' . $file ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- WP core doesn't pre-sanitize nonces either. return; } $plugins = get_plugins(); if ( ! array_key_exists( $plugin, $plugins ) ) { return; } if ( 0 !== validate_file( $file, get_plugin_files( $plugin ) ) ) { return; } $real_file = WP_PLUGIN_DIR . '/' . $file; // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_is_writable if ( ! is_writable( $real_file ) ) { return; } // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen $file_pointer = fopen( $real_file, 'w+' ); if ( false === $file_pointer ) { return; } // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose fclose( $file_pointer ); /** * This action is documented already in this file */ do_action( 'jetpack_edited_plugin', $plugin, $plugins[ $plugin ] ); } /** * Handle plugin deletion. * * @access public * * @param string $plugin_path Path to the plugin main file. */ public function delete_plugin( $plugin_path ) { $full_plugin_path = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_path; // Checking for file existence because some sync plugin module tests simulate plugin installation and deletion without putting file on disk. if ( file_exists( $full_plugin_path ) ) { $all_plugin_data = get_plugin_data( $full_plugin_path ); $data = array( 'name' => $all_plugin_data['Name'], 'version' => $all_plugin_data['Version'], ); } else { $data = array( 'name' => $plugin_path, 'version' => 'unknown', ); } $this->plugin_info[ $plugin_path ] = $data; } /** * Invoked after plugin deletion. * * @access public * * @param string $plugin_path Path to the plugin main file. * @param boolean $is_deleted Whether the plugin was deleted successfully. */ public function deleted_plugin( $plugin_path, $is_deleted ) { call_user_func( $this->action_handler, $plugin_path, $is_deleted, $this->plugin_info[ $plugin_path ] ); unset( $this->plugin_info[ $plugin_path ] ); } /** * Expand the plugins within a hook before they are serialized and sent to the server. * * @access public * * @param array $args The hook parameters. * @return array $args The expanded hook parameters. */ public function expand_plugin_data( $args ) { $plugin_path = $args[0]; $plugin_data = array(); if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); if ( isset( $all_plugins[ $plugin_path ] ) ) { $all_plugin_data = $all_plugins[ $plugin_path ]; $plugin_data['name'] = $all_plugin_data['Name']; $plugin_data['version'] = $all_plugin_data['Version']; } return array( $args[0], $args[1], $plugin_data, ); } /** * Helper method for firing the 'jetpack_plugins_updated' action on shutdown. * * @access public */ public function sync_plugins_updated() { /** * Sync that a plugin update * * @since 1.6.3 * @since-jetpack 5.8.0 * * @module sync * * @param array () $plugin, Plugin Data */ do_action( 'jetpack_plugins_updated', $this->plugins_updated, $this->state ); } }
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Sync\Modules\Plugins" not found in /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php:144 Stack trace: #0 [internal function]: Automattic\Jetpack\Sync\Modules::load_module('Automattic\\Jetp...') #1 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php(129): array_map(Array, Array) #2 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php(67): Automattic\Jetpack\Sync\Modules::initialize_modules() #3 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(86): Automattic\Jetpack\Sync\Modules::get_modules() #4 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(76): Automattic\Jetpack\Sync\Listener->init() #5 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-listener.php(63): Automattic\Jetpack\Sync\Listener->__construct() #6 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(765): Automattic\Jetpack\Sync\Listener::get_instance() #7 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(146): Automattic\Jetpack\Sync\Actions::initialize_listener() #8 /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-main.php(111): Automattic\Jetpack\Sync\Actions::init() #9 /htdocs/parierfacile.com/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Sync\Main::on_plugins_loaded_late('') #10 /htdocs/parierfacile.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #11 /htdocs/parierfacile.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /htdocs/parierfacile.com/wp-settings.php(559): do_action('plugins_loaded') #13 /htdocs/parierfacile.com/wp-config.php(83): require_once('/htdocs/parierf...') #14 /htdocs/parierfacile.com/wp-load.php(50): require_once('/htdocs/parierf...') #15 /htdocs/parierfacile.com/wp-blog-header.php(13): require_once('/htdocs/parierf...') #16 /htdocs/parierfacile.com/index.php(17): require('/htdocs/parierf...') #17 {main} thrown in /htdocs/parierfacile.com/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-modules.php on line 144