On Thu, Feb 21, 2008 at 10:55 AM, Mark Clements gmane@kennel17.co.uk wrote:
"Magnus Manske" magnusmanske@googlemail.com wrote in message news:fab0ecb70802210138r7e26d14y62dcab51d96ba19@mail.gmail.com...
On Thu, Feb 21, 2008 at 4:52 AM, Andrew Garrett
andrew@epstone.net wrote:
- On save of a category, or a page including that category, insert the
requisite category entry (this would save a dirty great big migration script).
- When a categorylinks item is INSERTED or DELETED on links-update
(the code is nice in that it only inserts/deletes those items which have been added/removed), do the requisite incrementing/decrementing on the category table.
Hmm... When you save a page, there can only be three "changes" regarding a category:
- It was added
- It was removed
- It was kept
#3 won't cost anything; #1 and #2 could be solved by increasing/decreasing the counter.
How do you know whether a categorylinks item has been counted in the total count of items in the category? If the table is not populated via a migration script, i.e. entries are added as page edits are made, then a few deletions of pages that have not yet been added will cause you to end up with a negative count! Also, all counts will be wrong until all pages have been edited, which seems a bit pointless - am I misunderstanding something here?
You'd have to seed the counts once when the feature is turned on, of course.
Magnus