Skip to content

Commit

Permalink
Merge pull request #3 from boxuk/update-deprecated-function
Browse files Browse the repository at this point in the history
[REFACTOR] Upgrade deprecated function.
  • Loading branch information
Ian Jenkins authored Mar 23, 2021
2 parents d58d875 + 261d03c commit 0642024
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@ jobs:
- stage: lint
script:
- composer lint
env: BUILD=lint
- stage: sniff
script:
- composer phpcs
env: BUILD=sniff
env: BUILD=lint
- stage: test
php: 5.6
env:
- WP_VERSION=latest
- stage: test
php: 7.4
env: WP_VERSION=latest
# Allow PHPCS failures until we've updated everything to adhere to WP standards.
allow_failures:
- env: BUILD=sniff
18 changes: 9 additions & 9 deletions php/regions/class-network-sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function impose( $key, $value ) {
}
}

switch_to_blog( $site['blog_id'] );
switch_to_blog( $site->blog_id );
foreach ( $value as $field => $single_value ) {

switch ( $field ) {
Expand Down Expand Up @@ -145,13 +145,13 @@ public function impose( $key, $value ) {
continue;
}

add_user_to_blog( $site['blog_id'], $user->ID, $role );
add_user_to_blog( $site->blog_id, $user->ID, $role );
}

break;

case 'WPLANG':
add_network_option( $site['blog_id'], $field, $single_value );
add_network_option( $site->blog_id, $field, $single_value );
break;

default:
Expand Down Expand Up @@ -188,7 +188,7 @@ protected function get_sites() {
}
do {

$sites_results = wp_get_sites( $args );
$sites_results = get_sites( $args );
$sites = array_merge( $sites, $sites_results );

$args['offset'] += $args['limit'];
Expand All @@ -198,9 +198,9 @@ protected function get_sites() {
$this->sites = array();
foreach ( $sites as $site ) {
if ( is_subdomain_install() ) {
$site_slug = str_replace( '.' . get_current_site()->domain, '', $site['domain'] );
$site_slug = str_replace( '.' . get_current_site()->domain, '', $site->domain );
} else {
$site_slug = trim( $site['path'], '/' );
$site_slug = trim( $site->path, '/' );
}
$this->sites[ $site_slug ] = $site;
}
Expand All @@ -218,7 +218,7 @@ protected function get_site_value( $key ) {
$site_slug = $this->current_schema_attribute_parents[0];
$site = $this->get_site( $site_slug );

switch_to_blog( $site['blog_id'] );
switch_to_blog( $site->blog_id );

switch ( $key ) {

Expand Down Expand Up @@ -247,7 +247,7 @@ protected function get_site_value( $key ) {
break;

case 'WPLANG':
$value = get_network_option( $site['blog_id'], $key );
$value = get_network_option( $site->blog_id, $key );
break;

default:
Expand Down Expand Up @@ -296,7 +296,7 @@ protected function get_site_difference( $site_slug, $site_data ) {
* Get a site by its slug
*
* @param string $site_slug Site slug.
* @return array|false
* @return WP_Site|false
*/
protected function get_site( $site_slug ) {

Expand Down

0 comments on commit 0642024

Please sign in to comment.