PluginProbe
Authorizer / 3.3.2
Authorizer v3.3.2
3.16.0 3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 All 127 releases
← All changes | src/authorizer/class-updates.php +134 -3 2.9.1 → 3.3.2 View file →
@@ -14,9 +14,9 @@
14 14
15 15 /**
16 16 * Run any database migrations or plugin updates when installing a new version.
17 17 */
18 -class Updates extends Static_Instance {
18 +class Updates extends Singleton {
19 19
20 20 /**
21 21 * Plugin Update Routines.
22 22 *
@@ -314,15 +314,146 @@
314 314 $auth_version = $update_if_older_than;
315 315 $needs_updating = true;
316 316 }
317 317
318 + // Update: Set default value for newly added option advanced_disable_wp_login.
319 + $update_if_older_than = 20200331;
320 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
321 + // Provide default values for any $auth_settings options that don't exist.
322 + if ( is_multisite() ) {
323 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
324 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
325 + foreach ( $sites as $site ) {
326 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
327 + switch_to_blog( $blog_id );
328 + $options->set_default_options();
329 + restore_current_blog();
330 + }
331 + } else {
332 + $options->set_default_options();
333 + }
334 + // Update version to reflect this change has been made.
335 + $auth_version = $update_if_older_than;
336 + $needs_updating = true;
337 + }
338 +
339 + // Update: Set default values for newly added oauth2 options.
340 + $update_if_older_than = 20201217;
341 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
342 + // Provide default values for any $auth_settings options that don't exist.
343 + if ( is_multisite() ) {
344 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
345 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
346 + foreach ( $sites as $site ) {
347 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
348 + switch_to_blog( $blog_id );
349 + $options->set_default_options();
350 + restore_current_blog();
351 + }
352 + } else {
353 + $options->set_default_options();
354 + }
355 + // Update version to reflect this change has been made.
356 + $auth_version = $update_if_older_than;
357 + $needs_updating = true;
358 + }
359 +
360 + // Update: Set default values for newly added oauth2_hosteddomain option.
361 + $update_if_older_than = 20210624;
362 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
363 + // Provide default values for any $auth_settings options that don't exist.
364 + if ( is_multisite() ) {
365 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
366 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
367 + foreach ( $sites as $site ) {
368 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
369 + switch_to_blog( $blog_id );
370 + $options->set_default_options();
371 + restore_current_blog();
372 + }
373 + } else {
374 + $options->set_default_options();
375 + }
376 + // Update version to reflect this change has been made.
377 + $auth_version = $update_if_older_than;
378 + $needs_updating = true;
379 + }
380 +
381 + // Update: Set default values for newly added ldap_search_filter option.
382 + $update_if_older_than = 20210924;
383 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
384 + // Provide default values for any $auth_settings options that don't exist.
385 + if ( is_multisite() ) {
386 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
387 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
388 + foreach ( $sites as $site ) {
389 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
390 + switch_to_blog( $blog_id );
391 + $options->set_default_options();
392 + restore_current_blog();
393 + }
394 + } else {
395 + $options->set_default_options();
396 + }
397 + // Update version to reflect this change has been made.
398 + $auth_version = $update_if_older_than;
399 + $needs_updating = true;
400 + }
401 +
402 + // Update: Set default values for newly added ldap_test_user option.
403 + $update_if_older_than = 20220222;
404 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
405 + // Provide default values for any $auth_settings options that don't exist.
406 + if ( is_multisite() ) {
407 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
408 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
409 + foreach ( $sites as $site ) {
410 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
411 + switch_to_blog( $blog_id );
412 + $options->set_default_options();
413 + restore_current_blog();
414 + }
415 + } else {
416 + $options->set_default_options();
417 + }
418 + // Update version to reflect this change has been made.
419 + $auth_version = $update_if_older_than;
420 + $needs_updating = true;
421 + }
422 +
423 + // Update: Remove any cached LDAP test password.
424 + $update_if_older_than = 20220426;
425 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
426 + if ( is_multisite() ) {
427 + // phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound
428 + $sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites( array( 'limit' => PHP_INT_MAX ) );
429 + foreach ( $sites as $site ) {
430 + $blog_id = function_exists( 'get_sites' ) ? $site->blog_id : $site['blog_id'];
431 + $auth_settings = get_blog_option( $blog_id, 'auth_settings', array() );
432 + if ( array_key_exists( 'ldap_test_pass', $auth_settings ) && strlen( $auth_settings['ldap_test_pass'] ) > 0 ) {
433 + unset( $auth_settings['ldap_test_pass'] );
434 + update_blog_option( $blog_id, 'auth_settings', $auth_settings );
435 + }
436 + }
437 + } else {
438 + $auth_settings = get_option( 'auth_settings', array() );
439 + if ( array_key_exists( 'ldap_test_pass', $auth_settings ) && strlen( $auth_settings['ldap_test_pass'] ) > 0 ) {
440 + unset( $auth_settings['ldap_test_pass'] );
441 + update_option( 'auth_settings', $auth_settings );
442 + }
443 + }
444 + // Update version to reflect this change has been made.
445 + $auth_version = $update_if_older_than;
446 + $needs_updating = true;
447 + }
448 +
318 449 /* phpcs:ignore Squiz.PHP.CommentedOutCode.Found
319 450 // Update: TEMPLATE
320 451 $update_if_older_than = YYYYMMDD;
321 - if ( $auth_version === false || intval( $auth_version ) < $update_if_older_than ) {
452 + if ( false === $auth_version || intval( $auth_version ) < $update_if_older_than ) {
322 453 ////// PLACE UPDATE CODE HERE
323 454 // Update version to reflect this change has been made.
324 - $auth_version = $update_if_older_than;
455 + $auth_version = $update_if_older_than;
325 456 $needs_updating = true;
326 457 }
327 458 */
328 459