本文整理汇总了PHP中MainWP_Utility::getGoogleCount方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getGoogleCount方法的具体用法?PHP MainWP_Utility::getGoogleCount怎么用?PHP MainWP_Utility::getGoogleCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getGoogleCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainwp_cronstats_action
function mainwp_cronstats_action()
{
MainWP_Logger::Instance()->info('CRON :: stats');
MainWP_Utility::update_option('mainwp_cron_last_stats', time());
if (get_option('mainwp_seo') != 1) {
return;
}
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getWebsitesStatsUpdateSQL());
$start = time();
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($start - time() > 60 * 60 * 2) {
//two hours passed, next cron will start!
break;
}
$errors = false;
if (!$errors) {
$indexed = MainWP_Utility::getGoogleCount($website->url);
if ($indexed == NULL) {
$errors = true;
}
}
if (!$errors) {
$alexia = MainWP_Utility::getAlexaRank($website->url);
if ($alexia == NULL) {
$errors = true;
}
}
$pageRank = 0;
//MainWP_Utility::getPagerank($website->url);
$newIndexed = $errors ? $website->indexed : $indexed;
$oldIndexed = $errors ? $website->indexed_old : $website->indexed;
$newAlexia = $errors ? $website->alexia : $alexia;
$oldAlexia = $errors ? $website->alexia_old : $website->alexia;
$statsUpdated = $errors ? $website->statsUpdate : time();
MainWP_DB::Instance()->updateWebsiteStats($website->id, $pageRank, $newIndexed, $newAlexia, $website->pagerank, $oldIndexed, $oldAlexia, $statsUpdated);
if ($website->sync_errors != '') {
//Try reconnecting
MainWP_Logger::Instance()->infoForWebsite($website, 'reconnect', 'Trying to reconnect');
try {
if (MainWP_Manage_Sites::_reconnectSite($website)) {
//Reconnected
MainWP_Logger::Instance()->infoForWebsite($website, 'reconnect', 'Reconnected successfully');
}
} catch (Exception $e) {
//Still something wrong
MainWP_Logger::Instance()->warningForWebsite($website, 'reconnect', $e->getMessage());
}
}
sleep(3);
}
@MainWP_DB::free_result($websites);
}