User:ImplSearchBot/Code: Difference between revisions

m
ImplSearchBot:0
m (ImplSearchBot:0)
m (ImplSearchBot:0)
Line 73:
my $starttime = time;
my $pagesedited = 0;
my $categorypulls = 0;
my $cachehits = 0;
 
# Tracking for svn checkin at end.
# 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'})
or die "Unable to open cache directory";
Line 193 ⟶ 192:
 
# To add here: Post stats on activities:
# 1. Pages edited
# 2. Time last run started
# 3. Time to completion from start to just prior to stat post point.
 
my $runtime = time() - $starttime;
my $statsdata = "Pages edited last run: $pagesedited\nTime<br/>Time to post all per-language updates: $runtime seconds\n<br/>Category pulls: $categorypulls<br/>Cache hits: $cachehits<br/>";
&out("Updating stats page. Runtime ($runtime), Pages edited ($pagesedited)\n", 2);
 
&postpage("User:ImplSearchBot/Stats", $statsdata, "Updating stats data", 0);
 
 
Line 400 ⟶ 397:
&out(scalar @$cacheddata . " cache members retrieved from $filename\n", 5);
 
++$cachehits;
return $cacheddata;
}
Line 418 ⟶ 416:
 
&out(scalar @$removed . " removed, " . @$added . " added to $categoryname\n", &getloglevelfromdiff(2, $removed, $added));
 
++$categorypulls;
 
&cachedata("$categoryname", \@categorycontents);