use Friendica\Core\Config;
use Friendica\Core\PConfig;
+use Cache;
+use dbm;
+
+use Detection\MobileDetect;
+
+use Exception;
+
/**
*
* 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);
$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();
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');
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']));
*
* @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);
}
}
- $processlist = \dbm::processlist();
+ $processlist = dbm::processlist();
if ($processlist['list'] != '') {
logger('Processcheck: Processes: ' . $processlist['amount'] . ' - Processlist: ' . $processlist['list'], LOGGER_DEBUG);
// 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'));