Standarize some variables and address some php warnings.

This commit is contained in:
Retro_Guy 2024-06-05 04:05:17 -07:00
parent f8ec3d9ca6
commit 3ff76df4fe
5 changed files with 2919 additions and 2908 deletions

View File

@ -1 +1 @@
0.9.131
0.9.132

View File

@ -202,11 +202,14 @@ function message_read($id, $bodynum = 0, $group = "")
}
if ($memcacheD) {
$memcache_key = $memcache_key_prefix . '_' . 'message_read-' . $id . '-0-' . $group;
if ($message = unserialize(gzuncompress($memcacheD->get($memcache_key)))) {
if ($enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $memcache_key", FILE_APPEND);
$message_data = $memcacheD->get($memcache_key);
if ($message_data) {
if ($message = unserialize(gzuncompress($message_data))) {
if ($enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $memcache_key", FILE_APPEND);
}
return $message;
}
return $message;
}
}
$message = new messageType();
@ -823,12 +826,12 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl
echo '<hr><p class=np_ob_posted_date>(message #' . $head->number . ' hidden by your blocklist)</p><hr>';
return "blocked";
}
if (($block_xnoarchive) && (isset($head->xnoarchive)) && ($head->xnoarchive == "yes")) {
echo '<hr><p class=np_ob_posted_date>' . $text_article["block-xnoarchive"] . '(article #' . $id . ')</p><hr>';
return "no-archive";
}
if (($head->content_type[$attachment] == "text/plain") && ($attachment == 0)) {
show_header($head, $group, $local_poster);
// X-Face

View File

@ -73,12 +73,15 @@ function thread_cache_load($group)
}
// Check memcache
if ($memcacheD) {
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
if ($headers = unserialize(gzuncompress($memcacheD->get($key)))) {
if ($enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $key", FILE_APPEND);
$memcache_key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$message_data = $memcacheD->get($memcache_key);
if ($message_data) {
if ($headers = unserialize(gzuncompress($message_data))) {
if ($enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $memcache_key", FILE_APPEND);
}
return $headers;
}
return $headers;
}
}
@ -94,23 +97,21 @@ function thread_cache_load($group)
$dbh = null;
}
if ($memcacheD) {
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread);
$too_big = false;
if($thread_bytes < $memcache_maxitemsize) {
$nicole = $memcacheD->add($key, $add_thread, $memcache_ttl);
if ($thread_bytes < $memcache_maxitemsize) {
$nicole = $memcacheD->add($memcache_key, $add_thread, $memcache_ttl);
} else {
$nicole = false;
$too_big = true;
}
if ($nicole && $enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $key (" . strlen($add_thread) . " bytes)", FILE_APPEND);
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $memcache_key (" . strlen($add_thread) . " bytes)", FILE_APPEND);
}
if ($too_big) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $memcache_key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
}
}
return ($headers);
@ -151,26 +152,26 @@ function thread_cache_save($headers, $group)
$dbh->commit();
$dbh = null;
if ($memcacheD) {
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$del = $memcacheD->delete($key);
$memcache_key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$del = $memcacheD->delete($memcache_key);
$add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread);
$too_big = false;
if($thread_bytes < $memcache_maxitemsize) {
$nicole = $memcacheD->add($key, $add_thread, $memcache_ttl);
if ($thread_bytes < $memcache_maxitemsize) {
$nicole = $memcacheD->add($memcache_key, $add_thread, $memcache_ttl);
} else {
$too_big = true;
$nicole = false;
}
if ($enable_memcache_logging) {
if ($del) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache delete) $key", FILE_APPEND);
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache delete) $memcache_key", FILE_APPEND);
}
if ($nicole) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $key (" . $thread_bytes . " bytes)", FILE_APPEND);
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $memcache_key (" . $thread_bytes . " bytes)", FILE_APPEND);
}
if ($too_big) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $memcache_key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -308,7 +308,9 @@ function display_threads($threads, $oldest)
$style = 0;
$results = 0;
foreach ($nicole as $key => $value) {
$target_head = $this_overboard['msgids'][$key];
if (isset($this_overboard['msgids'][$key])) {
$target_head = $this_overboard['msgids'][$key];
}
if (! isset($target_head['msgid'])) {
$target_head = get_data_from_msgid($key);
}
@ -333,7 +335,6 @@ function display_threads($threads, $oldest)
}
}
$results ++;
$lone == '';
$skip = '';
if ($nohead) {
if (($style % 2) == 0) {