Remove $wgServerName. Its only usage was for {{servername}}, and needed to be kept...
[lhc/web/wiklou.git] / includes / ProfilerStub.php
index 86cc622..e624e6f 100644 (file)
@@ -1,22 +1,52 @@
 <?php
+/**
+ * Stub profiling functions
+ * @file
+ * @ingroup Profiler
+ */
 
-# Stub profiling functions
+/** backward compatibility */
+$wgProfiling = false;
+$wgProfiler = null;
 
+/** is setproctitle function available ? */
+$haveProctitle = function_exists( 'setproctitle' );
+
+/**
+ * Begin profiling of a function
+ * @param $fn string
+ */
 function wfProfileIn( $fn = '' ) {
-       global $hackwhere, $wgDBname;
-       $hackwhere[] = $fn;
-       if (function_exists("setproctitle"))
-               setproctitle($fn . " [$wgDBname]");
+       global $hackwhere, $wgDBname, $haveProctitle;
+       if( $haveProctitle ){
+               $hackwhere[] = $fn;
+               setproctitle( $fn . " [$wgDBname]" );
+       }
 }
+
+/**
+ * Stop profiling of a function
+ * @param $fn string
+ */
 function wfProfileOut( $fn = '' ) {
-       global $hackwhere, $wgDBname;
-       if (count($hackwhere))
-               array_pop($hackwhere);
-       if (function_exists("setproctitle") && count($hackwhere))
-               setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]");
+       global $hackwhere, $wgDBname, $haveProctitle;
+       if( !$haveProctitle ) {
+               return;
+       }
+       if( count( $hackwhere ) ) {
+               array_pop( $hackwhere );
+       }
+       if( count( $hackwhere ) ) {
+               setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" );
+       }
 }
+
+/**
+ * Does nothing, just for compatibility 
+ */
 function wfGetProfilingOutput( $s, $e ) {}
-function wfProfileClose() {}
-function wfLogProfilingData() {}
 
-?>
+/**
+ * Does nothing, just for compatibility 
+ */
+function wfProfileClose() {}