]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
No timeout problem anymore in preview.
[friendica.git] / src / App.php
index 94ca007511297c5b5b73b1e85771dcf290ce738e..4b65afd797755f471b00b4fdbbee45b9f51269dc 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 
 use Cache;
+use dba;
 use dbm;
 
 use Detection\MobileDetect;
@@ -327,7 +328,27 @@ class App {
                        $basepath = $_SERVER['PWD'];
                }
 
-               return $basepath;
+               return self::realpath($basepath);
+       }
+
+       /**
+        * @brief Returns a normalized file path
+        *
+        * This is a wrapper for the "realpath" function.
+        * That function cannot detect the real path when some folders aren't readable.
+        * Since this could happen with some hosters we need to handle this.
+        *
+        * @param string $path The path that is about to be normalized
+        * @return string normalized path - when possible
+        */
+       public static function realpath($path) {
+               $normalized = realpath($path);
+
+               if (!is_bool($normalized)) {
+                       return $normalized;
+               } else {
+                       return $path;
+               }
        }
 
        function get_scheme() {
@@ -692,20 +713,20 @@ class App {
 
                $this->remove_inactive_processes();
 
-               q('START TRANSACTION');
+               dba::transaction();
 
                $r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));
                if (!dbm::is_result($r)) {
-                       q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')", intval(getmypid()), dbesc($command), dbesc(datetime_convert()));
+                       dba::insert('process', array('pid' => getmypid(), 'command' => $command, 'created' => datetime_convert()));
                }
-               q('COMMIT');
+               dba::commit();
        }
 
        /**
         * @brief Remove inactive processes
         */
        function remove_inactive_processes() {
-               q('START TRANSACTION');
+               dba::transaction();
 
                $r = q('SELECT `pid` FROM `process`');
                if (dbm::is_result($r)) {
@@ -715,7 +736,7 @@ class App {
                                }
                        }
                }
-               q('COMMIT');
+               dba::commit();
        }
 
        /**
@@ -739,7 +760,11 @@ class App {
 
                $callstack = array();
                foreach ($trace AS $func) {
-                       $callstack[] = $func['function'];
+                       if (!empty($func['class'])) {
+                               $callstack[] = $func['class'].'::'.$func['function'];
+                       } else {
+                               $callstack[] = $func['function'];
+                       }
                }
 
                return implode(', ', $callstack);