Extension talk:UserPageViewTracker
![]() Archives
| ||
---|---|---|
| ||
Feature requests
editHi - I am loving this new extension. Could I suggest a couple of feature enhancements that I think would be quite easy to implement:
- Make the table sortable by page, user, date of access
- Make the table exportable to CSV
- (This might be a bit harder) make the table sort of pivotable, so for example it shows all views of a given page regardless of who the viewer was.
I want to use it to identify who is accessing which page so I can then maintain and update those pages as a priority, so a list of "most visited pages" would be really useful. @Sophivorus FYI
ElectricRay (talk) 09:20, 14 February 2025 (UTC)
- I asked Claude to put together some code to effect this: would it be helpful to share it? ElectricRay (talk) 12:01, 15 February 2025 (UTC)
table joining error
editHi I get the following error when I installed it on Mediawiki 1.43:
Error 1146: Table 'xxxx.mw_(mw_user u JOIN mw_page p) JOIN mw_user_page_views v' doesn't exist Function: MediaWiki\Pager\IndexPager::buildQueryInfo (UserPageViewTrackerPager) Query: SELECT @rownum+1 AS `rownum`,u.user_name AS `user_name`,u.user_real_name AS `user_real_name`,p.page_namespace AS `page_namespace`,p.page_title AS `page_title`,v.hits AS `hits`,v.last AS `last`,concat(substr(last, 1, 4),'-',substr(last,5,2),'-',substr(last,7,2),' ',substr(last,9,2),':',substr(last,11,2),':',substr(last,13,2)) AS last FROM `mw_(mw_user u JOIN mw_page p) JOIN mw_user_page_views v` WHERE (u.user_id=v.user_id AND p.page_id=v.page_id) ORDER BY rownum,u.user_id,hits DESC LIMIT 51
Backtrace (replaced my path with "root":
from /root/includes/libs/rdbms/database/Database.php(1198) #0 /root/includes/libs/rdbms/database/Database.php(1182): Wikimedia\Rdbms\Database->getQueryException(string, int, string, string) #1 /root/includes/libs/rdbms/database/Database.php(1156): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, int, string, string) #2 /root/includes/libs/rdbms/database/Database.php(647): Wikimedia\Rdbms\Database->reportQueryError(string, int, string, string, bool) #3 /root/includes/libs/rdbms/database/Database.php(1345): Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string) #4 /root/includes/libs/rdbms/database/DBConnRef.php(127): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array) #5 /root/includes/libs/rdbms/database/DBConnRef.php(351): Wikimedia\Rdbms\DBConnRef->__call(string, array) #6 /root/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(745): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array) #7 /root/includes/pager/IndexPager.php(474): Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet() #8 /root/includes/pager/IndexPager.php(289): MediaWiki\Pager\IndexPager->reallyDoQuery(string, int, bool) #9 /root/extensions/UserPageViewTracker/includes/UserPageViewTrackerPager.php(92): MediaWiki\Pager\IndexPager->doQuery() #10 /root/extensions/UserPageViewTracker/includes/specials/SpecialUserPageViewTracker.php(62): UserPageViewTrackerPager->getBody() #11 /root/includes/specialpage/SpecialPage.php(728): SpecialUserPageViewTracker->execute(null) #12 /root/includes/specialpage/SpecialPageFactory.php(1724): MediaWiki\SpecialPage\SpecialPage->run(null) #13 /root/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext) #14 /root/includes/actions/ActionEntryPoint.php(146): MediaWiki\Actions\ActionEntryPoint->performRequest() #15 /root/includes/MediaWikiEntryPoint.php(200): MediaWiki\Actions\ActionEntryPoint->execute() #16 /root/index.php(58): MediaWiki\MediaWikiEntryPoint->run() #17 {main}
I'm afraid I don't have any idea what this means. Is it something I've done? ElectricRay (talk) 19:53, 25 January 2025 (UTC)
- With the help of Claude I have fixed this error for me. I think it may be a bug in the code. In /extensions/UserPageViewTracker/includes/UserPageViewTrackerPager.php, the line:
- 'tables' => '(' . $prefix . 'user u JOIN ' . $prefix . 'page p) JOIN ' . $prefix . 'user_page_views v',
- is incorrectly formed. It should say:
- 'tables' => [
- 'u' => 'user',
- 'p' => 'page',
- 'v' => 'user_page_views'
- ],
- I have no idea if that is something specific to my implementation, or a bug in the code, but this has fixed the issue for me. @Kimon and @Sophivorus fyi. Let me know if this is something wrong with my implementation? ElectricRay (talk) 19:05, 26 January 2025 (UTC)
- @ElectricRay Hi! I just merged your fix upstream and did a few updates to the code (diff), feel free to download the latest version (1.0 master) and test it out. Thanks for the report and the fix! Sophivorus (talk) 13:01, 27 January 2025 (UTC)
- Pleasure! I would love to claim credit but it was all Claude! ElectricRay (talk) 12:03, 29 January 2025 (UTC)
- @ElectricRay Hi! I just merged your fix upstream and did a few updates to the code (diff), feel free to download the latest version (1.0 master) and test it out. Thanks for the report and the fix! Sophivorus (talk) 13:01, 27 January 2025 (UTC)
UserPageViewTracker
editI have a problem with next page, the offset number not present
/mediawiki/index.php?title=Speciale:UserPageViewTracker&offset= 79.58.218.37 07:45, 7 March 2025 (UTC)