]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Update doco
[friendica.git] / src / App.php
index 15538e88da00f4ac2f925c9c9cbc07038d8ff105..aaaf6b24512ad721c10839f271c63a2d402cde87 100644 (file)
@@ -5,6 +5,13 @@ namespace Friendica;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 
+use Cache;
+use dbm;
+
+use Detection\MobileDetect;
+
+use Exception;
+
 /**
  *
  * class: App
@@ -192,7 +199,7 @@ class App {
                }
 
                if (! static::directory_usable($basepath, false)) {
-                       throw new \Exception('Basepath ' . $basepath . ' isn\'t usable.');
+                       throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
                }
 
                $this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
@@ -276,7 +283,7 @@ class App {
                $this->pager['total'] = 0;
 
                // Detect mobile devices
-               $mobile_detect = new \Mobile_Detect();
+               $mobile_detect = new MobileDetect();
                $this->is_mobile = $mobile_detect->isMobile();
                $this->is_tablet = $mobile_detect->isTablet();
 
@@ -687,7 +694,7 @@ class App {
                q('START TRANSACTION');
 
                $r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));
-               if (!\dbm::is_result($r)) {
+               if (!dbm::is_result($r)) {
                        q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')", intval(getmypid()), dbesc($command), dbesc(datetime_convert()));
                }
                q('COMMIT');
@@ -700,7 +707,7 @@ class App {
                q('START TRANSACTION');
 
                $r = q('SELECT `pid` FROM `process`');
-               if (\dbm::is_result($r)) {
+               if (dbm::is_result($r)) {
                        foreach ($r AS $process) {
                                if (!posix_kill($process['pid'], 0)) {
                                        q('DELETE FROM `process` WHERE `pid` = %d', intval($process['pid']));
@@ -722,8 +729,8 @@ class App {
         *
         * @return string
         */
-       function callstack() {
-               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 6);
+       function callstack($depth = 4) {
+               $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $depth + 2);
 
                // We remove the first two items from the list since they contain data that we don't need.
                array_shift($trace);
@@ -805,7 +812,7 @@ class App {
                        }
                }
 
-               $processlist = \dbm::processlist();
+               $processlist = dbm::processlist();
                if ($processlist['list'] != '') {
                        logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
 
@@ -896,14 +903,14 @@ class App {
                // If the last worker fork was less than 10 seconds before then don't fork another one.
                // This should prevent the forking of masses of workers.
                $cachekey = 'app:proc_run:started';
-               $result = \Cache::get($cachekey);
+               $result = Cache::get($cachekey);
 
                if (!is_null($result) AND ( time() - $result) < 10) {
                        return;
                }
 
                // Set the timestamp of the last proc_run
-               \Cache::set($cachekey, time(), CACHE_MINUTE);
+               Cache::set($cachekey, time(), CACHE_MINUTE);
 
                array_unshift($args, ((x($this->config, 'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));