Jump to content

Extension talk:UserPageViewTracker

Add topic
From mediawiki.org
Latest comment: 3 months ago by Sophivorus in topic Feature requests

Error: Class "Title" not found (20251220)

[edit]

Hi, I am trying this extension for the first time on a newly created wiki site but am getting the following error: any ideas?

[aUaiX6TQwMRrlikQxMu3ngAAAA0] /index.php?title=Special:UserPageViewTracker Error: Class "Title" not found

Backtrace:

from [..]/user/htdocs/extensions/UserPageViewTracker/includes/UserPageViewTrackerPager.php(105)
#0 [..]/user/htdocs/extensions/UserPageViewTracker/includes/specials/SpecialUserPageViewTracker.php(55): UserPageViewTrackerPager->getBody()
#1 [..]/user/htdocs/includes/specialpage/SpecialPage.php(734): SpecialUserPageViewTracker->execute(null)
#2 [..]/user/htdocs/includes/specialpage/SpecialPageFactory.php(1731): MediaWiki\SpecialPage\SpecialPage->run(null)
#3 [..]/user/htdocs/includes/actions/ActionEntryPoint.php(499): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#4 [..]/user/htdocs/includes/actions/ActionEntryPoint.php(143): MediaWiki\Actions\ActionEntryPoint->performRequest()
#5 [..]/user/htdocs/includes/MediaWikiEntryPoint.php(202): MediaWiki\Actions\ActionEntryPoint->execute()
#6 [..]/user/htdocs/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#7 {main}

I installed this MediaWiki site using my ISP's OneClickInstaller for MediaWiki 1.43 (the latest version offered) but the site created says it's version 1.44.3. To install extensions, I am unpacking the tar file on my local Windows PC then uploading the unpacked files to the site's extensions directory. The MobileFrontend and LastUserLogin extensions are working fine. I have tried installing UserPageViewtracker Rel. 1.43, 1.44 and 1.45 but always get the same error. I have checked the DB and the new table is there and being populated. I struggled initially to work out how to run the update script so probably ran the extension a couple of times without the new table being created, should this be relevant? Any help would be much appreciated!

Try using the master branch of the extension instead of the release branch. It should be backward compatible and has the latest fixes, including https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserPageViewTracker/+/1201270 * Pppery * it has begun 18:22, 20 December 2025 (UTC)Reply
I have the same issue. I am not sufficiently adept at coding to fix it so I have disabled the app for now, but according to Claude this is the problem:

“The error is that UserPageViewTracker is using the old Title class without the proper namespace, which was removed/relocated in recent MediaWiki versions.

Error message: Error: Class "Title" not found from /extensions/UserPageViewTracker/includes/UserPageViewTrackerPager.php(105)

Issue: The extension is using Title::newFromText() (or similar) directly, but as of MediaWiki 1.43+, the Title class needs to be referenced with its full namespace: \MediaWiki\Title\Title or with a use statement at the top of the file.

Fix needed: The extension files need to be updated to either:

  • Add use MediaWiki\Title\Title; at the top of affected PHP files, OR
  • Change all references from Title:: to \MediaWiki\Title\Title::

This is a common breaking change that affected many extensions during the MediaWiki 1.43+ upgrades when core classes were moved into proper namespaces.

Affected file(s)':

  • includes/UserPageViewTrackerPager.php (line 105, possibly others)
  • Potentially other files in the extension

— Preceding unsigned comment added by ElectricRay (talkcontribs) 03:48, 6 January 2026 (UTC)Reply

Yes Fixed Please download the latest MASTER version here. Sophivorus (talk) 13:11, 6 January 2026 (UTC)Reply

Feature requests

[edit]

Hi - 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)Reply

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)Reply
Yes, it could be helpful, so long as you put some love into the sharing and don't just dump a ton of code and expect others to sort it out. ;-) If you can submit the code for review via Gerrit, that would be even better! Kind regards, Sophivorus (talk) 13:14, 6 January 2026 (UTC)Reply

table joining error

[edit]

Hi 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)Reply

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)Reply
@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)Reply
Pleasure! I would love to claim credit but it was all Claude! ElectricRay (talk) 12:03, 29 January 2025 (UTC)Reply
When will this fix appear on the mirror at https://github.com/wikimedia/mediawiki-extensions-UserPageViewTracker.git ? That is where I'm pulling the code - is that a bad idea? Rp (talk) 15:38, 10 September 2025 (UTC)Reply
@Rp Hi! The GitHub mirror updates almost instantly. The 1.0 version has been available there for months. Are you still experiencing the error reported in this thread? Sophivorus (talk) 11:24, 11 September 2025 (UTC)Reply
Thanks! I've reverted to the mirror. The error was completely unrelated (I thought I was pulling the code but wasn't.) Rp (talk) 14:00, 24 September 2025 (UTC)Reply

UserPageViewTracker

[edit]

I 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)Reply

Me too, same problem at least from version REL1_41 2024-06-16T11:25:29
I updated to the latest version (REL1_43 2024-11-14T17:25:23) but it doesn't work! MorenoBeninca (talk) 22:11, 25 March 2025 (UTC)Reply