From: Roland Haeder Date: Thu, 18 Sep 2014 21:52:44 +0000 (+0200) Subject: Use common_debug() instead of common_log(LOG_DEBUG, ) to minimize code duplication. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a69b0c181e193e51f3ae46ed4f2a50f9b7d8141f;p=quix0rs-gnu-social.git Use common_debug() instead of common_log(LOG_DEBUG, ) to minimize code duplication. Signed-off-by: Roland Haeder --- diff --git a/actions/peopletagautocomplete.php b/actions/peopletagautocomplete.php index 3321187bba..dc083fd028 100644 --- a/actions/peopletagautocomplete.php +++ b/actions/peopletagautocomplete.php @@ -114,7 +114,7 @@ class PeopletagautocompleteAction extends Action */ function handle(array $args=array()) { - //common_log(LOG_DEBUG, 'Autocomplete data: ' . json_encode($this->tags)); + //common_debug('Autocomplete data: ' . json_encode($this->tags)); if ($this->tags) { print(json_encode($this->tags)); exit(0); diff --git a/classes/Avatar.php b/classes/Avatar.php index 55abc81b33..6a58c74559 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -70,10 +70,14 @@ class Avatar extends Managed_DataObject public static function deleteFromProfile(Profile $target, $original=true) { try { $avatars = self::getProfileAvatars($target); + foreach ($avatars as $avatar) { + assert($avatar instanceof Avatar); + if ($avatar->original && !$original) { continue; } + $avatar->delete(); } } catch (NoAvatarException $e) { @@ -97,6 +101,7 @@ class Avatar extends Managed_DataObject } $size = "{$width}x{$height}"; + if (!isset(self::$_avatars[$target->id])) { self::$_avatars[$target->id] = array(); } elseif (isset(self::$_avatars[$target->id][$size])){ @@ -104,6 +109,7 @@ class Avatar extends Managed_DataObject } $avatar = null; + if (Event::handle('StartProfileGetAvatar', array($target, $width, &$avatar))) { $avatar = self::pkeyGet( array( @@ -112,6 +118,7 @@ class Avatar extends Managed_DataObject 'height' => $height, ) ); + Event::handle('EndProfileGetAvatar', array($target, $width, &$avatar)); } @@ -184,7 +191,7 @@ class Avatar extends Managed_DataObject } if ($path[0] != '/') { - $path = '/'.$path; + $path = '/' . $path; } $server = common_config('avatar', 'server'); @@ -232,7 +239,7 @@ class Avatar extends Managed_DataObject static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); - return Theme::path('default-avatar-'.$sizenames[$size].'.png'); + return Theme::path('default-avatar-' . $sizenames[$size] . '.png'); } static function newSize(Profile $target, $width) { diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 2bd9581cf6..76358cbe13 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -650,7 +650,7 @@ class Memcached_DataObject extends Safe_DataObject } else { $msg = sprintf("DB query (%0.3fs): %s", $delta, $clean); } - common_log(LOG_DEBUG, $msg); + common_debug($msg); } if ($fail) { diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php index 3764c827cb..3a9b005b2f 100644 --- a/lib/attachmentlistitem.php +++ b/lib/attachmentlistitem.php @@ -214,7 +214,7 @@ class AttachmentListItem extends Widget $scripts[] = $script; } foreach ($scripts as $script) { - common_log(LOG_DEBUG, $script->textContent); + common_debug($script->textContent); $script->parentNode->removeChild($script); } diff --git a/lib/iomaster.php b/lib/iomaster.php index 7072761f2d..e53fc6511e 100644 --- a/lib/iomaster.php +++ b/lib/iomaster.php @@ -152,7 +152,7 @@ abstract class IoMaster if ($timeout > 0 && empty($sockets)) { // If we had no listeners, sleep until the pollers' next requested wakeup. - common_log(LOG_DEBUG, "Sleeping $timeout seconds until next poll cycle..."); + common_debug("Sleeping $timeout seconds until next poll cycle..."); $this->logState('sleep'); sleep($timeout); } @@ -190,7 +190,7 @@ abstract class IoMaster } } else if (common_config('queue', 'debug_memory')) { $fmt = number_format($usage); - common_log(LOG_DEBUG, "Memory usage $fmt"); + common_debug("Memory usage $fmt"); } } } diff --git a/lib/schemaupdater.php b/lib/schemaupdater.php index 1960a06930..d336135464 100644 --- a/lib/schemaupdater.php +++ b/lib/schemaupdater.php @@ -60,12 +60,12 @@ class SchemaUpdater foreach ($this->tables as $table => $def) { $checksum = $this->checksum($def); if (empty($checksums[$table])) { - common_log(LOG_DEBUG, "No previous schema_version for $table: updating to $checksum"); + common_debug("No previous schema_version for $table: updating to $checksum"); } else if ($checksums[$table] == $checksum) { - common_log(LOG_DEBUG, "Last schema_version for $table up to date: $checksum"); + common_debug("Last schema_version for $table up to date: $checksum"); continue; } else { - common_log(LOG_DEBUG, "Last schema_version for $table is {$checksums[$table]}: updating to $checksum"); + common_debug("Last schema_version for $table is {$checksums[$table]}: updating to $checksum"); } //$this->conn->query('BEGIN'); $this->schema->ensureTable($table, $def); @@ -106,7 +106,7 @@ class SchemaUpdater return $checksums; } catch (Exception $e) { // no dice! - common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet."); + common_debug("Possibly schema_version table doesn't exist yet."); } PEAR::popErrorHandling(); @@ -134,7 +134,7 @@ class SchemaUpdater } } catch (Exception $e) { // no dice! - common_log(LOG_DEBUG, "Possibly schema_version table doesn't exist yet."); + common_debug("Possibly schema_version table doesn't exist yet."); } PEAR::popErrorHandling(); $this->checksums[$table] = $checksum; diff --git a/lib/util.php b/lib/util.php index b0a7eeb740..7ff4f12d22 100644 --- a/lib/util.php +++ b/lib/util.php @@ -2311,7 +2311,7 @@ function common_perf_counter($key, $val=null) $_perfCounters[$key] = array($val); } if (common_config('site', 'logperf_detail')) { - common_log(LOG_DEBUG, "PERF COUNTER HIT: $key $val"); + common_debug("PERF COUNTER HIT: $key $val"); } } } @@ -2325,14 +2325,14 @@ function common_log_perf_counters() if (isset($_startTime)) { $endTime = microtime(true); $diff = round(($endTime - $_startTime) * 1000); - common_log(LOG_DEBUG, "PERF runtime: ${diff}ms"); + common_debug("PERF runtime: ${diff}ms"); } $counters = $_perfCounters; ksort($counters); foreach ($counters as $key => $values) { $count = count($values); $unique = count(array_unique($values)); - common_log(LOG_DEBUG, "PERF COUNTER: $key $count ($unique unique)"); + common_debug("PERF COUNTER: $key $count ($unique unique)"); } } } diff --git a/plugins/Aim/lib/aimmanager.php b/plugins/Aim/lib/aimmanager.php index 619a9ad0a7..dab41755b3 100644 --- a/plugins/Aim/lib/aimmanager.php +++ b/plugins/Aim/lib/aimmanager.php @@ -63,7 +63,7 @@ class AimManager extends ImManager */ public function handleInput($socket) { - common_log(LOG_DEBUG, "Servicing the AIM queue."); + common_debug("Servicing the AIM queue."); $this->stats('aim_process'); $this->conn->receive(); } diff --git a/plugins/Event/EventPlugin.php b/plugins/Event/EventPlugin.php index 5bc4716c94..7f95bd7955 100644 --- a/plugins/Event/EventPlugin.php +++ b/plugins/Event/EventPlugin.php @@ -292,20 +292,20 @@ class EventPlugin extends MicroAppPlugin { switch ($notice->object_type) { case Happening::OBJECT_TYPE: - common_log(LOG_DEBUG, "Deleting event from notice..."); + common_debug("Deleting event from notice..."); $happening = Happening::fromNotice($notice); $happening->delete(); break; case RSVP::POSITIVE: case RSVP::NEGATIVE: case RSVP::POSSIBLE: - common_log(LOG_DEBUG, "Deleting rsvp from notice..."); + common_debug("Deleting rsvp from notice..."); $rsvp = RSVP::fromNotice($notice); - common_log(LOG_DEBUG, "to delete: $rsvp->id"); + common_debug("to delete: $rsvp->id"); $rsvp->delete(); break; default: - common_log(LOG_DEBUG, "Not deleting related, wtf..."); + common_debug("Not deleting related, wtf..."); } } diff --git a/plugins/Event/actions/cancelrsvp.php b/plugins/Event/actions/cancelrsvp.php index bb13deaa68..1669226523 100644 --- a/plugins/Event/actions/cancelrsvp.php +++ b/plugins/Event/actions/cancelrsvp.php @@ -137,10 +137,10 @@ class CancelrsvpAction extends Action $notice = $this->rsvp->getNotice(); // NB: this will delete the rsvp, too if (!empty($notice)) { - common_log(LOG_DEBUG, "Deleting notice..."); + common_debug("Deleting notice..."); $notice->delete(); } else { - common_log(LOG_DEBUG, "Deleting RSVP alone..."); + common_debug("Deleting RSVP alone..."); $this->rsvp->delete(); } } catch (ClientException $ce) { diff --git a/plugins/Favorite/actions/apifavoritecreate.php b/plugins/Favorite/actions/apifavoritecreate.php index 8368632658..ea94958ebc 100644 --- a/plugins/Favorite/actions/apifavoritecreate.php +++ b/plugins/Favorite/actions/apifavoritecreate.php @@ -64,8 +64,8 @@ class ApiFavoriteCreateAction extends ApiAuthAction $this->user = $this->auth_user; $this->notice = Notice::getKV($this->arg('id')); if ($this->notice->repeat_of != '' ) { - common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of); - common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead'); + common_debug('Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of); + common_debug('Will Fave '.$this->notice->repeat_of.' instead'); $real_notice_id = $this->notice->repeat_of; $this->notice = Notice::getKV($real_notice_id); } diff --git a/plugins/Favorite/actions/apifavoritedestroy.php b/plugins/Favorite/actions/apifavoritedestroy.php index 62a5c37ce1..03472ce6ba 100644 --- a/plugins/Favorite/actions/apifavoritedestroy.php +++ b/plugins/Favorite/actions/apifavoritedestroy.php @@ -64,8 +64,8 @@ class ApiFavoriteDestroyAction extends ApiAuthAction $this->user = $this->auth_user; $this->notice = Notice::getKV($this->arg('id')); if ($this->notice->repeat_of != '' ) { - common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id); - common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead'); + common_debug('Trying to unFave '.$this->notice->id); + common_debug('Will unFave '.$this->notice->repeat_of.' instead'); $real_notice_id = $this->notice->repeat_of; $this->notice = Notice::getKV($real_notice_id); } diff --git a/plugins/Gravatar/GravatarPlugin.php b/plugins/Gravatar/GravatarPlugin.php index cf9e3a01fe..637674b1db 100644 --- a/plugins/Gravatar/GravatarPlugin.php +++ b/plugins/Gravatar/GravatarPlugin.php @@ -30,7 +30,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { class GravatarPlugin extends Plugin { - function onEndProfileGetAvatar($profile, $size, &$avatar) + function onEndProfileGetAvatar(Profile $profile, $size, &$avatar) { if (empty($avatar)) { try { @@ -52,10 +52,10 @@ class GravatarPlugin extends Plugin function gravatar_url($email, $size) { - $url = "https://secure.gravatar.com/avatar.php?gravatar_id=". - md5(strtolower($email)). - "&default=".urlencode(Avatar::defaultImage($size)). - "&size=".$size; + $url = 'https://secure.gravatar.com/avatar.php?gravatar_id=' . + md5(strtolower($email)) . + '&default=' . urlencode(Avatar::defaultImage($size)) . + '&size=' . $size; return $url; } diff --git a/plugins/Irc/lib/ircmanager.php b/plugins/Irc/lib/ircmanager.php index 021fe190e3..11ba2bd7ed 100644 --- a/plugins/Irc/lib/ircmanager.php +++ b/plugins/Irc/lib/ircmanager.php @@ -126,7 +126,7 @@ class IrcManager extends ImManager { * @return void */ public function handleInput($socket) { - common_log(LOG_DEBUG, 'Servicing the IRC queue.'); + common_debug('Servicing the IRC queue.'); $this->stats('irc_process'); try { diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index c5c9e54563..6652647771 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -539,7 +539,7 @@ class OStatusPlugin extends Plugin if ($oprofile instanceof Ostatus_profile) { $oprofile->processFeed($feed, 'push'); } else { - common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri"); + common_debug("No ostatus profile for incoming feed $feedsub->uri"); } } @@ -1143,7 +1143,7 @@ class OStatusPlugin extends Plugin $oprofile->query(sprintf($sql, $profile->id, $profile->id)); if ($oprofile->N == 0) { - common_log(LOG_DEBUG, "No OStatus remote subscribees for $profile->nickname"); + common_debug("No OStatus remote subscribees for $profile->nickname"); return true; } diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php index fb41c42ad3..16286269b2 100644 --- a/plugins/OStatus/actions/pushhub.php +++ b/plugins/OStatus/actions/pushhub.php @@ -178,9 +178,9 @@ class PushHubAction extends Action return true; } } - common_log(LOG_DEBUG, "Not a user, group or people tag feed? $feed $userFeed $groupFeed $listFeed"); + common_debug("Not a user, group or people tag feed? $feed $userFeed $groupFeed $listFeed"); } - common_log(LOG_DEBUG, "LOST $feed"); + common_debug("LOST $feed"); return false; } diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 42b883361e..a1499fe3a7 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -915,7 +915,7 @@ class Ostatus_profile extends Managed_DataObject */ static public function filterAttention(Profile $sender, array $attention) { - common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', array_keys($attention))); + common_debug("Original reply recipients: " . implode(', ', array_keys($attention))); $groups = array(); $replies = array(); foreach ($attention as $recipient=>$type) { @@ -937,11 +937,11 @@ class Ostatus_profile extends Managed_DataObject if ($sender->isMember($group)) { $groups[] = $group->id; } else { - common_log(LOG_DEBUG, sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id)); + common_debug(sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id)); } continue; } else { - common_log(LOG_DEBUG, "Skipping reply to bogus group $recipient"); + common_debug("Skipping reply to bogus group $recipient"); } } @@ -959,12 +959,12 @@ class Ostatus_profile extends Managed_DataObject continue; } catch (Exception $e) { // Neither a recognizable local nor remote user! - common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); + common_debug("Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); } } - common_log(LOG_DEBUG, "Local reply recipients: " . implode(', ', $replies)); - common_log(LOG_DEBUG, "Local group recipients: " . implode(', ', $groups)); + common_debug("Local reply recipients: " . implode(', ', $replies)); + common_debug("Local group recipients: " . implode(', ', $groups)); return array($groups, $replies); } @@ -1465,7 +1465,7 @@ class Ostatus_profile extends Managed_DataObject $discover = false; if (!$homeuri) { - common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true)); + common_debug(__METHOD__ . " empty actor profile URI: " . var_export($activity, true)); // TRANS: Exception. throw new Exception(_m('No profile URI.')); } @@ -1707,7 +1707,7 @@ class Ostatus_profile extends Managed_DataObject // @todo tags from categories if ($profile->id) { - common_log(LOG_DEBUG, "Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $profile->update($orig); } } @@ -1731,7 +1731,7 @@ class Ostatus_profile extends Managed_DataObject $group->homepage = self::getActivityObjectHomepage($object, $hints); if ($group->id) { // If no id, we haven't called insert() yet, so don't run update() - common_log(LOG_DEBUG, "Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $group->update($orig); } } @@ -1752,7 +1752,7 @@ class Ostatus_profile extends Managed_DataObject $tag->tagger = $tagger->profile_id; if ($tag->id) { - common_log(LOG_DEBUG, "Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $tag->update($orig); } } diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index 4f240cc9b8..d806a848ea 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -270,19 +270,19 @@ class MagicEnvelope public function verify(Profile $profile) { if ($this->alg != 'RSA-SHA256') { - common_log(LOG_DEBUG, "Salmon error: bad algorithm"); + common_debug("Salmon error: bad algorithm"); return false; } if ($this->encoding != self::ENCODING) { - common_log(LOG_DEBUG, "Salmon error: bad encoding"); + common_debug("Salmon error: bad encoding"); return false; } try { $magicsig = $this->getKeyPair($profile, true); // Do discovery too if necessary } catch (Exception $e) { - common_log(LOG_DEBUG, "Salmon error: ".$e->getMessage()); + common_debug("Salmon error: ".$e->getMessage()); return false; } diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index d26c1f949b..bb3a6180d8 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -61,7 +61,7 @@ class SalmonAction extends Action // Cryptographic verification test if (!$magic_env->verify($profile)) { - common_log(LOG_DEBUG, "Salmon signature verification failed."); + common_debug("Salmon signature verification failed."); // TRANS: Client error. $this->clientError(_m('Salmon signature verification failed.')); } @@ -80,7 +80,7 @@ class SalmonAction extends Action { parent::handle(); - common_log(LOG_DEBUG, "Got a " . $this->activity->verb); + common_debug("Got a " . $this->activity->verb); try { if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) && Event::handle('StartHandleSalmon', array($this->activity))) { diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index 3013c9c8e0..0c48906b5d 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -346,7 +346,7 @@ function oid_check_teams($response) $match = in_array($requiredTeam, $teams); $is = $match ? 'is' : 'is not'; - common_log(LOG_DEBUG, "Remote user $is in required team $requiredTeam: [" . implode(', ', $teams) . "]"); + common_debug("Remote user $is in required team $requiredTeam: [" . implode(', ', $teams) . "]"); return $match; } diff --git a/plugins/Poll/PollPlugin.php b/plugins/Poll/PollPlugin.php index ee02aae3d3..c9a4690630 100644 --- a/plugins/Poll/PollPlugin.php +++ b/plugins/Poll/PollPlugin.php @@ -172,9 +172,9 @@ class PollPlugin extends MicroAppPlugin function saveNoticeFromActivity(Activity $activity, Profile $profile, array $options=array()) { // @fixme - common_log(LOG_DEBUG, "XXX activity: " . var_export($activity, true)); - common_log(LOG_DEBUG, "XXX profile: " . var_export($profile, true)); - common_log(LOG_DEBUG, "XXX options: " . var_export($options, true)); + common_debug("XXX activity: " . var_export($activity, true)); + common_debug("XXX profile: " . var_export($profile, true)); + common_debug("XXX options: " . var_export($options, true)); // Ok for now, we can grab stuff from the XML entry directly. // This won't work when reading from JSON source @@ -194,10 +194,10 @@ class PollPlugin extends MicroAppPlugin } try { $notice = Poll::saveNew($profile, $question, $opts, $options); - common_log(LOG_DEBUG, "Saved Poll from ActivityStream data ok: notice id " . $notice->id); + common_debug("Saved Poll from ActivityStream data ok: notice id " . $notice->id); return $notice; } catch (Exception $e) { - common_log(LOG_DEBUG, "Poll save from ActivityStream data failed: " . $e->getMessage()); + common_debug("Poll save from ActivityStream data failed: " . $e->getMessage()); } } else if ($responseElements->length) { $data = $responseElements->item(0); @@ -215,13 +215,13 @@ class PollPlugin extends MicroAppPlugin } try { $notice = Poll_response::saveNew($profile, $poll, $selection, $options); - common_log(LOG_DEBUG, "Saved Poll_response ok, notice id: " . $notice->id); + common_debug("Saved Poll_response ok, notice id: " . $notice->id); return $notice; } catch (Exception $e) { - common_log(LOG_DEBUG, "Poll response save fail: " . $e->getMessage()); + common_debug("Poll response save fail: " . $e->getMessage()); } } else { - common_log(LOG_DEBUG, "YYY no poll data"); + common_debug("YYY no poll data"); } } } @@ -348,7 +348,7 @@ class PollPlugin extends MicroAppPlugin */ public function activityObjectOutputJson(ActivityObject $obj, array &$out) { - common_log(LOG_DEBUG, 'QQQ: ' . var_export($obj, true)); + common_debug('QQQ: ' . var_export($obj, true)); if (isset($obj->pollQuestion)) { /** * "poll": { diff --git a/plugins/Poll/classes/Poll.php b/plugins/Poll/classes/Poll.php index fe51c667d5..1544142028 100644 --- a/plugins/Poll/classes/Poll.php +++ b/plugins/Poll/classes/Poll.php @@ -193,7 +193,7 @@ class Poll extends Managed_DataObject array('id' => $p->id)); } - common_log(LOG_DEBUG, "Saving poll: $p->id $p->uri"); + common_debug("Saving poll: $p->id $p->uri"); $p->insert(); // TRANS: Notice content creating a poll. diff --git a/plugins/Poll/classes/Poll_response.php b/plugins/Poll/classes/Poll_response.php index 20b7700147..0fc08443fa 100644 --- a/plugins/Poll/classes/Poll_response.php +++ b/plugins/Poll/classes/Poll_response.php @@ -155,7 +155,7 @@ class Poll_response extends Managed_DataObject array('id' => $pr->id)); } - common_log(LOG_DEBUG, "Saving poll response: $pr->id $pr->uri"); + common_debug("Saving poll response: $pr->id $pr->uri"); $pr->insert(); // TRANS: Notice content voting for a poll. diff --git a/plugins/PostDebug/PostDebugPlugin.php b/plugins/PostDebug/PostDebugPlugin.php index 120feee8fe..cfeb81cf2a 100644 --- a/plugins/PostDebug/PostDebugPlugin.php +++ b/plugins/PostDebug/PostDebugPlugin.php @@ -81,7 +81,7 @@ class PostDebugPlugin extends Plugin $file = $this->dir . DIRECTORY_SEPARATOR . $this->logFileName(); file_put_contents($file, $output); } else { - common_log(LOG_DEBUG, "PostDebug: $output"); + common_debug("PostDebug: $output"); } } diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index bbb5fe8b5d..184274506f 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -424,18 +424,18 @@ class QnAPlugin extends MicroAppPlugin { switch ($notice->object_type) { case QnA_Question::OBJECT_TYPE: - common_log(LOG_DEBUG, "Deleting question from notice..."); + common_debug("Deleting question from notice..."); $question = QnA_Question::fromNotice($notice); $question->delete(); break; case QnA_Answer::OBJECT_TYPE: - common_log(LOG_DEBUG, "Deleting answer from notice..."); + common_debug("Deleting answer from notice..."); $answer = QnA_Answer::fromNotice($notice); - common_log(LOG_DEBUG, "to delete: $answer->id"); + common_debug("to delete: $answer->id"); $answer->delete(); break; default: - common_log(LOG_DEBUG, "Not deleting related, wtf..."); + common_debug("Not deleting related, wtf..."); } } diff --git a/plugins/QnA/classes/QnA_Answer.php b/plugins/QnA/classes/QnA_Answer.php index 9db52985ad..70285cfe14 100644 --- a/plugins/QnA/classes/QnA_Answer.php +++ b/plugins/QnA/classes/QnA_Answer.php @@ -254,7 +254,7 @@ class QnA_Answer extends Managed_DataObject array('id' => $answer->id) ); - common_log(LOG_DEBUG, "Saving answer: $answer->id, $answer->uri"); + common_debug("Saving answer: $answer->id, $answer->uri"); $answer->insert(); $content = sprintf( diff --git a/plugins/QnA/classes/QnA_Question.php b/plugins/QnA/classes/QnA_Question.php index b421b0aed1..66eb1b1236 100644 --- a/plugins/QnA/classes/QnA_Question.php +++ b/plugins/QnA/classes/QnA_Question.php @@ -261,7 +261,7 @@ class QnA_Question extends Managed_DataObject ); } - common_log(LOG_DEBUG, "Saving question: $q->id $q->uri"); + common_debug("Saving question: $q->id $q->uri"); $q->insert(); if (Notice::contentTooLong($q->title . ' ' . $q->uri)) { diff --git a/plugins/QnA/classes/QnA_Vote.php b/plugins/QnA/classes/QnA_Vote.php index 13679acd2c..9bed5b15b3 100644 --- a/plugins/QnA/classes/QnA_Vote.php +++ b/plugins/QnA/classes/QnA_Vote.php @@ -120,7 +120,7 @@ class QnA_Vote extends Managed_DataObject $v->vote = $vote; $v->created = common_sql_now(); - common_log(LOG_DEBUG, "Saving vote: $v->id $v->vote"); + common_debug("Saving vote: $v->id $v->vote"); $v->insert(); } diff --git a/plugins/SQLProfile/SQLProfilePlugin.php b/plugins/SQLProfile/SQLProfilePlugin.php index a7912844c2..bacb1f2a95 100644 --- a/plugins/SQLProfile/SQLProfilePlugin.php +++ b/plugins/SQLProfile/SQLProfilePlugin.php @@ -58,7 +58,7 @@ class SQLProfilePlugin extends Plugin (strpos($extra, 'Using temporary') !== false); if ($evil) { $xquery = $xobj->sanitizeQuery($query); - common_log(LOG_DEBUG, "$extra | $xquery"); + common_debug("$extra | $xquery"); } } } diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index 47ba57f7ba..6be0abe3a8 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -157,7 +157,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon return; } - common_log(LOG_DEBUG, $this->name() . ' - Trying to get ' . $timelineUri . + common_debug($this->name() . ' - Trying to get ' . $timelineUri . ' timeline for Twitter user ' . $flink->foreign_id); $client = null; @@ -165,7 +165,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon if (TwitterOAuthClient::isPackedToken($flink->credentials)) { $token = TwitterOAuthClient::unpackToken($flink->credentials); $client = new TwitterOAuthClient($token->key, $token->secret); - common_log(LOG_DEBUG, $this->name() . ' - Grabbing ' . $timelineUri . ' timeline with OAuth.'); + common_debug($this->name() . ' - Grabbing ' . $timelineUri . ' timeline with OAuth.'); } else { common_log(LOG_ERR, "Skipping " . $timelineUri . " timeline for " . $flink->foreign_id . " since not OAuth."); @@ -175,7 +175,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon $lastId = Twitter_synch_status::getLastId($flink->foreign_id, $timelineUri); - common_log(LOG_DEBUG, "Got lastId value '" . $lastId . "' for foreign id '" . + common_debug("Got lastId value '" . $lastId . "' for foreign id '" . $flink->foreign_id . "' and timeline '" . $timelineUri. "'"); try { diff --git a/plugins/TwitterBridge/lib/jsonstreamreader.php b/plugins/TwitterBridge/lib/jsonstreamreader.php index f6ec1f3f50..147f398da2 100644 --- a/plugins/TwitterBridge/lib/jsonstreamreader.php +++ b/plugins/TwitterBridge/lib/jsonstreamreader.php @@ -55,7 +55,7 @@ abstract class JsonStreamReader */ public function connect($url) { - common_log(LOG_DEBUG, "$this->id opening connection to $url"); + common_debug("$this->id opening connection to $url"); $scheme = parse_url($url, PHP_URL_SCHEME); if ($scheme == 'http') { @@ -143,7 +143,7 @@ abstract class JsonStreamReader public function close() { if ($this->isConnected()) { - common_log(LOG_DEBUG, "$this->id closing connection."); + common_debug("$this->id closing connection."); fclose($this->socket); $this->socket = null; } @@ -242,7 +242,7 @@ abstract class JsonStreamReader // TRANS: %1$s is the response code, %2$s is the line. throw new Exception(sprintf(_m('Bad HTTP response code %1$s: %2$s.'),$status,$line)); } - common_log(LOG_DEBUG, "$this->id $line"); + common_debug("$this->id $line"); $this->state = 'headers'; } @@ -250,9 +250,9 @@ abstract class JsonStreamReader { if ($line == '') { $this->state = 'active'; - common_log(LOG_DEBUG, "$this->id connection is active!"); + common_debug("$this->id connection is active!"); } else { - common_log(LOG_DEBUG, "$this->id read HTTP header: $line"); + common_debug("$this->id read HTTP header: $line"); $this->responseHeaders[] = $line; } } diff --git a/plugins/TwitterBridge/lib/tweetinqueuehandler.php b/plugins/TwitterBridge/lib/tweetinqueuehandler.php index cc0c05f9a6..3fd5b607a8 100644 --- a/plugins/TwitterBridge/lib/tweetinqueuehandler.php +++ b/plugins/TwitterBridge/lib/tweetinqueuehandler.php @@ -53,7 +53,7 @@ class TweetInQueueHandler extends QueueHandler if ($notice instanceof Notice) { $flink = Foreign_link::getByForeignID($receiver, TWITTER_SERVICE); if ($flink instanceof Foreign_link) { - common_log(LOG_DEBUG, "TweetInQueueHandler - Got flink so add notice ". + common_debug("TweetInQueueHandler - Got flink so add notice ". $notice->id." to attentions for user ".$flink->user_id); try { Attention::saveNew($notice, $flink->getProfile()); @@ -64,7 +64,7 @@ class TweetInQueueHandler extends QueueHandler $e->getMessage()); } } else { - common_log(LOG_DEBUG, "TweetInQueueHandler - No flink found for foreign user ".$receiver); + common_debug("TweetInQueueHandler - No flink found for foreign user ".$receiver); } } diff --git a/plugins/WikiHowProfile/WikiHowProfilePlugin.php b/plugins/WikiHowProfile/WikiHowProfilePlugin.php index a0cbe567f7..8c2327b385 100644 --- a/plugins/WikiHowProfile/WikiHowProfilePlugin.php +++ b/plugins/WikiHowProfile/WikiHowProfilePlugin.php @@ -154,7 +154,7 @@ class WikiHowProfilePlugin extends Plugin $absolute = $base->resolve($src); $avatarUrl = strval($absolute); - common_log(LOG_DEBUG, "WikiHow avatar found for $profileUrl - $avatarUrl"); + common_debug("WikiHow avatar found for $profileUrl - $avatarUrl"); $data['avatar'] = $avatarUrl; } diff --git a/plugins/Xmpp/lib/xmppmanager.php b/plugins/Xmpp/lib/xmppmanager.php index 372824ce54..954639f180 100644 --- a/plugins/Xmpp/lib/xmppmanager.php +++ b/plugins/Xmpp/lib/xmppmanager.php @@ -81,7 +81,7 @@ class XmppManager extends ImManager { // Process the queue for as long as needed try { - common_log(LOG_DEBUG, "Servicing the XMPP queue."); + common_debug("Servicing the XMPP queue."); $this->stats('xmpp_process'); $this->conn->processTime(0); } catch (XMPPHP_Exception $e) { @@ -182,7 +182,7 @@ class XmppManager extends ImManager $this->pingid++; } - common_log(LOG_DEBUG, "Sending ping #{$this->pingid}"); + common_debug("Sending ping #{$this->pingid}"); $this->conn->send(""); $this->lastping = $now; return true;