* @return integer Contact ID
*/
function get_contact($url, $uid = 0, $no_update = false) {
- logger("Get contact data for url ".$url." and user ".$uid." - ".App::callstack(), LOGGER_DEBUG);
+ logger("Get contact data for url ".$url." and user ".$uid." - ".System::callstack(), LOGGER_DEBUG);
$data = array();
$contact_id = 0;
<?php
+use \Friendica\Core\System;
+
require_once("dbm.php");
require_once('include/datetime.php');
$orig_sql = $sql;
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
- $sql = "/*".$a->callstack()." */ ".$sql;
+ $sql = "/*".System::callstack()." */ ".$sql;
}
$columns = 0;
$orig_sql = $sql;
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
- $sql = "/*".$a->callstack()." */ ".$sql;
+ $sql = "/*".System::callstack()." */ ".$sql;
}
self::$dbo->error = '';
$errorno = self::$dbo->errorno;
logger('DB Error '.self::$dbo->errorno.': '.self::$dbo->error."\n".
- $a->callstack(8)."\n".self::replace_parameters($sql, $params));
+ System::callstack(8)."\n".self::replace_parameters($sql, $params));
self::$dbo->error = $error;
self::$dbo->errorno = $errorno;
$errorno = self::$dbo->errorno;
logger('DB Error '.self::$dbo->errorno.': '.self::$dbo->error."\n".
- $a->callstack(8)."\n".self::replace_parameters($sql, $params));
+ System::callstack(8)."\n".self::replace_parameters($sql, $params));
self::$dbo->error = $error;
self::$dbo->errorno = $errorno;
*
* @return integer Last inserted id
*/
- function lastInsertId() {
+ public static function lastInsertId() {
switch (self::$dbo->driver) {
case 'pdo':
$id = self::$dbo->db->lastInsertId();
$timestamp = -62135596800;
}
- return date('Y-m-d H:i:s', $timestamp);
+ return date('Y-m-d H:i:s', (int)$timestamp);
}
}
}
if (($arr['author-link'] == "") && ($arr['owner-link'] == "")) {
- logger("Both author-link and owner-link are empty. Called by: " . App::callstack(), LOGGER_DEBUG);
+ logger("Both author-link and owner-link are empty. Called by: " . System::callstack(), LOGGER_DEBUG);
}
if ($arr['plink'] == "") {
*
* @return string activity
*/
- function construct_verb($item) {
+ private static function construct_verb($item) {
if ($item['verb'])
return $item['verb'];
return ACTIVITY_POST;
*
* @return string Object type
*/
- function construct_objecttype($item) {
+ private static function construct_objecttype($item) {
if (in_array($item['object-type'], array(ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT)))
return $item['object-type'];
return ACTIVITY_OBJ_NOTE;
}
if ($new_url != $url) {
- logger("Cleaned contact url ".$url." to ".$new_url." - Called by: ".App::callstack(), LOGGER_DEBUG);
+ logger("Cleaned contact url ".$url." to ".$new_url." - Called by: ".System::callstack(), LOGGER_DEBUG);
}
return $new_url;
if (($contact["network"] == NETWORK_OSTATUS) && poco_alternate_ostatus_url($contact["url"])) {
$data = probe_url($contact["url"]);
if ($contact["network"] == NETWORK_OSTATUS) {
- logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".App::callstack(), LOGGER_DEBUG);
+ logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
$contact["url"] = $data["url"];
$contact["addr"] = $data["addr"];
$contact["alias"] = $data["alias"];
$doprobing = false;
if (in_array($contact["network"], array(NETWORK_PHANTOM))) {
- logger("Invalid network for contact url ".$contact["url"]." - Called by: ".App::callstack(), LOGGER_DEBUG);
+ logger("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return false;
}
$data = probe_url($url);
if (in_array($data["network"], array(NETWORK_PHANTOM))) {
- logger("Invalid network for contact url ".$data["url"]." - Called by: ".App::callstack(), LOGGER_DEBUG);
+ logger("Invalid network for contact url ".$data["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return;
}
namespace Friendica;
+use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
$this->performance[$value] += (float) $duration;
$this->performance['marktime'] += (float) $duration;
- $callstack = $this->callstack();
+ $callstack = System::callstack();
if (!isset($this->callstack[$value][$callstack])) {
// Prevent ugly E_NOTICE
q('DELETE FROM `process` WHERE `pid` = %d', intval(getmypid()));
}
- /**
- * @brief Returns a string with a callstack. Can be used for logging.
- *
- * @return string
- */
- 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);
- array_shift($trace);
-
- $callstack = array();
- foreach ($trace AS $func) {
- if (!empty($func['class'])) {
- $callstack[] = $func['class'].'::'.$func['function'];
- } else {
- $callstack[] = $func['function'];
- }
- }
-
- return implode(', ', $callstack);
- }
-
function get_useragent() {
return
FRIENDICA_PLATFORM . " '" .
*
* @return string The cleaned url
*/
- function removedBaseUrl($orig_url) {
+ public static function removedBaseUrl($orig_url) {
self::init();
return self::$a->remove_baseurl($orig_url);
}
+ /**
+ * @brief Returns a string with a callstack. Can be used for logging.
+ *
+ * @return string
+ */
+ public static 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);
+ array_shift($trace);
+
+ $callstack = array();
+ foreach ($trace AS $func) {
+ if (!empty($func['class'])) {
+ $callstack[] = $func['class'].'::'.$func['function'];
+ } else {
+ $callstack[] = $func['function'];
+ }
+ }
+
+ return implode(', ', $callstack);
+ }
+
/// @todo Move the following functions from boot.php
/*
function get_guid($size = 16, $prefix = "")