| @@ -6,8 +6,13 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace MainWP\Dashboard; |
| 9 | 9 | |
| 10 | +// Exit if accessed directly. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | + | |
| 10 | 15 | /** |
| 11 | 16 | * Class MainWP_Actions_Handler |
| 12 | 17 | */ |
| 13 | 18 | class MainWP_Actions_Handler { //phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. |
| @@ -65,10 +70,11 @@ | ||
| 65 | 70 | * @param mixed $output result. |
| 66 | 71 | * @param string $type action type. |
| 67 | 72 | * @param mixed $post_data post data (option). |
| 68 | 73 | * @param bool $upload true|false: install by upload (option). |
| 74 | + * @param bool $is_auto_update true|false: is auto update (option). | |
| 69 | 75 | */ |
| 70 | - public function do_action_mainwp_install_actions( $websites, $pAction, $output, $type, $post_data = array(), $upload = false ) { | |
| 76 | + public function do_action_mainwp_install_actions( $websites, $pAction, $output, $type, $post_data = array(), $upload = false, $is_auto_update = false ) { | |
| 71 | 77 | |
| 72 | 78 | if ( ! in_array( $pAction, array( 'install', 'updated' ), true ) ) { |
| 73 | 79 | return; |
| 74 | 80 | } |
| @@ -90,14 +96,18 @@ | ||
| 90 | 96 | $data['install_items'] = $output->other_data[ $website->id ]['install_items']; |
| 91 | 97 | } |
| 92 | 98 | } |
| 93 | 99 | |
| 100 | + if ( 'updated' === $pAction && $is_auto_update ) { | |
| 101 | + MainWP_Updates_Report_Manager::save_update_info( $website, $data, $type ); | |
| 102 | + } | |
| 103 | + | |
| 94 | 104 | /** |
| 95 | 105 | * Fires immediately after install action. |
| 96 | 106 | * |
| 97 | 107 | * @since 4.5.1.1 |
| 98 | 108 | */ |
| 99 | - do_action( 'mainwp_install_update_actions', $website, $pAction, $data, $type, $post_data, $upload ); | |
| 109 | + do_action( 'mainwp_install_update_actions', $website, $pAction, $data, $type, $post_data, $upload, $is_auto_update ); | |
| 100 | 110 | } |
| 101 | 111 | |
| 102 | 112 | /** |
| 103 | 113 | * |
| @@ -110,11 +120,19 @@ | ||
| 110 | 120 | * @param array $others others input array. |
| 111 | 121 | * |
| 112 | 122 | * @since 4.5.1.1 |
| 113 | 123 | */ |
| 114 | - public function hook_mainwp_fetch_url_authed( $website, $information, $action, $params, $others ) { | |
| 124 | + public function hook_mainwp_fetch_url_authed( $website, $information, $action, $params, $others ) { // phpcs:ignore -- NOSONAR -complex method. | |
| 115 | 125 | if ( 'plugin_action' === $action ) { |
| 116 | 126 | $plugin_act = isset( $params['action'] ) ? $params['action'] : ''; |
| 127 | + | |
| 128 | + if ( 'delete' === $plugin_act && ! empty( $information['other_data']['duration_bulk'] ) ) { | |
| 129 | + $params['duration_bulk'] = $information['other_data']['duration_bulk']; | |
| 130 | + } | |
| 131 | + | |
| 132 | + if ( 'delete' === $plugin_act && ! empty( $information['other_data']['plugin_deactivated_data'] ) ) { | |
| 133 | + do_action( 'mainwp_install_plugin_action', $website, 'deactivate', $params, $information['other_data']['plugin_deactivated_data'], $others ); | |
| 134 | + } | |
| 117 | 135 | if ( in_array( $plugin_act, array( 'activate', 'deactivate', 'delete' ) ) && isset( $information['other_data']['plugin_action_data'] ) ) { |
| 118 | 136 | do_action( 'mainwp_install_plugin_action', $website, $plugin_act, $params, $information['other_data']['plugin_action_data'], $others ); |
| 119 | 137 | } |
| 120 | 138 | } elseif ( 'theme_action' === $action ) { |