List users with watched pages stored in WatchListClass objects

Last modified by Eduard Moraru on 2026/06/02 17:55

cogStoring watched pages this way can lead to performance problems and needs to be migrated.
Type
Category
Developed by

Eduard Moraru

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

List of users with watched documents stored in the old WatchListClass object. This type of storage is limited and can produce StackOverfloErrors when it gets too large, so the new Notifications filter storage needs to be used.

Below is the query that produces the list of users and the number of pages they are watching using this old storage method:

{{velocity}}
|= Index |= User |= Watched Documents
#foreach ($row in $services.query.xwql("SELECT doc.fullName, COUNT(item) FROM XWikiDocument doc, BaseObject AS obj, DBStringListProperty AS prop join prop.list item WHERE obj.name=doc.fullName AND obj.className='XWiki.WatchListClass' AND obj.id=prop.id.id AND prop.id.name='documents' GROUP BY doc.fullName ORDER BY COUNT(item) DESC").execute())
  |$foreach.count|[[$xwiki.getUserName($row[0], false) ($row[0])>>$row[0]]]|$row[1]
#end
{{/velocity}}

Get Connected