PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.3
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.3
6.3 6.2.3 6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 All 157 releases
← All changes | includes/rest-api/controller/version1/class-mainwp-rest-api-v1.php +6 -18 6.1 → 6.2.3 View file →
@@ -123,22 +123,9 @@
123 123 *
124 124 * Check if enable the REST API.
125 125 */
126 126 private function enabled_rest_v1_api() {
127 -
128 - $all_keys = get_option( 'mainwp_rest_api_keys', false );
129 -
130 - if ( ! is_array( $all_keys ) ) {
131 - return false;
132 - }
133 -
134 - foreach ( $all_keys as $item ) {
135 - if ( ! empty( $item['cs'] ) && ! empty( $item['enabled'] ) ) {
136 - return true; // one key enabled, enabled the REST API.
137 - }
138 - }
139 -
140 - return false; // all keys disabled.
127 + return get_option( 'mainwp_rest_api_keys', true ); // enabled the REST API if there is any key.
141 128 }
142 129
143 130 /**
144 131 * Method enabled_rest_v2_api()
@@ -145,9 +132,9 @@
145 132 *
146 133 * Enabled the REST API.
147 134 */
148 135 private function enabled_rest_v2_api() {
149 - return MainWP_DB::instance()->is_existed_enabled_rest_key();
136 + return true; // enabled the REST API if there is any key.
150 137 }
151 138
152 139 /**
153 140 * Method hook_rest_api_enabled()
@@ -1277,11 +1264,12 @@
1277 1264 return $valid;
1278 1265 }
1279 1266
1280 1267 if ( true === $valid ) {
1281 - $data = array();
1282 - $params['extra_view'] = array( 'health_site_status' );
1283 - $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );
1268 + $data = array();
1269 + // Pass extra_view positionally (8th arg) so health_site_status is actually
1270 + // fetched; a $params['extra_view'] local never reaches this query.
1271 + $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'health_site_status' ) ) );
1284 1272 while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) {
1285 1273 $health_status = isset( $website->health_site_status ) ? json_decode( $website->health_site_status, true ) : array();
1286 1274 $hstatus = MainWP_Utility::get_site_health( $health_status );
1287 1275 $hval = $hstatus['val'];