public function run_cron($debug = false) { if ($debug) { echo "Starting ucm Cron Job \n"; } $accounts = $this->get_accounts(); foreach ($accounts as $account) { SupportHub::getInstance()->log_data(_SUPPORT_HUB_LOG_INFO, 'ucm', 'Running Cron Job On Account: ' . $account['shub_account_id']); $shub_ucm_account = new shub_ucm_account($account['shub_account_id']); $shub_ucm_account->run_cron($debug); $products = $shub_ucm_account->get('items'); /* @var $products shub_ucm_item[] */ foreach ($products as $product) { SupportHub::getInstance()->log_data(_SUPPORT_HUB_LOG_INFO, 'ucm', 'Running Cron Job On Item: ' . $product->get('shub_item_id')); $product->run_cron($debug); } } if ($debug) { echo "Finished ucm Cron Job \n"; } }
} ?> </p> </form> </div> <?php } } } else { // show account overview: $myListTable = new SupportHub_Account_Data_List_Table(); $accounts = $shub_ucm->get_accounts(); foreach ($accounts as $account_id => $account) { $a = new shub_ucm_account($account['shub_account_id']); $accounts[$account_id]['edit_link'] = $a->link_edit(); $accounts[$account_id]['title'] = $a->get('account_name'); $accounts[$account_id]['last_checked'] = $a->get('last_checked') ? shub_print_date($a->get('last_checked')) : 'N/A'; } $myListTable->set_data($accounts); $myListTable->prepare_items(); ?> <div class="wrap"> <h2> <?php _e('UCM Accounts', 'support_hub'); ?> <a href="?page=<?php echo esc_attr($_GET['page']); ?>
<?php if (!isset($shub_account_id) || !isset($shub_message_id)) { exit; } if ($shub_account_id && $shub_message_id) { $ucm = new shub_ucm_account($shub_account_id); if ($shub_account_id && $ucm->get('shub_account_id') == $shub_account_id) { $ucm_message = new shub_message($ucm, false, $shub_message_id); $ucm_message->output_message_page('popup'); } }