| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack-autoloader |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -namespace Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ12_5; | |
| 8 | +namespace Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ16_3_a_7\al6_0_1; | |
| 9 | 9 | |
| 10 | 10 | // phpcs:ignore |
| 11 | 11 | |
| 12 | 12 | /** |
| @@ -59,15 +59,15 @@ | ||
| 59 | 59 | |
| 60 | 60 | // We combine the active list and cached list to preemptively load classes for plugins that are |
| 61 | 61 | // presently unknown but will be loaded during the request. While this may result in us considering packages in |
| 62 | 62 | // deactivated plugins there shouldn't be any problems as a result and the eventual consistency is sufficient. |
| 63 | - $all_plugins = array_merge( $active_plugins, $cached_plugins ); | |
| 63 | + // The current plugin is included to cover the case where it is the latest autoloader but unknown (and not | |
| 64 | + // cached). It goes ahead of the cached entries because manifests are read in order and ties go to the first | |
| 65 | + // read: a cached path can name a build a host just retired, which must not outrank the directory we are | |
| 66 | + // executing from. Do not move it ahead of the active entries, which would give each plugin a differently | |
| 67 | + // ordered list and trip the order-sensitive comparison in have_plugins_changed(). | |
| 68 | + $all_plugins = array_merge( $active_plugins, array( $current_plugin ), $cached_plugins ); | |
| 64 | 69 | |
| 65 | - // In particular we also include the current plugin to address the case where it is the latest autoloader | |
| 66 | - // but also unknown (and not cached). We don't want it in the active list because we don't know that it | |
| 67 | - // is active but we need it in the all plugins list so that it is considered by the autoloader. | |
| 68 | - $all_plugins[] = $current_plugin; | |
| 69 | - | |
| 70 | 70 | // We require uniqueness in the array to avoid processing the same plugin more than once. |
| 71 | 71 | $all_plugins = array_values( array_unique( $all_plugins ) ); |
| 72 | 72 | |
| 73 | 73 | /** @var Latest_Autoloader_Guard $guard */ |
| @@ -83,8 +83,11 @@ | ||
| 83 | 83 | $hook_manager = $container->get( Hook_Manager::class ); |
| 84 | 84 | |
| 85 | 85 | // Register a shutdown handler to clean up the autoloader. |
| 86 | 86 | $hook_manager->add_action( 'shutdown', new Shutdown_Handler( $plugins_handler, $cached_plugins, $was_included_by_autoloader ) ); |
| 87 | + | |
| 88 | + // Register a plugins_loaded handler to check for conflicting autoloaders. | |
| 89 | + $hook_manager->add_action( 'plugins_loaded', array( $guard, 'check_for_conflicting_autoloaders' ), 1 ); | |
| 87 | 90 | |
| 88 | 91 | // phpcs:enable Generic.Commenting.DocComment.MissingShort |
| 89 | 92 | } |
| 90 | 93 | } |