diff --git a/classes/cache.class.php b/classes/cache.class.php index 2a2d39e8..b671e19d 100644 --- a/classes/cache.class.php +++ b/classes/cache.class.php @@ -39,6 +39,7 @@ class CACHE extends Memcache { public $MemcacheDBKey = ''; protected $InTransaction = false; public $Time = 0; + private $Servers = array(); private $PersistentKeys = array( 'ajax_requests_*', 'query_lock_*', @@ -57,6 +58,7 @@ class CACHE extends Memcache { public $InternalCache = true; function __construct($Servers) { + $this->Servers = $Servers; foreach ($Servers as $Server) { $this->addServer($Server['host'], $Server['port'], true, $Server['buckets']); } @@ -357,4 +359,17 @@ public function get_query_lock($LockName) { public function clear_query_lock($LockName) { $this->delete_value('query_lock_'.$LockName); } + + /** + * Get cache server status + * + * @return array (host => bool status, ...) + */ + public function server_status() { + $Status = array(); + foreach ($this->Servers as $Server) { + $Status["$Server[host]:$Server[port]"] = $this->getServerStatus($Server['host'], $Server['port']); + } + return $Status; + } } diff --git a/classes/debug.class.php b/classes/debug.class.php index d50f4138..d9d64fee 100644 --- a/classes/debug.class.php +++ b/classes/debug.class.php @@ -52,6 +52,13 @@ public function profile($Automatic = '') { $Reason[] = $DBWarningCount . ' DB warning(s)'; }*/ + $CacheStatus = G::$Cache->server_status(); + if (in_array(0, $CacheStatus) && !G::$Cache->get_value('cache_fail_reported')) { + // Limit to max one report every 15 minutes to avoid massive debug spam + G::$Cache->cache_value('cache_fail_reported', true, 900); + $Reason[] = "Cache server error"; + } + if (isset($_REQUEST['profile'])) { $Reason[] = 'Requested by ' . G::$LoggedUser['Username']; } @@ -61,6 +68,7 @@ public function profile($Automatic = '') { $this->Perf['CPU time'] = number_format($this->get_cpu_time() / 1000000, 3).' s'; if (isset($Reason[0])) { + $this->log_var($CacheStatus, 'Cache server status'); $this->analysis(implode(', ', $Reason)); return true; } @@ -308,7 +316,7 @@ public function perf_table($Perf = false) { ?> - +
View Performance stats:View Performance stats:
@@ -333,7 +341,7 @@ public function include_table($Includes = false) { ?> - +
View Includes:View Includes:
@@ -357,7 +365,7 @@ public function class_table($Classes = false) { ?> - +
View Classes:View Classes:
@@ -374,7 +382,7 @@ public function extension_table() { ?> - +
View Extensions:View Extensions:
@@ -397,7 +405,7 @@ public function flag_table($Flags = false) { ?> - +
View Flags:View Flags:
@@ -435,7 +443,7 @@ public function constant_table($Constants = false) { ?> - +
View Constants:View Constants:
@@ -462,7 +470,7 @@ public function cache_table($CacheKeys = false) { ?> - +
ViewView
@@ -491,7 +499,7 @@ public function error_table($Errors = false) { ?> - +
View Errors:View Errors:
@@ -530,14 +538,16 @@ public function query_table($Queries=false) { ?> - +
ViewView
', $Warnings); + if ($Warnings !== null) { + $Warnings = implode('
', $Warnings); + } ?> @@ -564,7 +574,7 @@ public function sphinx_table($Queries = false) { ?> - +
ViewView
@@ -596,7 +606,7 @@ public function vars_table($Vars = false) { ?> - +
ViewView
diff --git a/classes/votes.class.php b/classes/votes.class.php index 492cd945..1dfc8f84 100644 --- a/classes/votes.class.php +++ b/classes/votes.class.php @@ -1,5 +1,11 @@ cache_value("vote_pairs_$GroupID", $VotePairs); + $Cache->cache_value("vote_pairs_$GroupID", $VotePairs, 21600); } // Now do the paired votes keys for all of this guy's other votes @@ -112,11 +112,10 @@ 'Total' => 1, 'Ups' => ($Type == 'Up') ? 1 : 0); } - $Cache->cache_value("vote_pairs_$VGID", $VotePairs); + $Cache->cache_value("vote_pairs_$VGID", $VotePairs, 21600); } } - echo 'success'; } elseif ($_REQUEST['do'] == 'unvote') { if (!isset($UserVotes[$GroupID])) { @@ -152,13 +151,13 @@ // First update this album's paired votes. If this keys is magically not set, // our life just got a bit easier. We're only tracking paired votes on upvotes. if ($Type == 'Up') { - $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); + $VotePairs = $Cache->get_value("vote_pairs_$GroupID", true); if ($VotePairs !== false) { foreach ($UserVotes as $Vote) { if (isset($VotePairs[$Vote['GroupID']])) { if ($VotePairs[$Vote['GroupID']]['Total'] == 0) { // Something is screwy - $Cache->delete_value('vote_pairs_'.$GroupID); + $Cache->delete_value("vote_pairs_$GroupID"); continue; } $VotePairs[$Vote['GroupID']]['Total'] -= 1; @@ -167,12 +166,12 @@ } } else { // Something is screwy, kill the key and move on - $Cache->delete_value('vote_pairs_'.$GroupID); + $Cache->delete_value("vote_pairs_$GroupID"); break; } } } - $Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs); + $Cache->cache_value("vote_pairs_$GroupID", $VotePairs, 21600); } // Now do the paired votes keys for all of this guy's other votes @@ -185,22 +184,22 @@ continue; } // Again, if the cache key is not set, move along - $VotePairs = $Cache->get_value('vote_pairs_'.$VGID, true); + $VotePairs = $Cache->get_value("vote_pairs_$VGID", true); if ($VotePairs !== false) { if (isset($VotePairs[$GroupID])) { if ($VotePairs[$GroupID]['Total'] == 0) { // Something is screwy - $Cache->delete_value('vote_pairs_'.$VGID); + $Cache->delete_value("vote_pairs_$VGID"); continue; } $VotePairs[$GroupID]['Total'] -= 1; if ($Type == 'Up') { $VotePairs[$GroupID]['Ups'] -= 1; } - $Cache->cache_value('vote_pairs_'.$VGID, $VotePairs); + $Cache->cache_value("vote_pairs_$VGID", $VotePairs, 21600); } else { // Something is screwy, kill the key and move on - $Cache->delete_value('vote_pairs_'.$VGID); + $Cache->delete_value("vote_pairs_$VGID"); } } } diff --git a/sections/top10/votes.php b/sections/top10/votes.php index 9a260576..8f6afb16 100644 --- a/sections/top10/votes.php +++ b/sections/top10/votes.php @@ -237,10 +237,14 @@       - Total + Total
- Score: + + Score: +   |   + % positive + Total

- Score: + Score:   |   % positive

diff --git a/sections/torrents/voter_picks.php b/sections/torrents/voter_picks.php index 457a8f87..0c949dd4 100644 --- a/sections/torrents/voter_picks.php +++ b/sections/torrents/voter_picks.php @@ -19,7 +19,7 @@ GROUP BY v.GroupID HAVING Ups > 0"); $VotePairs = $DB->to_array('GroupID', MYSQL_ASSOC, false); - $Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs); + $Cache->cache_value('vote_pairs_'.$GroupID, $VotePairs, 21600); } $GroupScores = array(); @@ -27,7 +27,7 @@ // Cutting out the junk should speed the sort significantly $Score = binomial_score($RatingGroup['Ups'], $RatingGroup['Total']); if ($Score > 0.3) { - $GroupScores[$RatingGroup['GroupID']] = binomial_score($RatingGroup['Ups'], $RatingGroup['Total']); + $GroupScores[$RatingGroup['GroupID']] = $Score; } } diff --git a/static/styles/anorex/style.css b/static/styles/anorex/style.css index 0a95b66e..929ffe27 100644 --- a/static/styles/anorex/style.css +++ b/static/styles/anorex/style.css @@ -846,3 +846,19 @@ div[class~=tooltipster-base] { div[class~=tooltipster-content] > a { } + +.post_id { + font-weight: normal; +} + +.vote_tag_up, .vote_artist_up, .vote_album_up { + color: green; +} + +.vote_tag_down, .vote_artist_down, .vote_album_down { + color: red; +} + +.colhead_dark .time { + font-weight: normal; +} diff --git a/static/styles/global.css b/static/styles/global.css index db3452d3..0d131547 100644 --- a/static/styles/global.css +++ b/static/styles/global.css @@ -613,11 +613,9 @@ tr.torrent .bookmark>a:after { } .vote_tag_up, .vote_artist_up, .vote_album_up { - color: green; font-weight: bolder; } .vote_tag_down, .vote_artist_down, .vote_album_down { - color: red; font-weight: bolder; } diff --git a/static/styles/kuro/style.css b/static/styles/kuro/style.css index 21166058..ece78f6e 100644 --- a/static/styles/kuro/style.css +++ b/static/styles/kuro/style.css @@ -926,3 +926,15 @@ tr.torrent .bookmark > a:after { color:#999; } .autocomplete-suggestions { background: #222; } + +.post_id { + font-weight: normal; +} + +.vote_tag_up, .vote_artist_up, .vote_album_up { + color: green; +} + +.vote_tag_down, .vote_artist_down, .vote_album_down { + color: red; +} diff --git a/static/styles/layer_cake/style.css b/static/styles/layer_cake/style.css index 67ff6ea1..edad4982 100644 --- a/static/styles/layer_cake/style.css +++ b/static/styles/layer_cake/style.css @@ -803,3 +803,15 @@ tr.torrent .bookmark > a:after { div[class~=tooltipster-content] > a { color: #AAAAAA; } + +.post_id { + font-weight: normal; +} + +.vote_tag_up, .vote_artist_up, .vote_album_up { + color: green; +} + +.vote_tag_down, .vote_artist_down, .vote_album_down { + color: red; +} diff --git a/static/styles/postmod/style.css b/static/styles/postmod/style.css index 90beff5f..5d4e46e9 100644 --- a/static/styles/postmod/style.css +++ b/static/styles/postmod/style.css @@ -1104,3 +1104,11 @@ div[class~=tooltipster-content] > a { #settings_sections #submit, #settings_sections #settings_search { margin: 3px 0; } + +.vote_tag_up, .vote_artist_up, .vote_album_up { + color: green; +} + +.vote_tag_down, .vote_artist_down, .vote_album_down { + color: red; +}