X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=rendertime%2Frendertime.php;h=81aea8b18a4b4aa82a06874c0c7137862561fd78;hb=3268eecd722126c532f9cef18b8657c10046a89e;hp=574e6e0951b72087586704e0e618fb582d7b8c6b;hpb=f65e8dac28b7069c4e230e497caed3a5a0d13624;p=friendica-addons.git diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php old mode 100755 new mode 100644 index 574e6e09..81aea8b1 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -1,6 +1,4 @@ * */ +use Friendica\Core\Addon; +use Friendica\Core\Config; +use Friendica\Core\L10n; function rendertime_install() { - register_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); + Addon::registerHook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); } function rendertime_uninstall() { - unregister_hook('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1'); - unregister_hook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); + Addon::unregisterHook('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1'); + Addon::unregisterHook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); } function rendertime_init_1(&$a) { @@ -26,23 +27,26 @@ function rendertime_page_end(&$a, &$o) { $duration = microtime(true)-$a->performance["start"]; - if (is_site_admin() AND ($_GET["mode"] != "minimal") AND !$a->is_mobile AND !$a->is_tablet) { - $o = $o.'
'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"), - round($a->performance["database"] - $a->performance["database_write"], 3), - round($a->performance["database_write"], 3), - round($a->performance["network"], 2), - round($a->performance["rendering"], 2), - round($a->performance["parser"], 2), - round($a->performance["file"], 2), - round($duration - $a->performance["database"] - - $a->performance["network"] - $a->performance["rendering"] - - $a->performance["parser"] - $a->performance["file"], 2), - round($duration, 2) - //round($a->performance["markstart"], 3) - //round($a->performance["plugin"], 3) - )."
"; + $ignored_modules = ["fbrowser"]; + $ignored = in_array($a->module, $ignored_modules); + + if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { + $o = $o.'
'. L10n::t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", + round($a->performance["database"] - $a->performance["database_write"], 3), + round($a->performance["database_write"], 3), + round($a->performance["network"], 2), + round($a->performance["rendering"], 2), + round($a->performance["parser"], 2), + round($a->performance["file"], 2), + round($duration - $a->performance["database"] + - $a->performance["network"] - $a->performance["rendering"] + - $a->performance["parser"] - $a->performance["file"], 2), + round($duration, 2) + //round($a->performance["markstart"], 3) + //round($a->performance["plugin"], 3) + )."
"; - if (get_config("rendertime", "callstack")) { + if (Config::get("rendertime", "callstack")) { $o .= "
";
 			$o .= "\nDatabase Read:\n";
 			foreach ($a->callstack["database"] AS $func => $time) {