Hi,
I encountered a few issues listed below, regarding the timestamps in a mediawiki database (I am running MediaWiki 1.6.7), when writing an extension that looks for the user that added a specific category link. Indeed, the only efficient way I've found is to compare cl_timestamp and rev_timestamp in the database (any better idea?).
1) Is there a specific reason why the *cl_timestamp* column of the *categorylinks* table has a different type from the *rev_timestamp* column of the *revision* table (or page_touched of the page table)? Cl_timestamp is a timestamp whereas rev_timestamp and page_touched are strings. This adds complexity - useless I believe - when comparing these timestamps with each other (formatting with such MySQL functions as DATE_FORMAT or STR_TO_DATE is necessary). Wouldn't this make easier to use the same type?
2) Looking at the code, I noticed that cl_timestamp and rev_timestamp are computed separately (function insertOn in Revision.php for rev_timestamp, function getCategoryInsertions in LinksUpdate.php for cl_timestamp). On my system, there is sometimes a difference of 1 for the seconds between the cl_timestamp value and the corresponding rev_timestamp. Wouldn't this make more sense to use the same rev_timestamp for the cl_timestamp value, OR replace the cl_timestamp column with something like a 'cl_rev' column that links to the rev_id from the revision table? If not, why. Thus, it would be easier to get the revision info (e.g. the category adder) corresponding to any addition of a category link in a page.
3) Should I report a bug for this?
Thanks for your time. -- Cyril Dangerville
Cyril DANGERVILLE wrote:
I encountered a few issues listed below, regarding the timestamps in a mediawiki database (I am running MediaWiki 1.6.7), when writing an extension that looks for the user that added a specific category link.
This can't really be done reliably. Even if you trawl through all previous revisions, the link may have been introduced by a change in an included template, and thus not related to any revision at all. It may also have been removed and returned multiple names.
Indeed, the only efficient way I've found is to compare cl_timestamp and rev_timestamp in the database (any better idea?).
- Is there a specific reason why the *cl_timestamp* column of the
*categorylinks* table has a different type from the *rev_timestamp* column of the *revision* table (or page_touched of the page table)?
cl_timestamp was experimental, and is probably more or less useless for any non-trivial purpose. Likely it will be removed in the future.
It doesn't necessarily have any relation to any particular revision, since link status is based on the combined state of all included resources (primary page, included templates, extension parsing).
-- brion vibber (brion @ pobox.com)
wikitech-l@lists.wikimedia.org