public function checkSetup($page = false) { global $pagenow; // check if safe mode is enabled $this->isPhpSafeMode(); // check if incomatible plugins are active $this->checkPlugins(); // check if a recent version of WooCommerce is installed $this->checkWooCommerce(); // check if cURL is loaded if (!$this->isCurlLoaded()) { return false; } // check for windows server // if ( $this->isWindowsServer() ) return false; $this->isWindowsServer($page); // create folders if neccessary if ($this->checkFolders()) { return false; } // check for updates $this->checkForUpdates(); // check if cron is working properly $this->checkCron(); // check if any sites need to be refreshed $this->checkSites(); // check database after migration // $this->checkDatabase(); // $this->checkDbForInvalidAccounts(); // check for multisite installation // if ( $this->checkMultisite() ) return false; $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : false; // setup wizard // if ( self::getOption('ebay_token') == '' ) { if ('1' == self::getOption('setup_next_step') && $current_tab != 'accounts') { $msg1 = __('You have not linked WP-Lister to your eBay account yet.', 'wplister'); $msg2 = __('To complete the setup procedure go to %s and follow the instructions.', 'wplister'); $accounts_page = get_option('wplister_enable_accounts_page') ? 'wplister-settings-accounts' : 'wplister-settings&tab=accounts'; $link = sprintf('<a href="admin.php?page=%s">%s</a>', $accounts_page, __('Account Settings', 'wplister')); $msg2 = sprintf($msg2, $link); $msg = "<b>{$msg1}</b></p><p>{$msg2}"; wple_show_message($msg, 'info'); } elseif ('2' == self::getOption('setup_next_step')) { $title = __('Setup - Step 2', 'wplister'); $msg1 = __('Before creating your first profile, we need to download certain information which are specific to the eBay site you selected.', 'wplister'); $msg2 = __('This includes shipping options, payment methods, your custom store categories as well as the whole eBay category tree, which might take a while.', 'wplister'); // old button // $button = '<a href="#" id="btn_update_ebay_data" onclick="return false;" class="button-primary">'.__('Update eBay details','wplister').'</a>'; // new button - use site_id of default (first) account $account = WPLE()->accounts[get_option('wplister_default_account_id')]; $button = '<a href="#" data-site_id="' . $account->site_id . '" data-account_id="' . $account->id . '" class="btn_update_ebay_data_for_site button-primary">' . __('Refresh eBay details', 'wplister') . '</a>'; $msg = "<p><b>{$title}</b></p><p>{$msg1}</p><p>{$msg2}</p>"; $msg .= $button; wple_show_message($msg, 'info'); // // remember when WP-Lister was connected to an eBay account for the first time // update_option( 'ignore_orders_before_ts', time() ); } elseif ('3' == self::getOption('setup_next_step')) { $tm = new TemplatesModel(); $templates = $tm->getAll(); if (sizeof($templates) > 0) { self::updateOption('setup_next_step', '4'); } else { $title = __('Setup - Step 3', 'wplister'); $msg1 = __('Create a default listing template.', 'wplister'); $msg2 = __('To create your first listing template click on %s.', 'wplister') . '<br>'; if (@$_GET['action'] == 'add_new_template') { $msg2 = __('Replace the default text according to your requirements and save your template to continue.', 'wplister'); } $link = '<a href="admin.php?page=wplister-templates&action=add_new_template">' . __('New Template', 'wplister') . '</a>'; $msg2 = sprintf($msg2, $link); $msg = "<p><b>{$title}</b></p><p><b>{$msg1}</b></p><p>{$msg2}</p>"; wple_show_message($msg, 'info'); } } elseif ('4' == self::getOption('setup_next_step')) { $pm = new ProfilesModel(); $profiles = $pm->getAll(); if (sizeof($profiles) > 0) { self::updateOption('setup_next_step', '0'); } else { $title = __('Setup - Step 4', 'wplister'); $msg1 = __('The final step: create your first listing profile.', 'wplister'); $msg2 = __('Click on %s and start defining your listing options.<br>After saving your profile, visit your Products page and select the products to list on eBay.', 'wplister'); $link = '<a href="admin.php?page=wplister-profiles&action=add_new_profile">' . __('New Profile', 'wplister') . '</a>'; $msg2 = sprintf($msg2, $link); $msg = "<b>{$msg1}</b></p><p>{$msg2}"; wple_show_message($msg, 'info'); } } elseif ('5' == self::getOption('setup_next_step')) { $title = __('Setup is complete.', 'wplister'); $msg1 = __('You are ready now to list your first items.', 'wplister'); $msg2 = __('Visit your Products page, select a few items and select "List on eBay" from the bulk actions menu.', 'wplister'); $msg = "<b>{$msg1}</b></p><p>{$msg2}"; wple_show_message($msg, 'info'); update_option('wplister_setup_next_step', '0'); } // db upgrade WPLE_UpgradeHelper::upgradeDB(); // check token expiration date self::checkToken(); // check if all db tables exist self::checkDatabaseTables($page); // // fetch user details if not done yet // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_user') ) ) { // $this->initEC(); // $UserID = $this->EC->GetUser(); // $this->EC->closeEbay(); // } // // fetch user details if not done yet // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_seller_profiles_enabled') ) ) { // $this->initEC(); // $this->EC->GetUserPreferences(); // $this->EC->closeEbay(); // } // // fetch token expiration date if not done yet // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_token_expirationtime') ) ) { // $this->initEC(); // $expdate = $this->EC->GetTokenStatus(); // $this->EC->closeEbay(); // } }
public function runInitialDbUpgrade() { // db upgrade WPLE_UpgradeHelper::upgradeDB(); }