Add debug option
Add debug option

--- a/config/gitphp.conf.php.example
+++ b/config/gitphp.conf.php.example
@@ -169,6 +169,13 @@
 $gitphp_conf['filesearch'] = TRUE;
 
 /*
+ * debug
+ * Turns on extra warning messages and benchmarking.
+ * Not recommended for production systems
+ */
+$gitphp_conf['debug'] = FALSE;
+
+/*
  * git_projects
  * Two-dimensional array list of projects
  * First array index is the name of the category the projects

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -22,6 +22,14 @@
   * Configuration
   */
  require_once('config/gitphp.conf.php');
+
+ /*
+  * Debug
+  */
+ if ($gitphp_conf['debug']) {
+ 	define('GITPHP_START_TIME', microtime(true));
+	error_reporting(E_ALL|E_STRICT);
+ }
 
  /*
   * Instantiate Smarty
@@ -204,6 +212,9 @@
 	 $tpl->display("footer.tpl");
  }
 
+ if ($gitphp_conf['debug'])
+ 	echo "Execution time: " . round(microtime(true) - GITPHP_START_TIME, 8) . " sec";
+
  ob_end_flush();
 
 ?>

comments