Page MenuHomePhabricator

Comment_Plus_Count and Comments_Minus_Count columns missing
Closed, ResolvedPublic

Description

Comment_Plus_Count and Comments_Minus_Count columns are missing - this breaks stuff

A database query error has occurred. This may indicate a bug in the software.
Query:
SELECT Comment_Username,Comment_IP,Comment_Text,Comment_Date,UNIX_TIMESTAMP(Comment_Date) AS timestamp,Comment_user_id,CommentID,IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score,Comment_Parent_ID,CommentID,Comment_Plus_Count AS CommentVotePlus,Comment_Minus_Count AS CommentVoteMinus,stats_total_points FROM user_stats LEFT JOIN Comments ON ((Comment_user_id = stats_user_id)) WHERE Comment_Page_ID = '1' LIMIT 100
Function: CommentsPage::getCommentList
Error: 1054 Unknown column 'Comment_Plus_Count' in 'field list' (10.33.252.76)

Event Timeline

Cook879 raised the priority of this task from to High.
Cook879 updated the task description. (Show Details)
Cook879 added subscribers: Cook879, UltrasonicNXT.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Which version of comments (commit hash if possible) are you using? The function CommentsPage::getCommentList which is causing this error no longer exists, it was removed in december. The rewrite in december removed those columns, but also removed that function - is it possible there is a mix of versions going on?

@UltrasonicNXT There shouldn't be any version mixup (PM me for details if you need 'em); this particular issue was observed with version 4.0.2 of Comments. If you look at /extensions/Comments/CommentPage.php, lines 177 and 178, there are still references to the Comment_Plus_Count and Comment_Minus_Count columns (git master).

Here are the relevant grep results against current git master:

$ grep -ri comment_plus_count .
./CommentsOfTheDay.php: 'IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score',
./CommentsOfTheDay.php: 'Comment_Plus_Count AS CommentVotePlus',
./CommentsOfTheDay.php: array( 'ORDER BY' => '(Comment_Plus_Count) DESC', 'LIMIT' => 5 )
./CommentsPage.php: 'IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score',
./CommentsPage.php: 'Comment_Parent_ID', 'CommentID', 'Comment_Plus_Count AS CommentVotePlus',

$ grep -ri comment_minus_count .
./CommentsOfTheDay.php: 'IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score',
./CommentsOfTheDay.php: 'Comment_Minus_Count AS CommentVoteMinus',
./CommentsPage.php: 'IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score',
./CommentsPage.php: 'Comment_Minus_Count AS CommentVoteMinus'
./sql/comments.mssql.sql:CREATE INDEX /*i*/comment_date ON /*$wgDBprefix*/Comments (Comment_Minus_Count);
./sql/comments.oracle.sql:CREATE INDEX &mw_prefix.comment_date ON &mw_prefix.Comments (Comment_Minus_Count);
./sql/comments.postgres.sql:CREATE INDEX comment_date ON Comments (Comment_Minus_Count);

Oh, my apologies, so there are. I'll get on it.

Change 211966 had a related patch set uploaded (by UltrasonicNXT):
Remove refresences to score colums, update comment of the day

https://gerrit.wikimedia.org/r/211966

Sorry about this. No more references to those old columns now, I've grep'ed as well. While I was at it I rewrote a bit of the comments of the day stuff that hadn't been updated last time.

Change 211966 merged by jenkins-bot:
Remove references to score colums, update comment of the day

https://gerrit.wikimedia.org/r/211966