helpers->scheduleSingleAction( aioseo()->importExport->yoastSeo->userActionName, 30 ); if ( ! aioseo()->cache->get( 'import_user_meta_yoast_seo' ) ) { aioseo()->cache->update( 'import_user_meta_yoast_seo', 0, WEEK_IN_SECONDS ); } } /** * Imports the post meta. * * @since 4.0.0 * * @return void */ public function importUserMeta() { $usersPerAction = 100; $offset = aioseo()->cache->get( 'import_user_meta_yoast_seo' ); $usersMeta = aioseo()->db ->start( 'usermeta' . ' as um' ) ->whereRaw( "um.meta_key IN ('facebook', 'twitter')" ) ->whereRaw( "um.meta_value != ''" ) ->limit( $offset . ',' . $usersPerAction ) ->run() ->result(); if ( ! $usersMeta || ! count( $usersMeta ) ) { aioseo()->cache->delete( 'import_user_meta_yoast_seo' ); return; } foreach ( $usersMeta as $meta ) { update_user_meta( $meta->user_id, 'aioseo_' . $meta->meta_key, $meta->meta_value ); } if ( count( $usersMeta ) === $usersPerAction ) { aioseo()->cache->update( 'import_user_meta_yoast_seo', 100 + $offset, WEEK_IN_SECONDS ); aioseo()->helpers->scheduleSingleAction( aioseo()->importExport->yoastSeo->userActionName, 5 ); } else { aioseo()->cache->delete( 'import_user_meta_yoast_seo' ); } } }