User:ImplSearchBot/Code: Difference between revisions

Content added Content deleted
m (ImplSearchBot:0)
m (ImplSearchBot:0)
Line 73: Line 73:
my $starttime = time;
my $starttime = time;
my $pagesedited = 0;
my $pagesedited = 0;
my $categorypulls = 0;
my $cachehits = 0;


# Tracking for svn checkin at end.
# Tracking for svn checkin at end.
# We *should* be the only ones writing to the cache path for now.
# We *should* be the only ones writing to the cache path for now.
# Anyone else should have their own checkout of the data,
# Eventually, we'll keep track of the vision we last ran at, and update to that.
# and test runs are done with --cacheonly and --nosvn.
# In the mean time, since the structure of this is a bit unstable for the moment,
# we'll do an update to HEAD just to catch anything silly I might have done in the
# mean time.
&svn('update', $options{'cachepath'});
opendir(CACHEDIR, $options{'cachepath'})
opendir(CACHEDIR, $options{'cachepath'})
or die "Unable to open cache directory";
or die "Unable to open cache directory";
Line 193: Line 192:


# To add here: Post stats on activities:
# To add here: Post stats on activities:
# 1. Pages edited
# 2. Time last run started
# 2. Time last run started
# 3. Time to completion from start to just prior to stat post point.


my $runtime = time() - $starttime;
my $runtime = time() - $starttime;
my $statsdata = "Pages edited last run: $pagesedited\nTime to post all per-language updates: $runtime seconds\n";
my $statsdata = "Pages edited last run: $pagesedited<br/>Time to post all per-language updates: $runtime seconds<br/>Category pulls: $categorypulls<br/>Cache hits: $cachehits<br/>";
&out("Updating stats page. Runtime ($runtime), Pages edited ($pagesedited)\n", 2);
&out("Updating stats page. Runtime ($runtime), Pages edited ($pagesedited)\n", 2);


&postpage("User:ImplSearchBot/Stats", $statsdata, 0);
&postpage("User:ImplSearchBot/Stats", $statsdata, "Updating stats data", 0);




Line 400: Line 397:
&out(scalar @$cacheddata . " cache members retrieved from $filename\n", 5);
&out(scalar @$cacheddata . " cache members retrieved from $filename\n", 5);


++$cachehits;
return $cacheddata;
return $cacheddata;
}
}
Line 418: Line 416:


&out(scalar @$removed . " removed, " . @$added . " added to $categoryname\n", &getloglevelfromdiff(2, $removed, $added));
&out(scalar @$removed . " removed, " . @$added . " added to $categoryname\n", &getloglevelfromdiff(2, $removed, $added));

++$categorypulls;


&cachedata("$categoryname", \@categorycontents);
&cachedata("$categoryname", \@categorycontents);