PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | json-endpoints/jetpack/class.jetpack-json-api-plugins-install-endpoint.php +8 -0 13.6.2 → 16.3-a.7 View file →
@@ -1,8 +1,12 @@
1 1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 2
3 3 use Automattic\Jetpack\Plugins_Installer;
4 4
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit( 0 );
7 +}
8 +
5 9 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
6 10 require_once ABSPATH . 'wp-admin/includes/file.php';
7 11 // POST /sites/%s/plugins/%s/install
8 12 new Jetpack_JSON_API_Plugins_Install_Endpoint(
@@ -55,8 +59,10 @@
55 59 /**
56 60 * Plugins install enedpoint class.
57 61 *
58 62 * POST /sites/%s/plugins/%s/install
63 + *
64 + * @phan-constructor-used-for-side-effects
59 65 */
60 66 class Jetpack_JSON_API_Plugins_Install_Endpoint extends Jetpack_JSON_API_Plugins_Endpoint {
61 67
62 68 /**
@@ -98,8 +104,10 @@
98 104 return $result;
99 105 }
100 106
101 107 // No errors, install worked. Now replace the slug with the actual plugin id
108 + // @todo This code looks a bit suspect; why do we loop through plugins and only look at the last one?
109 + // @phan-suppress-next-line PhanPossiblyUndeclaredVariable -- we return early if there is an issue; otherwise $index and $slug are set in the foreach loop
102 110 $this->plugins[ $index ] = Plugins_Installer::get_plugin_id_by_slug( $slug );
103 111
104 112 return true;
105 113 }