summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-01-23 18:03:09 -0500
committerBharat Mediratta <bharat@menalto.com>2013-01-23 18:03:09 -0500
commita1a66004571c2f6161335f9413b39d255190f153 (patch)
tree9b1403c7ea35db20772c18ee7d1d11742f5b6b56 /modules/gallery/helpers
parentd928064f0b7b4f12ce1371d7e0e61f6832f09a01 (diff)
Enable the profiler and debug output if var/PROFILE exists. This
provides a quick/easy way for server admins to provide profile output. Fixes #1959.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery.php8
-rw-r--r--modules/gallery/helpers/gallery_theme.php4
2 files changed, 10 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 38002b58..725a710d 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -214,4 +214,12 @@ class gallery_Core {
}
return null;
}
+
+ /**
+ * Return true if we should show the profiler at the bottom of the page. Note that this
+ * function is called at database setup time so it cannot rely on the database.
+ */
+ static function show_profiler() {
+ return file_exists(VARPATH . "PROFILE");
+ }
} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index f94b9ecd..3c6d71e9 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -71,7 +71,7 @@ class gallery_theme_Core {
static function page_bottom($theme) {
$session = Session::instance();
- if ($session->get("profiler", false)) {
+ if (gallery::show_profiler()) {
Profiler::enable();
$profiler = new Profiler();
$profiler->render();
@@ -96,7 +96,7 @@ class gallery_theme_Core {
static function admin_page_bottom($theme) {
$session = Session::instance();
- if ($session->get("profiler", false)) {
+ if (gallery::show_profiler()) {
Profiler::enable();
$profiler = new Profiler();
$profiler->render();