X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=22962325778f3f09ab28575007f637f995d91b01;hb=035aae2745e25d44ab9fe1b7bdffbcaa505ba970;hp=c365c560c233be58add270b3f98292414dd55392;hpb=eaaef2aec9339dc7eb338024f1b62d67fb9531e4;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index c365c560c2..2296232577 100644 --- a/lib/util.php +++ b/lib/util.php @@ -322,7 +322,7 @@ function common_set_user($user) return false; } - if ($user) { + if ($user instanceof User) { if (Event::handle('StartSetUser', array(&$user))) { if (!empty($user)) { if (!$user->hasRight(Right::WEBLOGIN)) { @@ -383,6 +383,7 @@ function common_rememberme($user=null) if (!$result) { common_log_db_error($rm, 'INSERT', __FILE__); + $rm->query('ROLLBACK'); return false; } @@ -538,7 +539,7 @@ function common_user_cache_hash($user=false) if ($user === false) { $user = common_current_user(); } - if ($user) { + if ($user instanceof User) { return crc32($user->id . ':' . $user->nickname); } else { return '0'; @@ -666,7 +667,7 @@ function common_linkify_mention($mention) * * @access private */ -function common_find_mentions($text, $notice) +function common_find_mentions($text, Notice $notice) { try { $sender = Profile::getKV('id', $notice->profile_id); @@ -2312,7 +2313,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"); } } } @@ -2326,14 +2327,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)"); } } }