added: to stats plugin: microsoft bing searcher

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@648 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-08-28 21:19:30 +00:00
parent d6e80f5a23
commit c92081d6e1
7 changed files with 37 additions and 3 deletions

View File

@ -4,8 +4,10 @@
unique: [stats_unique],
Google: [stats_google],
Yahoo: [stats_yahoo],
Bing: [stats_bing],
this page:
all: [stats_item_all],
Google: [stats_item_google],
Yahoo: [stats_item_yahoo]
Bing: [stats_item_bing]
-->

View File

@ -31,7 +31,7 @@ bool Bot::BrowserNameHas(const char * name)
bool Bot::IsGoogle()
{
return BrowserNameHas("Googlebot") && BrowserNameHas("www.google.com");
return BrowserNameHas("Googlebot") && BrowserNameHas("+http://www.google.com/bot.html");
}
@ -42,4 +42,10 @@ bool Bot::IsYahoo()
}
bool Bot::IsBing()
{
return BrowserNameHas("msnbot") && BrowserNameHas("+http://search.msn.com/msnbot.htm");
}
} // namespace

View File

@ -22,7 +22,7 @@ struct Bot
bool IsGoogle();
bool IsYahoo();
bool IsBing();
private:

View File

@ -67,6 +67,12 @@ void UpdateStats(PluginInfo & info, Stats::ItemStats & item_stats)
stats.global_yahoo += 1;
item_stats.yahoo += 1;
}
if( bot.IsBing() )
{
stats.global_bing += 1;
item_stats.bing += 1;
}
}

View File

@ -39,6 +39,7 @@ void Stats::ReadStats(std::ifstream & file)
file >> global_unique;
file >> global_google;
file >> global_yahoo;
file >> global_bing;
size_t len;
file >> len;
@ -52,6 +53,7 @@ void Stats::ReadStats(std::ifstream & file)
file >> s.all;
file >> s.google;
file >> s.yahoo;
file >> s.bing;
stats_tab.insert( std::make_pair(item_id, s) );
}
@ -91,6 +93,7 @@ void Stats::SaveStats(std::ofstream & file)
file << global_unique << ' ';
file << global_google << ' ';
file << global_yahoo << ' ';
file << global_bing << ' ';
file << std::endl;
file << stats_tab.size() << std::endl;
@ -103,6 +106,7 @@ void Stats::SaveStats(std::ofstream & file)
file << i->second.all << ' ';
file << i->second.google << ' ';
file << i->second.yahoo << ' ';
file << i->second.bing << ' ';
file << std::endl;
}
}

View File

@ -42,7 +42,7 @@ struct Stats
int global_google;
int global_yahoo;
int global_bing;
// statistics for files/dirs
@ -51,12 +51,14 @@ struct Stats
int all;
int google;
int yahoo;
int bing;
ItemStats()
{
all = 0;
google = 0;
yahoo = 0;
bing = 0;
}
};

View File

@ -49,6 +49,13 @@ void stats_yahoo(Ezc::Info & i)
}
void stats_bing(Ezc::Info & i)
{
i.out << stats.global_bing;
}
void stats_item_all(Ezc::Info & i)
{
i.out << stats.stats_tab[current_item_id].all;
@ -65,6 +72,11 @@ void stats_item_yahoo(Ezc::Info & i)
i.out << stats.stats_tab[current_item_id].yahoo;
}
void stats_item_bing(Ezc::Info & i)
{
i.out << stats.stats_tab[current_item_id].bing;
}
@ -78,10 +90,12 @@ void CreateFunctions(PluginInfo & info)
fun->Insert("stats_unique", stats_unique);
fun->Insert("stats_google", stats_google);
fun->Insert("stats_yahoo", stats_yahoo);
fun->Insert("stats_bing", stats_bing);
fun->Insert("stats_item_all", stats_item_all);
fun->Insert("stats_item_google", stats_item_google);
fun->Insert("stats_item_yahoo", stats_item_yahoo);
fun->Insert("stats_item_bing", stats_item_bing);
}