Core Logger

implement log() function.
more to squash


Core Logger Class

implement log() function
pull/765/head
Adam Magness 2018-10-29 19:40:18 -04:00
parent b53157370a
commit 49eff56e5d
46 changed files with 348 additions and 302 deletions

View File

@ -39,6 +39,7 @@ use Friendica\Content\Text\Markdown;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Item;
@ -64,7 +65,7 @@ function advancedcontentfilter_install()
DBStructure::update(false, true);
logger("installed advancedcontentfilter");
Logger::log("installed advancedcontentfilter");
}
function advancedcontentfilter_uninstall()

View File

@ -52,6 +52,7 @@
use Friendica\Core\Config;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
function blackout_install() {
Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
@ -84,7 +85,7 @@ function blackout_redirect ($a, $b) {
$date2 = 0;
}
if (( $date1 <= $now ) && ( $now <= $date2 )) {
logger('redirecting user to blackout page');
Logger::log('redirecting user to blackout page');
System::externalRedirect($myurl);
}
}

View File

@ -10,6 +10,7 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Util\Network;
@ -202,12 +203,12 @@ function blogger_send(App $a, array &$b)
EOT;
logger('blogger: data: ' . $xml, LOGGER_DATA);
Logger::log('blogger: data: ' . $xml, LOGGER_DATA);
if ($bl_blog !== 'test') {
$x = Network::post($bl_blog, $xml)->getBody();
}
logger('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG);
Logger::log('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG);
}
}

View File

@ -12,6 +12,7 @@ use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -112,7 +113,7 @@ function buffer_connect(App $a)
if (!$buffer->ok) {
$o .= '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
} else {
logger("buffer_connect: authenticated");
Logger::log("buffer_connect: authenticated");
$o .= L10n::t("You are now authenticated to buffer. ");
$o .= '<br /><a href="' . $a->getBaseURL() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
@ -298,7 +299,7 @@ function buffer_send(App $a, array &$b)
$profiles = $buffer->go('/profiles');
if (is_array($profiles)) {
logger("Will send these parameter ".print_r($b, true), LOGGER_DEBUG);
Logger::log("Will send these parameter ".print_r($b, true), LOGGER_DEBUG);
foreach ($profiles as $profile) {
if (!$profile->default)
@ -357,7 +358,7 @@ function buffer_send(App $a, array &$b)
}
$post = ItemContent::getPlaintextPost($item, $limit, $includedlinks, $htmlmode);
logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
// The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
if (isset($post["image"])) {
@ -407,9 +408,9 @@ function buffer_send(App $a, array &$b)
}
//print_r($message);
logger("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG);
Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG);
$ret = $buffer->go('/updates/create', $message);
logger("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG);
Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG);
}
}
}

View File

