← All changes
|
app/Shared/Services/PluginDependencies/PluginInstaller.php
+10
-0
3.0.5
→
trunk
View file →
| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | namespace Extendify\Shared\Services\PluginDependencies; |
| 8 | 8 | |
| 9 | 9 | defined('ABSPATH') || die('No direct access.'); |
| 10 | 10 | |
| 11 | +use Extendify\Shared\Services\AutoUpdate\AutoUpdate; | |
| 12 | + | |
| 11 | 13 | /** |
| 12 | 14 | * Install plugins programmatically. |
| 13 | 15 | */ |
| 14 | 16 | |
| @@ -40,13 +42,21 @@ | ||
| 40 | 42 | ], |
| 41 | 43 | ] |
| 42 | 44 | ); |
| 43 | 45 | |
| 46 | + if (is_wp_error($api)) { | |
| 47 | + return $api; | |
| 48 | + } | |
| 49 | + | |
| 44 | 50 | $skin = new \WP_Ajax_Upgrader_Skin(); |
| 45 | 51 | $upgrader = new \Plugin_Upgrader($skin); |
| 46 | 52 | |
| 47 | 53 | $upgrader->install($api->download_link); |
| 48 | 54 | $file = $upgrader->plugin_info(); |
| 55 | + | |
| 56 | + if (AutoUpdate::isEnabled()) { | |
| 57 | + AutoUpdate::enableAutoUpdateForPlugin($file); | |
| 58 | + } | |
| 49 | 59 | |
| 50 | 60 | // Install the language pack if available. |
| 51 | 61 | $currentLocale = get_locale(); |
| 52 | 62 | foreach ($api->language_packs as $pack) { |