Jump to content

ICT:System RESET - FIles and Asset Namespace

From Costa Sano MediaWiki
Revision as of 15:12, 22 February 2026 by Mngr (talk | contribs) (Created page with "= System Reset – Files and Asset Namespace = This document defines the **standard, repeatable procedure** to fully clean the system during Asset v2.x development. It is intended for **development and testing environments only**. All data (Assets and files) is assumed to be disposable. This procedure MAY be executed multiple times during development. --- == 1. Preconditions == Before starting: * You have shell access to the MediaWiki server * You have phpMyAdmin a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

System Reset – Files and Asset Namespace

This document defines the **standard, repeatable procedure** to fully clean the system during Asset v2.x development.

It is intended for **development and testing environments only**. All data (Assets and files) is assumed to be disposable.

This procedure MAY be executed multiple times during development.

---

1. Preconditions

Before starting:

  • You have shell access to the MediaWiki server
  • You have phpMyAdmin access to the MariaDB/Cargo database
  • MediaWiki is NOT in active use by other users
  • Any files that must be preserved have been downloaded locally

---

2. Safeguard Files to Keep (if any)

If a small number of files must be preserved (e.g. Main Page images):

  1. Open each File page
  2. Download the original file locally
  3. Verify the local copy opens correctly

After this step, all files on the server may be deleted.

---

3. Delete ALL Files (Filesystem Level)

On the MediaWiki server, remove all stored files.

rm -rf /var/www/mediawiki/images/*

Notes:

  • Do NOT delete the images/ directory itself
  • This removes all uploaded files, thumbnails, archives, and temp files

---

4. Clean File Metadata (Database Level)

Using phpMyAdmin on the MariaDB server, execute the following SQL commands on the MediaWiki database:

TRUNCATE TABLE image;
TRUNCATE TABLE oldimage;
TRUNCATE TABLE filearchive;

Result:

  • Special:FileList becomes empty
  • File history is forgotten
  • Re-uploading previously used filenames is allowed

---

5. Run MediaWiki File Cleanup Script

On the MediaWiki server, run:

php maintenance/cleanupImages.php

Purpose:

  • Removes residual inconsistencies
  • Ensures MediaWiki state matches filesystem and database

---

6. Delete ALL Asset Pages (Namespace Cleanup)

6.1 Determine Asset Namespace ID

In phpMyAdmin, run:

SELECT ns_id, ns_name FROM mw_namespace;

Note the numeric ns_id corresponding to Asset. (Example: 300 – actual value may differ.)

---

6.2 Generate List of Asset Pages

On the MediaWiki server:

php maintenance/getAllPages.php --namespace=3014 > /tmp/asset_pages.txt

Replace NS_ID with the Asset namespace ID.

---

6.3 Delete Asset Pages in Bulk

Run:

php maintenance/deleteBatch.php /tmp/asset_pages.txt

Result:

  • All pages in the Asset namespace are deleted
  • Revisions and logs are handled correctly
  • No UI interaction required

---

7. Clean Cargo Asset Data

Using phpMyAdmin on the Cargo database, execute:

TRUNCATE TABLE Assets;

Result:

  • No Asset data remains
  • Dashboards return empty
  • Sequence numbers reset cleanly

---

8. Optional Hygiene Step

After large deletions, optionally run:

php maintenance/refreshLinks.php

This is not mandatory but recommended after repeated resets.

---

9. Verification Checklist

After completing all steps:

  • Special:FileList → empty
  • Special:AllPages (File namespace) → empty
  • Special:AllPages (Asset namespace) → empty
  • Asset dashboards → empty
  • Uploading a previously used filename → allowed

If all checks pass, the system is in a **clean zero state**.

---

10. Usage Policy

This reset procedure is:

  • APPROVED for development and testing
  • FORBIDDEN on production systems
  • EXPECTED to be executed repeatedly during Asset v2.x stabilization

---

End of document