ICT:System RESET - FIles and Asset Namespace: Difference between revisions
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= System Reset – Files and | = System Reset – Assets, Files, and Cargo (DEV) = | ||
This document defines the ** | This document defines the **authoritative cleanup procedure** for the development | ||
Asset v2.x | environment of the Asset system (v2.x). | ||
It | It reflects **real-world behavior** observed on: | ||
* MediaWiki 1.45 | |||
* Cargo extension | |||
* AlmaLinux | |||
* MariaDB | |||
* Development-only data (fully disposable) | |||
This procedure | 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 <code>LocalSettings.php</code> and add near the top: | ||
</ | <syntaxhighlight lang="php"> | ||
$wgReadOnly = 'System maintenance in progress'; | |||
</syntaxhighlight> | |||
This prevents user edits and uploads during cleanup. | |||
--- | ---- | ||
== 2. Safeguard Files to Keep (if any) == | == 2. Safeguard Files to Keep (if any) == | ||
# Open each File page | If a small number of images must be preserved (e.g. Main Page images): | ||
# Open each <code>File:</code> page | |||
# Download the original file locally | # Download the original file locally | ||
# Verify the local copy | # Verify the local copy | ||
After this step, ALL files on the server may be deleted. | |||
---- | |||
== 3. Delete All Files (Filesystem) == | |||
On the MediaWiki server: | |||
On the MediaWiki server | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| Line 53: | Line 63: | ||
Notes: | Notes: | ||
* Do NOT delete the <code>images/</code> directory itself | * Do NOT delete the <code>images/</code> directory itself | ||
* This removes | * This removes originals, thumbnails, archives, and temp files | ||
---- | |||
== 4. Clean File Metadata (Database) == | |||
Using phpMyAdmin on the MediaWiki database: | |||
Using phpMyAdmin | |||
on the MediaWiki database: | |||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
| Line 69: | Line 79: | ||
Result: | Result: | ||
* Special:FileList becomes empty | * Special:FileList becomes empty | ||
* | * Filename history is forgotten | ||
* Re-uploading | * Re-uploading old filenames is allowed | ||
--- | ---- | ||
== 5. | == 5. Delete File Namespace Pages == | ||
< | Deleting files does NOT delete <code>File:</code> pages. | ||
These pages must be removed explicitly. | |||
Standard namespace IDs: | |||
* | * File = 6 | ||
* | * File talk = 7 | ||
Using phpMyAdmin (MediaWiki database): | |||
== 6 | <syntaxhighlight lang="sql"> | ||
DELETE FROM page WHERE page_namespace = 6; | |||
DELETE FROM page WHERE page_namespace = 7; | |||
</syntaxhighlight> | |||
Then clean orphaned content: | |||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
SELECT | 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); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
---- | |||
== 6. Delete Asset Namespace Pages == | |||
Asset namespaces are custom and defined in <code>LocalSettings.php</code>. | |||
In this system: | |||
* Asset namespace ID = 3014 | |||
* Asset talk namespace ID = 3015 | |||
Using phpMyAdmin (MediaWiki database): | |||
<syntaxhighlight lang="sql"> | |||
DELETE FROM page WHERE page_namespace = 3014; | |||
DELETE FROM page WHERE page_namespace = 3015; | |||
</syntaxhighlight> | |||
Then clean orphaned content: | |||
<syntaxhighlight lang=" | <syntaxhighlight lang="sql"> | ||
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); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
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 == | == 7. Clean Cargo Asset Data == | ||
Using phpMyAdmin on the Cargo database | |||
Asset dashboards read from Cargo, not from pages. | |||
Using phpMyAdmin on the Cargo database: | |||
<syntaxhighlight lang="sql"> | <syntaxhighlight lang="sql"> | ||
| Line 134: | Line 148: | ||
Result: | Result: | ||
* Dashboards become empty | |||
* Dashboards | * Sequence numbers reset | ||
* Sequence numbers reset | * No ghost Asset rows remain | ||
The dashboard PAGE itself must NOT be deleted. | |||
--- | ---- | ||
== 8. Optional Hygiene Step == | == 8. Optional Hygiene Step == | ||
After large deletions, optionally run: | |||
After large SQL deletions, optionally run: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
php maintenance/ | php maintenance/run.php refreshLinks | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This is not mandatory but recommended after repeated resets. | This is not mandatory but recommended after repeated resets. | ||
--- | ---- | ||
== 9. Verification Checklist == | == 9. Verification Checklist == | ||
All of the following must be true: | |||
* Special:FileList → empty | * Special:FileList → empty | ||
* Special:AllPages (File | * Special:AllPages (File) → empty | ||
* Special:AllPages (Asset | * Special:AllPages (Asset) → empty | ||
* Asset dashboards → empty | * Asset dashboards → empty (no rows) | ||
* | * Cargo <code>Assets</code> table → 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: | |||
<syntaxhighlight lang="php"> | |||
// $wgReadOnly = 'System maintenance in progress'; | |||
</syntaxhighlight> | |||
# Reload the wiki | |||
# Log in | |||
# Re-upload preserved images (if any) | |||
---- | |||
== 11. Usage Policy == | |||
This reset procedure is: | This reset procedure is: | ||
* APPROVED for development and testing | * APPROVED for development and testing | ||
* EXPECTED to be reused during Asset v2.x stabilization | |||
* FORBIDDEN on production systems | * FORBIDDEN on production systems | ||
--- | ---- | ||
''End of document'' | ''End of document'' | ||
Latest revision as of 17:30, 22 February 2026
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