@ -10,6 +10,7 @@ use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -28,7 +29,7 @@ function catavatar_install()
Addon::registerHook('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings');
Addon::registerHook('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post');
logger('registered catavatar');
Logger::log('registered catavatar');
}
/**
@ -40,7 +41,7 @@ function catavatar_uninstall()
Addon::unregisterHook('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings');
Addon::unregisterHook('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post');
logger('unregistered catavatar');
Logger::log('unregistered catavatar');
}
/**

View File

@ -13,6 +13,7 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -72,7 +73,7 @@ function diaspora_queue_hook(App $a, &$b) {
continue;
}
logger('diaspora_queue: run');
Logger::log('diaspora_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
@ -92,37 +93,37 @@ function diaspora_queue_hook(App $a, &$b) {
$success = false;
if ($handle && $password) {
logger('diaspora_queue: able to post for user '.$handle);
Logger::log('diaspora_queue: able to post for user '.$handle);
$z = unserialize($x['content']);
$post = $z['post'];
logger('diaspora_queue: post: '.$post, LOGGER_DATA);
Logger::log('diaspora_queue: post: '.$post, LOGGER_DATA);
try {
logger('diaspora_queue: prepare', LOGGER_DEBUG);
Logger::log('diaspora_queue: prepare', LOGGER_DEBUG);
$conn = new Diaspora_Connection($handle, $password);
logger('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG);
Logger::log('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG);
$conn->logIn();
logger('diaspora_queue: try to send '.$body, LOGGER_DEBUG);
Logger::log('diaspora_queue: try to send '.$body, LOGGER_DEBUG);
$conn->provider = $hostname;
$conn->postStatusMessage($post, $aspect);
logger('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG);
Logger::log('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG);
$success = true;
Queue::removeItem($x['id']);
} catch (Exception $e) {
logger("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG);
Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG);
}
} else {
logger('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG);
Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG);
}
if (!$success) {
logger('diaspora_queue: delayed');
Logger::log('diaspora_queue: delayed');
Queue::updateTime($x['id']);
}
}
@ -289,7 +290,7 @@ function diaspora_send(App $a, array &$b)
{
$hostname = $a->getHostName();
logger('diaspora_send: invoked');
Logger::log('diaspora_send: invoked');
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
@ -311,14 +312,14 @@ function diaspora_send(App $a, array &$b)
return;
}
logger('diaspora_send: prepare posting', LOGGER_DEBUG);
Logger::log('diaspora_send: prepare posting', LOGGER_DEBUG);
$handle = PConfig::get($b['uid'],'diaspora','handle');
$password = PConfig::get($b['uid'],'diaspora','password');
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
if ($handle && $password) {
logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
Logger::log('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
$tag_arr = [];
$tags = '';
@ -363,20 +364,20 @@ function diaspora_send(App $a, array &$b)
require_once "addon/diaspora/diasphp.php";
try {
logger('diaspora_send: prepare', LOGGER_DEBUG);
Logger::log('diaspora_send: prepare', LOGGER_DEBUG);
$conn = new Diaspora_Connection($handle, $password);
logger('diaspora_send: try to log in '.$handle, LOGGER_DEBUG);
Logger::log('diaspora_send: try to log in '.$handle, LOGGER_DEBUG);
$conn->logIn();
logger('diaspora_send: try to send '.$body, LOGGER_DEBUG);
Logger::log('diaspora_send: try to send '.$body, LOGGER_DEBUG);
$conn->provider = $hostname;
$conn->postStatusMessage($body, $aspect);
logger('diaspora_send: success');
Logger::log('diaspora_send: success');
} catch (Exception $e) {
logger("diaspora_send: Error submitting the post: " . $e->getMessage());
Logger::log("diaspora_send: Error submitting the post: " . $e->getMessage());
logger('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG);
Logger::log('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG);
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
if (count($r))

View File

@ -12,6 +12,7 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
@ -225,13 +226,13 @@ function dwpost_send(App $a, array &$b)
EOT;
logger('dwpost: data: ' . $xml, LOGGER_DATA);
Logger::log('dwpost: data: ' . $xml, LOGGER_DATA);
if ($dw_blog !== 'test') {
$x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
}
}

View File

@ -8,6 +8,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function fromapp_install()
@ -15,7 +16,7 @@ function fromapp_install()
Addon::registerHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
Addon::registerHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
Addon::registerHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("installed fromapp");
Logger::log("installed fromapp");
}
@ -24,7 +25,7 @@ function fromapp_uninstall()
Addon::unregisterHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
Addon::unregisterHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
Addon::unregisterHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("removed fromapp");
Logger::log("removed fromapp");
}
function fromapp_settings_post($a, $post)

View File

@ -12,6 +12,7 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Object\Image;
@ -126,25 +127,25 @@ function fromgplus_cron($a,$b) {
if($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
logger('fromgplus: poll intervall not reached');
Logger::log('fromgplus: poll intervall not reached');
return;
}
}
logger('fromgplus: cron_start');
Logger::log('fromgplus: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() ");
if(count($r)) {
foreach($r as $rr) {
$account = PConfig::get($rr['uid'],'fromgplus','account');
if ($account) {
logger('fromgplus: fetching for user '.$rr['uid']);
Logger::log('fromgplus: fetching for user '.$rr['uid']);
fromgplus_fetch($a, $rr['uid']);
}
}
}
logger('fromgplus: cron_end');
Logger::log('fromgplus: cron_end');
Config::set('fromgplus','last_poll', time());
}
@ -190,15 +191,15 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
$_REQUEST['coord'] = $coord;
if (($_REQUEST['title'] == "") && ($_REQUEST['body'] == "")) {
logger('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true));
Logger::log('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true));
return;
}
require_once('mod/item.php');
//print_r($_REQUEST);
logger('fromgplus: posting for user '.$uid." ".print_r($_REQUEST, true));
Logger::log('fromgplus: posting for user '.$uid." ".print_r($_REQUEST, true));
item_post($a);
logger('fromgplus: done for user '.$uid);
Logger::log('fromgplus: done for user '.$uid);
}
function fromgplus_html2bbcode($html) {
@ -472,7 +473,7 @@ function fromgplus_fetch($a, $uid) {
// Don't publish items that are too young
if (strtotime($item->published) > (time() - 3*60)) {
logger('fromgplus_fetch: item too new '.$item->published);
Logger::log('fromgplus_fetch: item too new '.$item->published);
continue;
}

View File

@ -9,6 +9,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Util\Network;
function geocoordinates_install()
@ -54,25 +55,25 @@ function geocoordinates_resolve_item(&$item)
$s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language);
if (!$s) {
logger("API could not be queried", LOGGER_DEBUG);
Logger::log("API could not be queried", LOGGER_DEBUG);
return;
}
$data = json_decode($s);
if ($data->status->code != "200") {
logger("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG);
Logger::log("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG);
return;
}
if (($data->total_results == 0) || (count($data->results) == 0)) {
logger("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
Logger::log("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
return;
}
$item["location"] = $data->results[0]->formatted;
logger("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
if ($item["location"] != "")
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);

View File

@ -24,6 +24,7 @@
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Util\Network;
use Friendica\Util\XML;
@ -52,7 +53,7 @@ function geonames_install() {
Addon::registerHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
Addon::registerHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
logger("installed geonames");
Logger::log("installed geonames");
}
@ -72,7 +73,7 @@ function geonames_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
logger("removed geonames");
Logger::log("removed geonames");
}
function geonames_load_config(\Friendica\App $a)
@ -91,7 +92,7 @@ function geonames_post_hook($a, &$item) {
*
*/
logger('geonames invoked');
Logger::log('geonames invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
@ -132,7 +133,7 @@ function geonames_post_hook($a, &$item) {
$item['location'] = $xml->geoname->name . ', ' . $xml->geoname->countryName;
// logger('geonames : ' . print_r($xml,true), LOGGER_DATA);
// Logger::log('geonames : ' . print_r($xml,true), LOGGER_DATA);
return;
}

View File

@ -9,6 +9,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function gnot_install() {
@ -17,7 +18,7 @@ function gnot_install() {
Addon::registerHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post');
Addon::registerHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
logger("installed gnot");
Logger::log("installed gnot");
}
@ -28,7 +29,7 @@ function gnot_uninstall() {
Addon::unregisterHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
logger("removed gnot");
Logger::log("removed gnot");
}

View File

@ -8,19 +8,20 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Logger
function googlemaps_install()
{
Addon::registerHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
logger("installed googlemaps");
Logger::log("installed googlemaps");
}
function googlemaps_uninstall()
{
Addon::unregisterHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location');
logger("removed googlemaps");
Logger::log("removed googlemaps");
}
function googlemaps_location($a, &$item)

View File

@ -11,6 +11,7 @@ use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Util\Security;
@ -21,7 +22,7 @@ function gravatar_install() {
Addon::registerHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
logger("registered gravatar in avatar_lookup hook");
Logger::log("registered gravatar in avatar_lookup hook");
}
/**
@ -31,7 +32,7 @@ function gravatar_uninstall() {
Addon::unregisterHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
logger("unregistered gravatar in avatar_lookup hook");
Logger::log("unregistered gravatar in avatar_lookup hook");
}
function gravatar_load_config(App $a)

View File

@ -7,6 +7,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function group_text_install() {
@ -14,7 +15,7 @@ function group_text_install() {
Addon::registerHook('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
Addon::registerHook('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
logger("installed group_text");
Logger::log("installed group_text");
}
@ -24,7 +25,7 @@ function group_text_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
logger("removed group_text");
Logger::log("removed group_text");
}

View File

@ -13,6 +13,7 @@ require_once 'include/text.php';
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -103,16 +104,16 @@ function ifttt_post(App $a)
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
if (!DBA::isResult($user)) {
logger('User ' . $nickname . ' not found.', LOGGER_DEBUG);
Logger::log('User ' . $nickname . ' not found.', LOGGER_DEBUG);
return;
}
$uid = $user['uid'];
logger('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG);
Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG);
if (!isset($_REQUEST['key'])) {
logger('No key found.');
Logger::log('No key found.');
return;
}
@ -120,7 +121,7 @@ function ifttt_post(App $a)
// Check the key
if ($key != PConfig::get($uid, 'ifttt', 'key')) {
logger('Invalid key for user ' . $uid, LOGGER_DEBUG);
Logger::log('Invalid key for user ' . $uid, LOGGER_DEBUG);
return;
}
@ -131,7 +132,7 @@ function ifttt_post(App $a)
}
if (!in_array($item['type'], ['status', 'link', 'photo'])) {
logger('Unknown item type ' . $item['type'], LOGGER_DEBUG);
Logger::log('Unknown item type ' . $item['type'], LOGGER_DEBUG);
return;
}

View File

@ -11,6 +11,7 @@
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@ -221,12 +222,12 @@ function ijpost_send(&$a, &$b)
EOT;
logger('ijpost: data: ' . $xml, LOGGER_DATA);
Logger::log('ijpost: data: ' . $xml, LOGGER_DATA);
if ($ij_blog !== 'test') {
$x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
logger('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG);
Logger::log('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG);
}
}

View File

@ -11,20 +11,21 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Util\Proxy as ProxyUtils;
function impressum_install() {
Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("installed impressum Addon");
Logger::log("installed impressum Addon");
}
function impressum_uninstall() {
Addon::unregisterHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("uninstalled impressum Addon");
Logger::log("uninstalled impressum Addon");
}
function impressum_module() {

View File

@ -66,6 +66,7 @@ use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -584,7 +585,7 @@ function jappixmini_cron(App $a, $d)
// go through list of users with jabber enabled
$users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'");
logger("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users.");
Logger::log("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users.");
if (!count($users)) {
return;

View File

@ -17,6 +17,7 @@
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
function js_upload_install() {
Addon::registerHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
@ -159,7 +160,7 @@ function js_upload_post_init(&$a,&$b) {
$a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
if(isset($result['error'])) {
logger('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG');
Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG');
echo json_encode($result);
killme();
}
@ -181,7 +182,7 @@ function js_upload_post_file(&$a,&$b) {
function js_upload_post_end(&$a,&$b) {
logger('upload_post_end');
Logger::log('upload_post_end');
if(x($a->data,'upload_jsonresponse')) {
echo $a->data['upload_jsonresponse'];
killme();

View File

@ -11,6 +11,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function krynn_install() {
@ -35,7 +36,7 @@ function krynn_install() {
Addon::registerHook('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings');
Addon::registerHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post');
logger("installed krynn");
Logger::log("installed krynn");
}
@ -54,7 +55,7 @@ function krynn_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post');
logger("removed krynn");
Logger::log("removed krynn");
}
@ -70,7 +71,7 @@ function krynn_post_hook($a, &$item) {
*
*/
logger('krynn invoked');
Logger::log('krynn invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;

View File

@ -55,6 +55,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Model\User;
function ldapauth_install()
@ -99,28 +100,28 @@ function ldapauth_authenticate($username, $password)
$ldap_autocreateaccount_nameattribute = Config::get('ldapauth', 'ldap_autocreateaccount_nameattribute');
if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) {
logger("ldapauth: not configured or missing php-ldap module");
Logger::log("ldapauth: not configured or missing php-ldap module");
return false;
}
$connect = @ldap_connect($ldap_server);
if ($connect === false) {
logger("ldapauth: could not connect to $ldap_server");
Logger::log("ldapauth: could not connect to $ldap_server");
return false;
}
@ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
if ((@ldap_bind($connect, $ldap_binddn, $ldap_bindpw)) === false) {
logger("ldapauth: could not bind $ldap_server as $ldap_binddn");
Logger::log("ldapauth: could not bind $ldap_server as $ldap_binddn");
return false;
}
$res = @ldap_search($connect, $ldap_searchdn, $ldap_userattr . '=' . $username);
if (!$res) {
logger("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found");
Logger::log("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found");
return false;
}
@ -161,13 +162,13 @@ function ldapauth_authenticate($username, $password)
@ldap_close($connect);
if ($eno === 32) {
logger("ldapauth: access control group Does Not Exist");
Logger::log("ldapauth: access control group Does Not Exist");
return false;
} elseif ($eno === 16) {
logger('ldapauth: membership attribute does not exist in access control group');
Logger::log('ldapauth: membership attribute does not exist in access control group');
return false;
} else {
logger('ldapauth: error: ' . $err);
Logger::log('ldapauth: error: ' . $err);
return false;
}
} elseif ($r === false) {
@ -189,12 +190,12 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $
try {
User::create($arr);
logger("ldapauth: account " . $username . " created");
Logger::log("ldapauth: account " . $username . " created");
} catch (Exception $ex) {
logger("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage());
Logger::log("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage());
}
} else {
logger("ldapauth: unable to create account, no email or nickname found");
Logger::log("ldapauth: unable to create account, no email or nickname found");
}
}
}

View File

@ -7,6 +7,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Util\Network;
function leistungsschutzrecht_install() {
@ -163,7 +164,7 @@ function leistungsschutzrecht_cron($a,$b) {
if($last) {
$next = $last + 86400;
if($next > time()) {
logger('poll intervall not reached');
Logger::log('poll intervall not reached');
return;
}
}

View File

@ -9,6 +9,7 @@
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
use Friendica\Util\Network;
@ -157,7 +158,7 @@ function libertree_post_local(&$a,&$b) {
function libertree_send(&$a,&$b) {
logger('libertree_send: invoked');
Logger::log('libertree_send: invoked');
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
@ -232,6 +233,6 @@ function libertree_send(&$a,&$b) {
];
$result = Network::post($ltree_blog, $params)->getBody();
logger('libertree: ' . $result);
Logger::log('libertree: ' . $result);
}
}

View File

@ -11,6 +11,7 @@ use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Util\Security;
@ -21,7 +22,7 @@ function libravatar_install()
{
Addon::registerHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config');
Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("registered libravatar in avatar_lookup hook");
Logger::log("registered libravatar in avatar_lookup hook");
}
/**
@ -31,7 +32,7 @@ function libravatar_uninstall()
{
Addon::unregisterHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config');
Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("unregistered libravatar in avatar_lookup hook");
Logger::log("unregistered libravatar in avatar_lookup hook");
}
function libravatar_load_config(App $a)

View File

@ -11,6 +11,7 @@
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@ -231,12 +232,12 @@ function ljpost_send(&$a,&$b) {
EOT;
logger('ljpost: data: ' . $xml, LOGGER_DATA);
Logger::log('ljpost: data: ' . $xml, LOGGER_DATA);
if ($lj_blog !== 'test') {
$x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
Logger::log('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
}
}

View File

@ -10,6 +10,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
use Friendica\Util\Network;
@ -94,7 +95,7 @@ function mailstream_generate_id($a, $uri) {
$host = $a->getHostName();
$resource = hash('md5', $uri);
$message_id = "<" . $resource . "@" . $host . ">";
logger('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG);
Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG);
return $message_id;
}
@ -123,16 +124,16 @@ function mailstream_post_hook(&$a, &$item) {
intval($item['contact-id']), DBA::escape($item['uri']), DBA::escape($message_id));
$r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), DBA::escape($item['uri']));
if (count($r) != 1) {
logger('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO);
Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO);
return;
}
$ms_item = $r[0];
logger('mailstream_post_remote_hook: created mailstream_item '
Logger::log('mailstream_post_remote_hook: created mailstream_item '
. $ms_item['id'] . ' for item ' . $item['uri'] . ' '
. $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA);
$user = mailstream_get_user($item['uid']);
if (!$user) {
logger('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO);
Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO);
return;
}
mailstream_send($a, $ms_item['message-id'], $item, $user);
@ -141,7 +142,7 @@ function mailstream_post_hook(&$a, &$item) {
function mailstream_get_user($uid) {
$r = q('SELECT * FROM `user` WHERE `uid` = %d', intval($uid));
if (count($r) != 1) {
logger('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO);
Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO);
return;
}
return $r[0];
@ -298,11 +299,11 @@ function mailstream_send($a, $message_id, $item, $user) {
if (!$mail->Send()) {
throw new Exception($mail->ErrorInfo);
}
logger('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG);
Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG);
} catch (phpmailerException $e) {
logger('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO);
Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO);
} catch (Exception $e) {
logger('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO);
Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO);
}
// In case of failure, still set the item to completed. Otherwise
// we'll just try to send it over and over again and it'll fail
@ -331,10 +332,10 @@ function mailstream_cron($a, $b) {
// mailstream_post_remote_hook fails for some reason will this get
// used, and in that case it's worth holding off a bit anyway.
$ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `item`.`id` FROM `mailstream_item` JOIN `item` ON (`mailstream_item`.`uid` = `item`.`uid` AND `mailstream_item`.`uri` = `item`.`uri` AND `mailstream_item`.`contact-id` = `item`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `item`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100");
logger('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG);
Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG);
foreach ($ms_item_ids as $ms_item_id) {
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
logger('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO);
Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO);
}
$item = Item::selectFirst([], ['id' => $ms_item_id['id']]);
$users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid']));
@ -343,7 +344,7 @@ function mailstream_cron($a, $b) {
mailstream_send($a, $ms_item_id['message-id'], $item, $user);
}
else {
logger('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO);
Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO);
q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item['message-id']));
}
}
@ -412,5 +413,5 @@ function mailstream_tidy() {
foreach ($r as $rr) {
q('DELETE FROM mailstream_item WHERE id = %d', intval($rr['id']));
}
logger('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG);
Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG);
}

View File

@ -10,11 +10,12 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
function newmemberwidget_install()
{
Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init');
logger('newmemberwidget installed');
Logger::log('newmemberwidget installed');
}
function newmemberwidget_uninstall()

View File

@ -12,16 +12,17 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Util\Emailer;
function notifyall_install()
{
logger("installed notifyall");
Logger::log("installed notifyall");
}
function notifyall_uninstall()
{
logger("removed notifyall");
Logger::log("removed notifyall");
}
function notifyall_module() {}

View File

@ -7,6 +7,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function numfriends_install() {
@ -14,7 +15,7 @@ function numfriends_install() {
Addon::registerHook('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings');
Addon::registerHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
logger("installed numfriends");
Logger::log("installed numfriends");
}
@ -24,7 +25,7 @@ function numfriends_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
logger("removed numfriends");
Logger::log("removed numfriends");
}
/**

View File

@ -12,6 +12,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Util\Network;
@ -29,7 +30,7 @@ function openstreetmap_install()
Addon::registerHook('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates');
Addon::registerHook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
logger("installed openstreetmap");
Logger::log("installed openstreetmap");
}
function openstreetmap_uninstall()
@ -41,7 +42,7 @@ function openstreetmap_uninstall()
Addon::unregisterHook('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates');
Addon::unregisterHook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader');
logger("removed openstreetmap");
Logger::log("removed openstreetmap");
}
function openstreetmap_load_config(\Friendica\App $a)
@ -165,8 +166,8 @@ function openstreetmap_generate_map(&$a, &$b)
$lat = $b['lat']; // round($b['lat'], 5);
$lon = $b['lon']; // round($b['lon'], 5);
logger('lat: ' . $lat, LOGGER_DATA);
logger('lon: ' . $lon, LOGGER_DATA);
Logger::log('lat: ' . $lat, LOGGER_DATA);
Logger::log('lon: ' . $lon, LOGGER_DATA);
$cardlink = '<a href="' . $tmsserver;
@ -184,7 +185,7 @@ function openstreetmap_generate_map(&$a, &$b)
$b['html'] .= '<br/>' . $cardlink;
}
logger('generate_map: ' . $b['html'], LOGGER_DATA);
Logger::log('generate_map: ' . $b['html'], LOGGER_DATA);
}
function openstreetmap_addon_admin(&$a, &$o)

View File

@ -33,19 +33,20 @@
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
function piwik_install() {
Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("installed piwik addon");
Logger::log("installed piwik addon");
}
function piwik_uninstall() {
Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("uninstalled piwik addon");