| @@ -9,9 +9,15 @@ | ||
| 9 | 9 | |
| 10 | 10 | use ContentControl\Base\Container; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * Undocumented class | |
| 13 | + * Upgrader class. | |
| 14 | + * | |
| 15 | + * NOTE: For wordpress.org admins: This is only used if: | |
| 16 | + * - The user explicitly entered a license key. | |
| 17 | + * - They further opened a window to our site allowing the user to authorize the connection & installation of the pro upgrade. | |
| 18 | + * | |
| 19 | + * @package ContentControl | |
| 14 | 20 | */ |
| 15 | 21 | class Upgrader { |
| 16 | 22 | |
| 17 | 23 | /** |
| @@ -53,11 +59,13 @@ | ||
| 53 | 59 | * Here to prevent constant conditional checks for the debug mode. |
| 54 | 60 | * |
| 55 | 61 | * @param string $message Message. |
| 56 | 62 | * @param string $type Type. |
| 63 | + * | |
| 64 | + * @return void | |
| 57 | 65 | */ |
| 58 | 66 | public function debug_log( $message, $type = 'INFO' ) { |
| 59 | - if ( defined( 'CONTENT_CONTROL_LOGGING' ) && CONTENT_CONTROL_LOGGING ) { | |
| 67 | + if ( defined( 'CONTENT_CONTROL_UPGRADE_DEBUG_LOGGING' ) && CONTENT_CONTROL_UPGRADE_DEBUG_LOGGING ) { | |
| 60 | 68 | $this->c->get( 'logging' )->log( "Plugin\Upgrader.$type: $message" ); |
| 61 | 69 | } |
| 62 | 70 | } |
| 63 | 71 | |
| @@ -63,9 +71,9 @@ | ||
| 63 | 71 | |
| 64 | 72 | /** |
| 65 | 73 | * Get credentials for the current request. |
| 66 | 74 | * |
| 67 | - * @return array|bool | |
| 75 | + * @return bool | |
| 68 | 76 | */ |
| 69 | 77 | public function get_fs_creds() { |
| 70 | 78 | // Prepare variables. |
| 71 | 79 | $url = esc_url_raw( |
| @@ -77,9 +85,9 @@ | ||
| 77 | 85 | admin_url( 'options-general.php' ) |
| 78 | 86 | ) |
| 79 | 87 | ); |
| 80 | 88 | |
| 81 | - $creds = request_filesystem_credentials( $url, '', false, false, null ); | |
| 89 | + $creds = request_filesystem_credentials( $url, '', false, '', null ); | |
| 82 | 90 | |
| 83 | 91 | if ( false === $creds || ! WP_Filesystem( $creds ) ) { |
| 84 | 92 | $this->debug_log( 'Unable to get filesystem credentials.', 'ERROR' ); |
| 85 | 93 | return false; |
| @@ -84,9 +92,9 @@ | ||
| 84 | 92 | $this->debug_log( 'Unable to get filesystem credentials.', 'ERROR' ); |
| 85 | 93 | return false; |
| 86 | 94 | } |
| 87 | 95 | |
| 88 | - return $creds; | |
| 96 | + return (bool) $creds; | |
| 89 | 97 | } |
| 90 | 98 | |
| 91 | 99 | /** |
| 92 | 100 | * Activate a plugin. |
| @@ -94,9 +102,9 @@ | ||
| 94 | 102 | * @param string $plugin_basename The plugin basename. |
| 95 | 103 | * @return bool|\WP_Error |
| 96 | 104 | */ |
| 97 | 105 | public function activate_plugin( $plugin_basename ) { |
| 98 | - if ( ! $plugin_basename || empty( $plugin_basename ) ) { | |
| 106 | + if ( empty( $plugin_basename ) ) { | |
| 99 | 107 | return new \WP_Error( 'content_control_plugin_basename', __( 'Plugin basename empty.', 'content-control' ) ); |
| 100 | 108 | } |
| 101 | 109 | |
| 102 | 110 | // Activate the plugin silently. |