ICT:System RESET - FIles and Asset Namespace
System Reset – Assets, Files, and Cargo (DEV)
This document defines the **authoritative cleanup procedure** for the development environment of the Asset system (v2.x).
It reflects **real-world behavior** observed on:
- MediaWiki 1.45
- Cargo extension
- AlmaLinux
- MariaDB
- Development-only data (fully disposable)
This procedure is EXPECTED to be executed multiple times during development.
DO NOT use on production systems.
0. Scope and Principles
- All Asset data is test data
- No historical preservation is required
- Cleanup must be:
- deterministic
- fast
- repeatable
- SQL-level cleanup is ACCEPTABLE and PREFERRED in development
1. Enter Maintenance Mode
Edit LocalSettings.php and add near the top:
$wgReadOnly = 'System maintenance in progress';
This prevents user edits and uploads during cleanup.
2. Safeguard Files to Keep (if any)
If a small number of images must be preserved (e.g. Main Page images):
- Open each
File:page - Download the original file locally
- Verify the local copy
After this step, ALL files on the server may be deleted.
3. Delete All Files (Filesystem)
On the MediaWiki server:
rm -rf /var/www/mediawiki/images/*
Notes:
- Do NOT delete the
images/directory itself - This removes originals, thumbnails, archives, and temp files
4. Clean File Metadata (Database)
Using phpMyAdmin on the MediaWiki database:
TRUNCATE TABLE image;
TRUNCATE TABLE oldimage;
TRUNCATE TABLE filearchive;
Result:
- Special:FileList becomes empty
- Filename history is forgotten
- Re-uploading old filenames is allowed
5. Delete File Namespace Pages
Deleting files does NOT delete File: pages.
These pages must be removed explicitly.
Standard namespace IDs:
- File = 6
- File talk = 7
Using phpMyAdmin (MediaWiki database):
DELETE FROM page WHERE page_namespace = 6;
DELETE FROM page WHERE page_namespace = 7;
Then clean orphaned content:
DELETE FROM revision WHERE rev_page NOT IN (SELECT page_id FROM page);
DELETE FROM text WHERE old_id NOT IN (SELECT rev_text_id FROM revision);
6. Delete Asset Namespace Pages
Asset namespaces are custom and defined in LocalSettings.php.
In this system:
- Asset namespace ID = 3014
- Asset talk namespace ID = 3015
Using phpMyAdmin (MediaWiki database):
DELETE FROM page WHERE page_namespace = 3014;
DELETE FROM page WHERE page_namespace = 3015;
Then clean orphaned content:
DELETE FROM revision WHERE rev_page NOT IN (SELECT page_id FROM page);
DELETE FROM text WHERE old_id NOT IN (SELECT rev_text_id FROM revision);
Rationale:
- MediaWiki 1.45 maintenance scripts for mass deletion are inconsistent
- SQL cleanup is faster, clearer, and reliable for DEV resets
7. Clean Cargo Asset Data
Asset dashboards read from Cargo, not from pages.
Using phpMyAdmin on the Cargo database:
TRUNCATE TABLE Assets;
Result:
- Dashboards become empty
- Sequence numbers reset
- No ghost Asset rows remain
The dashboard PAGE itself must NOT be deleted.
8. Optional Hygiene Step
After large SQL deletions, optionally run:
php maintenance/run.php refreshLinks
This is not mandatory but recommended after repeated resets.
9. Verification Checklist
All of the following must be true:
- Special:FileList → empty
- Special:AllPages (File) → empty
- Special:AllPages (Asset) → empty
- Asset dashboards → empty (no rows)
- Cargo
Assetstable → empty
If all checks pass, the system is in a true zero state.
10. Exit Maintenance Mode
When cleanup is complete:
- Remove or comment out:
// $wgReadOnly = 'System maintenance in progress';
- Reload the wiki
- Log in
- Re-upload preserved images (if any)
11. Usage Policy
This reset procedure is:
- APPROVED for development and testing
- EXPECTED to be reused during Asset v2.x stabilization
- FORBIDDEN on production systems
End of document