In not as many words as others, here's my MySQL query to extract details on images stored in the MediaWiki CMS system (v1.14).
Prior to a migration and just after another change freeze, I had sent all Wiki articles modified since the last export but then needed to send all images that had also been either added/modified since.
Using MySQL, the following query lists the image name, size, user who uploaded, timestamp and the path. Remember that the paths are determined using the MD5 Hash of the filename:
Page ID, Title, Content, Category, AccessLevel (note that AccessLevel is extra to your standard MediaWiki setup and one that was customized for my day job).
Thought I already had this somewhere on my site, so it took a while again but I've posted my finished query here:
The base query to list mediawiki articles
Page ID, Title, Content, Category
- p.page_id AS PageID,
- CONVERT(p.page_title USING latin1) AS PageTitle,
- CONVERT(t.old_text USING latin1) AS PageContent,
- (SELECT GROUP_CONCAT(CONVERT(wikimedia_categorylinks.cl_to USING latin1)) FROM wikimedia_categorylinks WHERE wikimedia_categorylinks.cl_from=p.page_id) AS PageCategory
- wikimedia_page p
- LEFT JOIN wikimedia_revision r ON p.page_latest=r.rev_id
- LEFT JOIN wikimedia_text t ON r.rev_text_id=t.old_id
- AND t.old_text=''
- AND p.page_is_redirect=0
- We have an internal wiki knowledge base using MediaWiki version 1.14.
- Some articles are available for public, some are restricted to staff and different localgroups.
- When users click on the 'Login' link, we want the system to automatically prompt them for their username/password. (Kerberos authenticated, as opposed to NTLM authenticated).
- Note: This article is displaying how to change the link and not how to setup these authentication methods.
In this particular case, I'm comparing my Live and Dev versions of the same MediaWiki site. I want to add the SQL queries I used to this article but I'm in the middle of carrying out this process and it's due in two hours.
- Checking both MediaWiki have the same article content:
- Print Special:AllPages from both sites and do an eye-check (I basically highlighted articles found in one but not the other - we had over 2000 articles... I guess I'm a bit geekly like that)
- This doesn't show modified date and content size differences but I can run this SQL query to show me these.
By adding the following line to your LocalSettings.php file, you will be able to log everything that WikiMedia does:
$wgDebugLogFile = '/home/username/public_html/wikidir/logfile';
IMPORTANT NOTE: The path above should be the exact full path to the wiki directory under your account.