PluginProbe
Moloni / trunk
Moloni vtrunk
5.0.10 5.0.09 5.0.08 5.0.07 5.0.06 trunk 0.4.0.00 0.4.8.1 3.0.10 3.0.11 3.0.35 3.0.36 3.0.37 3.0.38 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.0.46 3.0.47 3.0.48 3.0.49 3.0.50 All 98 releases
moloni / src / Hooks / UpgradeProcess.php

UpgradeProcess.php in Moloni trunk, at src/Hooks/UpgradeProcess.php

45 lines 1019 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Moloni\Hooks;
4
5 use Moloni\Activators\Updater;
6 use Moloni\Plugin;
7
8 class UpgradeProcess {
9 public $parent;
10
11 /**
12 * Constructor
13 *
14 * @param Plugin $parent
15 */
16 public function __construct($parent)
17 {
18 $this->parent = $parent;
19 add_action('upgrader_process_complete', [$this, 'upgradeProcessComplete'], 10, 2);
20 }
21
22 /**
23 * Some action performed just after Moloni plugin is updated
24 *
25 * @param $upgrader_object
26 * @param $options
27 *
28 * @return void
29 */
30 public function upgradeProcessComplete($upgrader_object, $options)
31 {
32 $ourAwesomePlugin = plugin_basename(MOLONI_PLUGIN_FILE);
33
34 if ($options['action'] === 'update' && $options['type'] === 'plugin' && isset($options['plugins'])) {
35 foreach ($options['plugins'] as $plugin) {
36 if ($plugin === $ourAwesomePlugin) {
37 new Updater();
38
39 break;
40 }
41 }
42 }
43 }
44 }
45