| @@ -58,8 +58,12 @@ | ||
| 58 | 58 | $this->add_action( 'mainwp_extension_testextensionapilogin', array( &$this, 'test_extensions_api_login' ) ); |
| 59 | 59 | |
| 60 | 60 | $this->add_action( 'mainwp_extension_plugin_action', array( &$this, 'ajax_extension_plugin_action' ) ); |
| 61 | 61 | |
| 62 | + if ( \mainwp_current_user_can( 'dashboard', 'manage_extensions' ) ) { | |
| 63 | + $this->add_action( 'mainwp_extension_update_check_retry', array( &$this, 'retry_extension_update_check' ) ); | |
| 64 | + } | |
| 65 | + | |
| 62 | 66 | if ( \mainwp_current_user_can( 'dashboard', 'bulk_install_and_activate_extensions' ) ) { |
| 63 | 67 | $this->add_action( 'mainwp_extension_grabapikey', array( &$this, 'grab_extension_api_key' ) ); |
| 64 | 68 | $this->add_action( 'mainwp_extension_saveextensionapilogin', array( &$this, 'save_extensions_api_login' ) ); |
| 65 | 69 | $this->add_action( 'mainwp_extension_getpurchased', array( MainWP_Extensions::get_class_name(), 'ajax_get_purchased_extensions' ) ); |
| @@ -69,8 +73,25 @@ | ||
| 69 | 73 | } |
| 70 | 74 | |
| 71 | 75 | // Page: ManageSites. |
| 72 | 76 | $this->add_action( 'mainwp_ext_applypluginsettings', array( &$this, 'mainwp_ext_applypluginsettings' ) ); |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Retry Add-on update checks. | |
| 81 | + */ | |
| 82 | + public function retry_extension_update_check() { | |
| 83 | + $this->check_security( 'mainwp_extension_update_check_retry' ); | |
| 84 | + | |
| 85 | + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_extensions' ) ) { | |
| 86 | + wp_send_json( array( 'error' => esc_html__( 'You are not allowed to manage Add-ons.', 'mainwp' ) ) ); | |
| 87 | + } | |
| 88 | + | |
| 89 | + if ( MainWP_System_Handler::instance()->retry_extension_update_check() ) { | |
| 90 | + wp_send_json( array( 'result' => 'SUCCESS' ) ); | |
| 91 | + } | |
| 92 | + | |
| 93 | + wp_send_json( array( 'error' => esc_html__( 'The update check is still failing. Make sure your MainWP Dashboard can connect to mainwp.com, then try again.', 'mainwp' ) ) ); | |
| 73 | 94 | } |
| 74 | 95 | |
| 75 | 96 | /** |
| 76 | 97 | * Apply plugin settings. |