mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Make stats-update admin-only - site secret support still needs to be added.
This commit is contained in:
parent
9021afe851
commit
dc2aaf2854
3 changed files with 9 additions and 3 deletions
|
@ -4039,7 +4039,10 @@ register_module([
|
||||||
* ██ ██ ██ ██ ███ ███
|
* ██ ██ ██ ██ ███ ███
|
||||||
*/
|
*/
|
||||||
add_action("stats-update", function() {
|
add_action("stats-update", function() {
|
||||||
global $env, $paths;
|
global $env, $paths, $settings;
|
||||||
|
|
||||||
|
if(!$env->is_admin)
|
||||||
|
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>"));
|
||||||
|
|
||||||
update_statistics(true);
|
update_statistics(true);
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
|
"description": "An extensible statistics calculation system. Comes with a range of built-in statistics, but can be extended by other modules too.",
|
||||||
"id": "feature-stats",
|
"id": "feature-stats",
|
||||||
"lastupdate": 1499974908,
|
"lastupdate": 1499980292,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,10 @@ register_module([
|
||||||
* ██ ██ ██ ██ ███ ███
|
* ██ ██ ██ ██ ███ ███
|
||||||
*/
|
*/
|
||||||
add_action("stats-update", function() {
|
add_action("stats-update", function() {
|
||||||
global $env, $paths;
|
global $env, $paths, $settings;
|
||||||
|
|
||||||
|
if(!$env->is_admin)
|
||||||
|
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>"));
|
||||||
|
|
||||||
update_statistics(true);
|
update_statistics(true);
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
|
|
Loading…
Reference in a new issue