WordPress.org

Making WordPress.org

Changeset 9091


Ignore:
Timestamp:
08/05/2019 07:10:11 PM (7 weeks ago)
Author:
coreymckrill
Message:

Official WordPress Events: Update source of Meetup_Client class

The WordCamp codebase has moved to GitHub, and the files in meta.svn are no
longer maintained (and will eventually be removed). There are some potential
pitfalls during deployment with using GitHub's svn bridge for svn externals,
so it has been decided to maintain a separate version of the Meetup_Client
instead. This also adds a helper method for loading required files and
instantiating the client class, since it needs to happen in multiple places
in this plugin.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events

    • Property svn:externals
      •  

        old new  
        1 class-meetup-client.php         https://meta.svn.wordpress.org/sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/utilities/class-meetup-client.php
         1
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php

    r8555 r9091  
    5050            wp_schedule_event( time(), 'hourly', 'owpe_mark_deleted_meetups' );
    5151        }
     52    }
     53
     54    /**
     55     * Get an instance of the Meetup Client, loading files first as necessary.
     56     *
     57     * @return Meetup_Client
     58     */
     59    protected function get_meetup_client() {
     60        if ( ! class_exists( '\WordCamp\Utilities\Meetup_Client' ) ) {
     61            $files = array(
     62                'class-meetup-client.php',
     63            );
     64
     65            foreach ( $files as $file ) {
     66                require_once trailingslashit( __DIR__ ) . "meetup/$file";
     67            }
     68        }
     69
     70        return new Meetup_Client();
    5271    }
    5372
     
    320339        $events = array();
    321340
    322         require_once( __DIR__ . '/class-meetup-client.php' );
    323 
    324         $client = new Meetup_Client();
     341        $client = $this->get_meetup_client();
    325342        if ( ! empty( $client->error->errors ) ) {
    326343            $this->log( 'Failed to instantiate meetup client: ' . wp_json_encode( $client->error ), true );
     
    521538        }
    522539
    523         require_once( __DIR__ . '/class-meetup-client.php' );
    524         $meetup_client = new Meetup_Client();
     540        $meetup_client = $this->get_meetup_client();
    525541
    526542        if ( ! empty( $meetup_client->error->errors ) ) {
Note: See TracChangeset for help on using the changeset viewer.