Added permission for displaying load timings in the footer.

This commit is contained in:
flash 2023-08-31 00:37:09 +00:00
parent ad3fe74275
commit 16ea495c7a
4 changed files with 6 additions and 3 deletions

View file

@ -180,7 +180,7 @@ $inManageMode = str_starts_with($_SERVER['REQUEST_URI'], '/manage');
Template::set('header_menu', $msz->getHeaderMenu($userInfo ?? null)); Template::set('header_menu', $msz->getHeaderMenu($userInfo ?? null));
Template::set('user_menu', $msz->getUserMenu($userInfo ?? null, $inManageMode)); Template::set('user_menu', $msz->getUserMenu($userInfo ?? null, $inManageMode));
Template::set('display_debug_info', MSZ_DEBUG || (!empty($userInfo) && $userInfo->isSuperUser())); Template::set('display_timings_info', MSZ_DEBUG || $msz->getAuthInfo()->getPerms('global')->check(Perm::G_TIMINGS_VIEW));
if($inManageMode) { if($inManageMode) {
$hasManageAccess = false; $hasManageAccess = false;

View file

@ -21,6 +21,7 @@ final class Perm {
//public const G_IS_TESTER = 0b00000_00000000_00000000_00000000_00000000_00000000_00010000; // deprecated: tester status went unused //public const G_IS_TESTER = 0b00000_00000000_00000000_00000000_00000000_00000000_00010000; // deprecated: tester status went unused
public const G_BLACKLIST_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000000_00100000; // unused: blacklist is currently removed to reduce overhead and it seemed like it was broken public const G_BLACKLIST_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000000_00100000; // unused: blacklist is currently removed to reduce overhead and it seemed like it was broken
//public const G_TWITTER_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000000_01000000; // deprecated: twitter integration has been removed //public const G_TWITTER_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000000_01000000; // deprecated: twitter integration has been removed
public const G_TIMINGS_VIEW = 0b00000_00000000_00000000_00000000_00000000_00000000_10000000;
public const G_CL_CHANGES_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000001_00000000; public const G_CL_CHANGES_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000001_00000000;
public const G_CL_TAGS_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000010_00000000; public const G_CL_TAGS_MANAGE = 0b00000_00000000_00000000_00000000_00000000_00000010_00000000;
@ -102,6 +103,7 @@ final class Perm {
self::G_EMOTES_MANAGE, self::G_EMOTES_MANAGE,
self::G_CONFIG_MANAGE, self::G_CONFIG_MANAGE,
self::G_BLACKLIST_MANAGE, self::G_BLACKLIST_MANAGE,
self::G_TIMINGS_VIEW,
], ],
], ],
@ -222,6 +224,7 @@ final class Perm {
//self::G_IS_TESTER => 'Can test experimental features.', //self::G_IS_TESTER => 'Can test experimental features.',
self::G_BLACKLIST_MANAGE => 'Can manage registration IP address blacklist.', self::G_BLACKLIST_MANAGE => 'Can manage registration IP address blacklist.',
//self::G_TWITTER_MANAGE => 'Can manage Twitter integration settings.', //self::G_TWITTER_MANAGE => 'Can manage Twitter integration settings.',
self::G_TIMINGS_VIEW => 'Can view page load timings.',
self::G_CL_CHANGES_MANAGE => 'Can manage changelog entries.', self::G_CL_CHANGES_MANAGE => 'Can manage changelog entries.',
self::G_CL_TAGS_MANAGE => 'Can manage changelog tags.', self::G_CL_TAGS_MANAGE => 'Can manage changelog tags.',

View file

@ -13,7 +13,7 @@
<a href="https://git.flash.moe/flashii/misuzu/src/tag/{{ git_tag }}" target="_blank" rel="noreferrer noopener" class="footer__link">{{ git_tag }}</a> <a href="https://git.flash.moe/flashii/misuzu/src/tag/{{ git_tag }}" target="_blank" rel="noreferrer noopener" class="footer__link">{{ git_tag }}</a>
{% endif %} {% endif %}
# <a href="https://git.flash.moe/flashii/misuzu/commit/{{ git_commit_hash(true) }}" target="_blank" rel="noreferrer noopener" class="footer__link">{{ git_commit_hash() }}</a> # <a href="https://git.flash.moe/flashii/misuzu/commit/{{ git_commit_hash(true) }}" target="_blank" rel="noreferrer noopener" class="footer__link">{{ git_commit_hash() }}</a>
{% if display_debug_info %} {% if display_timings_info %}
/ Index {{ ndx_version() }} / Index {{ ndx_version() }}
/ {{ sql_query_count()|number_format }} queries / {{ sql_query_count()|number_format }} queries
/ {{ (startup_time() - startup_time(constant('MSZ_TPL_RENDER')))|number_format(5) }} load / {{ (startup_time() - startup_time(constant('MSZ_TPL_RENDER')))|number_format(5) }} load

View file

@ -87,7 +87,7 @@
{% endif %} {% endif %}
# <a href="https://github.com/flashwave/misuzu/commit/{{ git_commit_hash(true) }}" target="_blank" rel="noreferrer noopener">{{ git_commit_hash() }}</a> # <a href="https://github.com/flashwave/misuzu/commit/{{ git_commit_hash(true) }}" target="_blank" rel="noreferrer noopener">{{ git_commit_hash() }}</a>
</div> </div>
{% if display_debug_info %} {% if display_timings_info %}
<div class="landingv2-footer-copyright-line"> <div class="landingv2-footer-copyright-line">
{{ sql_query_count()|number_format }} queries / {{ (startup_time() - startup_time(constant('MSZ_TPL_RENDER')))|number_format(5) }} load / {{ startup_time(constant('MSZ_TPL_RENDER'))|number_format(5) }} template / {{ startup_time()|number_format(5) }} total {{ sql_query_count()|number_format }} queries / {{ (startup_time() - startup_time(constant('MSZ_TPL_RENDER')))|number_format(5) }} load / {{ startup_time(constant('MSZ_TPL_RENDER'))|number_format(5) }} template / {{ startup_time()|number_format(5) }} total
</div> </div>