mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Make the statistic update system more resilient
This commit is contained in:
parent
880c9e3796
commit
d29b87eb6d
2 changed files with 4 additions and 2 deletions
|
@ -16,6 +16,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- [security] Fixed some potential XSS attacks in the page editor
|
- [security] Fixed some potential XSS attacks in the page editor
|
||||||
|
- Fixed a weird bug in the `stats-update` action causing warnings
|
||||||
|
|
||||||
|
|
||||||
## v0.22
|
## v0.22
|
||||||
|
|
|
@ -130,6 +130,7 @@ register_module([
|
||||||
exit(page_renderer::render_main("Error - Recalculating Statistics - $settings->sitename", "<p>You need to be logged in as a moderator or better to get $settings->sitename to recalculate it's statistics. If you're logged in, try <a href='?action=logout'>logging out</a> and logging in again as a moderator. If you aren't logged in, try <a href='?action=login&returnto=%3Faction%3Dstats-update'>logging in</a>.</p>"));
|
exit(page_renderer::render_main("Error - Recalculating Statistics - $settings->sitename", "<p>You need to be logged in as a moderator or better to get $settings->sitename to recalculate it's statistics. If you're logged in, try <a href='?action=logout'>logging out</a> and logging in again as a moderator. If you aren't logged in, try <a href='?action=login&returnto=%3Faction%3Dstats-update'>logging in</a>.</p>"));
|
||||||
|
|
||||||
// Delete the old stats cache
|
// Delete the old stats cache
|
||||||
|
if(file_exists($paths->statsindex))
|
||||||
unlink($paths->statsindex);
|
unlink($paths->statsindex);
|
||||||
|
|
||||||
update_statistics(true, ($_GET["force"] ?? "no") == "yes");
|
update_statistics(true, ($_GET["force"] ?? "no") == "yes");
|
||||||
|
@ -310,7 +311,7 @@ function update_statistics($update_all = false, $force = false)
|
||||||
if(isset($settings->firstrun_complete) && $settings->firstrun_complete == false)
|
if(isset($settings->firstrun_complete) && $settings->firstrun_complete == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$stats_mtime = filemtime($paths->statsindex);
|
$stats_mtime = file_exists($paths->statsindex) ? filemtime($paths->statsindex) : 0;
|
||||||
|
|
||||||
// Clear the existing statistics if we are asked to recalculate them all
|
// Clear the existing statistics if we are asked to recalculate them all
|
||||||
if($force)
|
if($force)
|
||||||
|
|
Loading…
Reference in a new issue