Page MenuHomePhabricator

database error on uploading an avatar with SocialProfile 1.13 and Mediawiki 1.30.0 related to user_stats
Closed, ResolvedPublic

Description

Dear,

I run a freshly installed wiki with this configuration :

MediaWiki 1.30.0
PHP 7.0.28-0ubuntu0.16.04.1 (apache2handler)
MySQL 5.7.22-0ubuntu0.16.04.1
ICU 55.1
SocialProfile 1.13 (cba8351)
Runs on VestaCP Apache+NGinx, yet I had the same bug on a previous installation with Virtualmin and Apache alone and Debian.
The wiki is installed according to Debian/Ubuntu procedure : https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_or_Ubuntu

LocalSettings configuration :
$wgUserProfileDisplay['friends'] = true;
$wgUserProfileDisplay['foes'] = false;
$wgUserBoard = true;
$wgUserProfileDisplay['board'] = true;
$wgUserProfileDisplay['stats'] = true;
require_once( "$IP/extensions/SocialProfile/UserStats/EditCount.php" ); // Necessary edit counter

update.php had already be run twice.

When I try to upload an avatar I have the following error message :

A database query error has occurred. This may indicate a bug in the software.
[c91b9131c593e746b7abdf06] /wiki/Sp%C3%A9cial:UploadAvatar Wikimedia\Rdbms\DBQueryError from line 1149 of /var/lib/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: INSERT INTO fr_user_stats (stats_year_id,stats_user_id,stats_user_name,stats_total_points) VALUES ('0','1','Thibaut','1000')
Function: UserStatsTrack::addStatRecord
Error: 1054 Unknown column 'stats_year_id' in 'field list' (localhost)
Backtrace:

#0 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(979): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#1 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1589): Wikimedia\Rdbms\Database->query(string, string)
#2 /var/lib/mediawiki/extensions/SocialProfile/UserStats/includes/UserStatsTrack.php(99): Wikimedia\Rdbms\Database->insert(string, array, string)
#3 /var/lib/mediawiki/extensions/SocialProfile/UserStats/includes/UserStatsTrack.php(82): UserStatsTrack->addStatRecord()
#4 /var/lib/mediawiki/extensions/SocialProfile/UserStats/includes/UserStatsTrack.php(66): UserStatsTrack->initStatsTrack()
#5 /var/lib/mediawiki/extensions/SocialProfile/UserProfile/includes/avatar/UploadAvatar.php(138): UserStatsTrack->__construct(integer, string)
#6 /var/lib/mediawiki/includes/specials/SpecialUpload.php(567): UploadAvatar->performUpload(string, string, boolean, User, array)
#7 /var/lib/mediawiki/includes/specials/SpecialUpload.php(207): SpecialUpload->processUpload()
#8 /var/lib/mediawiki/extensions/SocialProfile/UserProfile/includes/specials/SpecialUploadAvatar.php(52): SpecialUpload->execute(NULL)
#9 /var/lib/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialUploadAvatar->execute(NULL)
#10 /var/lib/mediawiki/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#11 /var/lib/mediawiki/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#12 /var/lib/mediawiki/includes/MediaWiki.php(851): MediaWiki->performRequest()
#13 /var/lib/mediawiki/includes/MediaWiki.php(523): MediaWiki->main()
#14 /var/lib/mediawiki/index.php(43): MediaWiki->run()
#15 {main}

Please tell me if you need some more information.
The site is here : http://sailsof.care

Regards

Event Timeline

SamanthaNguyen triaged this task as Unbreak Now! priority.
SamanthaNguyen moved this task from Backlog to Bugs on the SocialProfile board.
SamanthaNguyen edited subscribers, added: SamanthaNguyen, ashley; removed: SocialProfile, Social-Tools, Thibdx.

Change 432919 had a related patch set uploaded (by SamanthaNguyen; owner: SamanthaNguyen):
[mediawiki/extensions/SocialProfile@master] Fully kill off unused 'stats_year_id' column from 'user_stats' table

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

Ciencia_Al_Poder renamed this task from database error on uploading an avatar with SocialProfile 1.13 and Mediawiki 1.3.0 related to user_stats to database error on uploading an avatar with SocialProfile 1.13 and Mediawiki 1.30.0 related to user_stats .May 13 2018, 8:35 PM

As a precision, Only this column seems to be missing. It should be possible to manually add it but I prefer to wait for news from you before doing some dirty hacks.

1 stats_user_idPrimaire int(11)
2 stats_user_name varbinary(255)
3 stats_user_image_count int(11)
4 stats_comment_count int(11)
5 stats_comment_score int(11)
6 stats_comment_score_positive_rec int(11)
7 stats_comment_score_negative_rec int(11)
8 stats_comment_score_positive_given int(11)
9 stats_comment_score_negative_given int(11)
10 stats_comment_blocked int(11)
11 stats_vote_count int(11)
12 stats_edit_count int(11)
13 stats_opinions_created int(11)
14 stats_opinions_published int(11)
15 stats_referrals int(11)
16 stats_referrals_completed int(11)
17 stats_challenges_count int(11)
18 stats_challenges_won int(11)
19 stats_challenges_rating_positive int(11)
20 stats_challenges_rating_negative int(11)
21 stats_friends_count int(11)
22 stats_foe_count int(11)
23 stats_gifts_rec_count int(11)
24 stats_gifts_sent_count int(11)
25 stats_weekly_winner_count int(11)
26 stats_monthly_winner_count int(11)
27 stats_total_points int(20)
28 stats_overall_rank int(11)
29 up_complete int(5)
30 user_board_count int(5)
31 user_board_sent int(5)
32 user_board_count_priv int(5)
33 stats_picturegame_votes int(5)
34 stats_picturegame_created int(5)
35 user_status_count int(5)
36 stats_poll_votes int(5)
37 user_status_agree int(11)
38 stats_quiz_questions_answered int(11)
39 stats_quiz_questions_correct int(11)
40 stats_quiz_points int(11)
41 stats_quiz_questions_created int(11)
42 stats_quiz_questions_correct_percent float
43 stats_links_submitted int(11)
44 stats_links_approved int(11)

Ok thanks ! So it was not necessary to add this column. I applied the patch and it works perfectly now. ;-)

No worries, thanks for reporting the bug. :) Just going to wait for co-maintainer @ashley to merge this patch and then that change will be officially in the extension source code, then I'll close this as resolved.

Change 432919 merged by jenkins-bot:
[mediawiki/extensions/SocialProfile@master] Fully kill off unused 'stats_year_id' column from 'user_stats' table

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

Vvjjkkii renamed this task from database error on uploading an avatar with SocialProfile 1.13 and Mediawiki 1.30.0 related to user_stats to i1caaaaaaa.Jul 1 2018, 1:10 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed SamanthaNguyen as the assignee of this task.
Vvjjkkii lowered the priority of this task from Unbreak Now! to High.
Vvjjkkii updated the task description. (Show Details)
MacFan4000 renamed this task from i1caaaaaaa to database error on uploading an avatar with SocialProfile 1.13 and Mediawiki 1.30.0 related to user_stats.Jul 2 2018, 12:28 PM
MacFan4000 updated the task description. (Show Details)