PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Services/PluginInstaller/BackgroundInstaller.php +4 -3 1.5.4 → 1.6.5 View file →
@@ -38,15 +38,16 @@
38 38 $upgrader = new \WP_Upgrader($skin);
39 39 $installed_plugins = array_keys(\get_plugins());
40 40 $plugin_slug = $plugin_to_install['repo-slug'];
41 41 $plugin_file = isset($plugin_to_install['file']) ? $plugin_to_install['file'] : $plugin_slug . '.php';
42 + $plugin_basename = $plugin_slug . '/' . $plugin_file;
42 43 $installed = false;
43 44 $activate = false;
44 45
45 46 // See if the plugin is installed already.
46 - if (isset($installed_plugins[$plugin_file])) {
47 + if (in_array($plugin_basename, $installed_plugins, true)) {
47 48 $installed = true;
48 - $activate = !is_plugin_active($installed_plugins[$plugin_file]);
49 + $activate = !is_plugin_active($plugin_basename);
49 50 }
50 51
51 52 // Install this thing!
52 53 if (!$installed) {
@@ -125,9 +126,9 @@
125 126
126 127 // Activate this thing.
127 128 if ($activate) {
128 129 try {
129 - $result = activate_plugin($installed ? $installed_plugins[$plugin_file] : $plugin_slug . '/' . $plugin_file);
130 + $result = activate_plugin($plugin_basename);
130 131
131 132 if (is_wp_error($result)) {
132 133 throw new \Exception(esc_html($result->get_error_message()));
133 134 }