Skip to content

Commit

Permalink
Merge pull request #533 from x-team/issue-528
Browse files Browse the repository at this point in the history
Remove duplicate call to install() method
  • Loading branch information
lukecarbis committed May 15, 2014
2 parents 761d53a + ec042aa commit c7f1ed0
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ private function __construct() {
require_once WP_STREAM_INC_DIR . 'db.php';
$this->db = new WP_Stream_DB;

// Check DB and add message if not present
// Check DB and display an admin notice if there are tables missing
add_action( 'init', array( $this, 'verify_database_present' ) );

// Install the plugin
add_action( 'wp_stream_install', array( __CLASS__, 'install' ) );

// Load languages
add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) );

Expand Down Expand Up @@ -112,11 +115,10 @@ private function __construct() {

if ( is_admin() ) {
require_once WP_STREAM_INC_DIR . 'admin.php';
require_once WP_STREAM_INC_DIR . 'extensions.php';
add_action( 'plugins_loaded', array( 'WP_Stream_Admin', 'load' ) );
add_action( 'admin_init', array( 'WP_Stream_Extensions', 'get_instance' ) );

add_action( 'init', array( __CLASS__, 'install' ), 10, 1 );
require_once WP_STREAM_INC_DIR . 'extensions.php';
add_action( 'admin_init', array( 'WP_Stream_Extensions', 'get_instance' ) );

// Registers a hook that connectors and other plugins can use whenever a stream update happens
add_action( 'admin_init', array( __CLASS__, 'update_activation_hook' ) );
Expand Down Expand Up @@ -162,16 +164,6 @@ public static function i18n() {
* @return void
*/
public static function install() {
/**
* Filter will halt install() if set to true
*
* @param bool
* @return bool
*/
if ( apply_filters( 'wp_stream_no_tables', false ) ) {
return;
}

// Install plugin tables
require_once WP_STREAM_INC_DIR . 'install.php';
$update = WP_Stream_Install::get_instance();
Expand All @@ -183,12 +175,8 @@ public static function install() {
* @return void
*/
public function verify_database_present() {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}

/**
* Filter will halt verify_database_present() if set to true
* Filter will halt install() if set to true
*
* @param bool
* @return bool
Expand All @@ -197,6 +185,10 @@ public function verify_database_present() {
return;
}

if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}

global $wpdb;

$database_message = '';
Expand Down Expand Up @@ -229,8 +221,8 @@ public function verify_database_present() {
$uninstall_message = sprintf( __( 'Please <a href="%s">uninstall</a> the Stream plugin and activate it again.', 'stream' ), admin_url( 'plugins.php#stream' ) );
}

// Check upgrade routine
self::install();
// Install the plugin
do_action( 'wp_stream_install' );

if ( ! empty( $database_message ) ) {
self::notice( $database_message );
Expand Down

0 comments on commit c7f1ed0

Please sign in to comment.