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0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / vendor / jetpack-autoloader / class-plugins-handler.php
woocommerce / vendor / jetpack-autoloader Last commit date
class-autoloader-handler.php 3 years ago class-autoloader-locator.php 3 years ago class-autoloader.php 3 years ago class-container.php 3 years ago class-hook-manager.php 3 years ago class-latest-autoloader-guard.php 3 years ago class-manifest-reader.php 3 years ago class-path-processor.php 3 years ago class-php-autoloader.php 3 years ago class-plugin-locator.php 3 years ago class-plugins-handler.php 3 years ago class-shutdown-handler.php 3 years ago class-version-loader.php 3 years ago class-version-selector.php 3 years ago
class-plugins-handler.php
165 lines
1 <?php
2 /**
3 * This file was automatically generated by automattic/jetpack-autoloader.
4 *
5 * @package automattic/jetpack-autoloader
6 */
7
8 namespace Automattic\Jetpack\Autoloader\jp31a008e22f3962af836869a59e9bf18c;
9
10 // phpcs:ignore
11
12 /**
13 * This class handles locating and caching all of the active plugins.
14 */
15 class Plugins_Handler {
16 /**
17 * The transient key for plugin paths.
18 */
19 const TRANSIENT_KEY = 'jetpack_autoloader_plugin_paths';
20
21 /**
22 * The locator for finding plugins in different locations.
23 *
24 * @var Plugin_Locator
25 */
26 private $plugin_locator;
27
28 /**
29 * The processor for transforming cached paths.
30 *
31 * @var Path_Processor
32 */
33 private $path_processor;
34
35 /**
36 * The constructor.
37 *
38 * @param Plugin_Locator $plugin_locator The locator for finding active plugins.
39 * @param Path_Processor $path_processor The processor for transforming cached paths.
40 */
41 public function __construct( $plugin_locator, $path_processor ) {
42 $this->plugin_locator = $plugin_locator;
43 $this->path_processor = $path_processor;
44 }
45
46 /**
47 * Gets all of the active plugins we can find.
48 *
49 * @param bool $include_deactivating When true, plugins deactivating this request will be considered active.
50 * @param bool $record_unknown When true, the current plugin will be marked as active and recorded when unknown.
51 *
52 * @return string[]
53 */
54 public function get_active_plugins( $include_deactivating, $record_unknown ) {
55 global $jetpack_autoloader_activating_plugins_paths;
56
57 // We're going to build a unique list of plugins from a few different sources
58 // to find all of our "active" plugins. While we need to return an integer
59 // array, we're going to use an associative array internally to reduce
60 // the amount of time that we're going to spend checking uniqueness
61 // and merging different arrays together to form the output.
62 $active_plugins = array();
63
64 // Make sure that plugins which have activated this request are considered as "active" even though
65 // they probably won't be present in any option.
66 if ( is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
67 foreach ( $jetpack_autoloader_activating_plugins_paths as $path ) {
68 $active_plugins[ $path ] = $path;
69 }
70 }
71
72 // This option contains all of the plugins that have been activated.
73 $plugins = $this->plugin_locator->find_using_option( 'active_plugins' );
74 foreach ( $plugins as $path ) {
75 $active_plugins[ $path ] = $path;
76 }
77
78 // This option contains all of the multisite plugins that have been activated.
79 if ( is_multisite() ) {
80 $plugins = $this->plugin_locator->find_using_option( 'active_sitewide_plugins', true );
81 foreach ( $plugins as $path ) {
82 $active_plugins[ $path ] = $path;
83 }
84 }
85
86 // These actions contain plugins that are being activated/deactivated during this request.
87 $plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
88 foreach ( $plugins as $path ) {
89 $active_plugins[ $path ] = $path;
90 }
91
92 // When the current plugin isn't considered "active" there's a problem.
93 // Since we're here, the plugin is active and currently being loaded.
94 // We can support this case (mu-plugins and non-standard activation)
95 // by adding the current plugin to the active list and marking it
96 // as an unknown (activating) plugin. This also has the benefit
97 // of causing a reset because the active plugins list has
98 // been changed since it was saved in the global.
99 $current_plugin = $this->plugin_locator->find_current_plugin();
100 if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
101 $active_plugins[ $current_plugin ] = $current_plugin;
102 $jetpack_autoloader_activating_plugins_paths[] = $current_plugin;
103 }
104
105 // When deactivating plugins aren't desired we should entirely remove them from the active list.
106 if ( ! $include_deactivating ) {
107 // These actions contain plugins that are being deactivated during this request.
108 $plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
109 foreach ( $plugins as $path ) {
110 unset( $active_plugins[ $path ] );
111 }
112 }
113
114 // Transform the array so that we don't have to worry about the keys interacting with other array types later.
115 return array_values( $active_plugins );
116 }
117
118 /**
119 * Gets all of the cached plugins if there are any.
120 *
121 * @return string[]
122 */
123 public function get_cached_plugins() {
124 $cached = get_transient( self::TRANSIENT_KEY );
125 if ( ! is_array( $cached ) || empty( $cached ) ) {
126 return array();
127 }
128
129 // We need to expand the tokens to an absolute path for this webserver.
130 return array_map( array( $this->path_processor, 'untokenize_path_constants' ), $cached );
131 }
132
133 /**
134 * Saves the plugin list to the cache.
135 *
136 * @param array $plugins The plugin list to save to the cache.
137 */
138 public function cache_plugins( $plugins ) {
139 // We store the paths in a tokenized form so that that webservers with different absolute paths don't break.
140 $plugins = array_map( array( $this->path_processor, 'tokenize_path_constants' ), $plugins );
141
142 set_transient( self::TRANSIENT_KEY, $plugins );
143 }
144
145 /**
146 * Checks to see whether or not the plugin list given has changed when compared to the
147 * shared `$jetpack_autoloader_cached_plugin_paths` global. This allows us to deal
148 * with cases where the active list may change due to filtering..
149 *
150 * @param string[] $plugins The plugins list to check against the global cache.
151 *
152 * @return bool True if the plugins have changed, otherwise false.
153 */
154 public function have_plugins_changed( $plugins ) {
155 global $jetpack_autoloader_cached_plugin_paths;
156
157 if ( $jetpack_autoloader_cached_plugin_paths !== $plugins ) {
158 $jetpack_autoloader_cached_plugin_paths = $plugins;
159 return true;
160 }
161
162 return false;
163 }
164 }
165