PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.4.0-beta2
Secure Custom Fields v6.4.0-beta2
6.9.5 6.9.4 6.9.3 6.9.2 6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / ajax / class-acf-ajax-upgrade.php
secure-custom-fields / includes / ajax Last commit date
class-acf-ajax-check-screen.php 1 year ago class-acf-ajax-local-json-diff.php 1 year ago class-acf-ajax-query-users.php 1 year ago class-acf-ajax-query.php 1 year ago class-acf-ajax-upgrade.php 1 year ago class-acf-ajax-user-setting.php 1 year ago class-acf-ajax.php 1 year ago index.php 1 year ago
class-acf-ajax-upgrade.php
57 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Ajax_Upgrade' ) ) :
8
9 class ACF_Ajax_Upgrade extends ACF_Ajax {
10
11 /** @var string The AJAX action name */
12 var $action = 'acf/ajax/upgrade';
13
14 /**
15 * Returns the response data to sent back.
16 *
17 * @since 5.7.2
18 *
19 * @param array $request The request args.
20 * @return boolean|WP_Error True if successful, or WP_Error on failure.
21 */
22 public function get_response( $request ) {
23 if ( ! current_user_can( acf_get_setting( 'capability' ) ) ) {
24 return new WP_Error( 'upgrade_error', __( 'Sorry, you do not have permission to do that.', 'acf' ) );
25 }
26
27 // Switch blog.
28 if ( isset( $request['blog_id'] ) ) {
29 switch_to_blog( $request['blog_id'] );
30 }
31
32 // Bail early if no upgrade avaiable.
33 if ( ! acf_has_upgrade() ) {
34 return new WP_Error( 'upgrade_error', __( 'No updates available.', 'acf' ) );
35 }
36
37 // Listen for output.
38 ob_start();
39
40 // Run upgrades.
41 acf_upgrade_all();
42
43 // Store output.
44 $error = ob_get_clean();
45
46 // Return error or success.
47 if ( $error ) {
48 return new WP_Error( 'upgrade_error', $error );
49 }
50
51 return true;
52 }
53 }
54
55 acf_new_instance( 'ACF_Ajax_Upgrade' );
56 endif; // class_exists check
57