Rewrote permissions system.
This commit is contained in:
parent
0d90b6576b
commit
349cc237c5
63 changed files with 1286 additions and 989 deletions
tools
12
tools/cron
12
tools/cron
|
@ -81,7 +81,8 @@ msz_sched_task_func('Recount forum topics and posts.', true, function() use ($ms
|
|||
msz_sched_task_sql('Clean up expired 2fa tokens.', false,
|
||||
'DELETE FROM msz_auth_tfa WHERE tfa_created < NOW() - INTERVAL 15 MINUTE');
|
||||
|
||||
// make sure this one remains last
|
||||
// very heavy stuff that should
|
||||
|
||||
msz_sched_task_func('Resync statistics counters.', true, function() use ($msz) {
|
||||
$dbConn = $msz->getDbConn();
|
||||
$counters = $msz->getCounters();
|
||||
|
@ -139,6 +140,15 @@ msz_sched_task_func('Resync statistics counters.', true, function() use ($msz) {
|
|||
}
|
||||
});
|
||||
|
||||
msz_sched_task_func('Recalculate permissions (maybe)...', false, function() use ($msz) {
|
||||
$needsRecalc = $msz->getConfig()->getBoolean('perms.needsRecalc');
|
||||
if(!$needsRecalc)
|
||||
return;
|
||||
|
||||
$msz->getConfig()->removeValues('perms.needsRecalc');
|
||||
$msz->getPerms()->precalculatePermissions($msz->getForum());
|
||||
});
|
||||
|
||||
echo 'Running ' . count($schedTasks) . ' tasks...' . PHP_EOL;
|
||||
|
||||
$dbConn = $msz->getDbConn();
|
||||
|
|
8
tools/recalc-perms
Normal file
8
tools/recalc-perms
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
namespace Misuzu;
|
||||
|
||||
require_once __DIR__ . '/../misuzu.php';
|
||||
|
||||
$msz->getConfig()->removeValues('perms.needsRecalc');
|
||||
$msz->getPerms()->precalculatePermissions($msz->getForum());
|
Loading…
Add table
Add a link
Reference in a new issue