Docs MediaHub Version 1.x Uninstalling

Uninstalling

MediaHub requires a review, a mode selection, and a typed confirmation before it will uninstall. Here is what happens at each step and how to recover your files if you need them.

Uninstalling MediaHub is a deliberate process. Because a MediaHub library can contain thousands of uploaded files, the uninstaller requires you to set a config value, review what will be affected, and confirm your intent before anything is deleted.

Only superusers can uninstall MediaHub. The uninstall checkbox has no effect for non-superuser accounts.

Step 1: Back up first

Before doing anything else, take a database backup and a copy of site/assets/files/. The uninstall is irreversible in Remove Everything mode. A backup takes a few minutes; recovering without one may be impossible.

Step 2: Set the uninstall mode in config.php

Add one of these lines to your site/config.php:

// Delete all pages, files, templates, fields, and database tables
$config->MediaHubUninstall = 'removeAll';

// Remove module only — keep uploaded files on disk
$config->MediaHubUninstall = 'keepAssets';

MediaHub will not allow uninstallation without one of these values set. This prevents accidental removal.

Mediahub uninstall config

Remove Everything

Deletes all asset, crop, tag, and collection pages. ProcessWire removes each page's site/assets/files/{page_id}/ directory as part of the deletion. Templates, fields, fieldgroups, and database tables are then dropped. After this, no trace of MediaHub remains in your database or on disk.

Use this when you are done with MediaHub permanently and have no need for the uploaded files.

Keep Assets

Removes the module infrastructure (templates, fields, fieldgroups, database tables, and admin pages) but leaves all asset pages and their files untouched on disk.

Before removing templates, MediaHub detaches them from all pages using a direct SQL update rather than deleting the pages themselves. This allows ProcessWire to drop the templates while the pages (and their file directories) remain in the database.

After a Keep Assets uninstall:

  • Your files remain at their existing site/assets/files/{page_id}/ paths
  • The pages still exist in ProcessWire's pages table with their IDs and parent relationships intact
  • The pages have no template assigned, so they are not accessible through the ProcessWire page API
  • You can query the pages table directly and access files by their known paths

Use this when migrating images to standard ProcessWire fields, switching to a different module, or when you need the files preserved while you evaluate your next step.

Step 3: Review the Uninstall Preparation panel

Go to Modules → Configure → MediaHub and expand the Uninstall Preparation section at the bottom of the page.

Once a valid config value is set, a status indicator confirms the active mode. The panel shows a live audit of everything currently in your MediaHub library:

  • Asset, crop, tag, and collection page counts
  • Total pages in the MediaHub tree
  • Disk usage across all asset file directories
  • Every template, field, and database table that will be removed

The audit updates to reflect your chosen mode. In Keep Assets mode, items that will be preserved are shown differently from items that will be removed.

Mediahub uninstall audit

Step 4: Uninstall

Scroll to the bottom of the module config page, check the Uninstall checkbox, and click Submit.

ProcessWire will call ___uninstall() on each module in reverse dependency order:

  1. InputfieldMediaHub: removes the picker inputfield
  2. ProcessMediaHub: removes the admin UI page and permission
  3. MediaHub: removes all templates, fields, pages (or detaches them), and database tables

After uninstalling, remove the $config->MediaHubUninstall line from site/config.php.

What each mode removes

Artifact Remove Everything Keep Assets
Asset, crop, tag, collection pages Deleted Kept (templateless)
Files on disk Deleted by ProcessWire Kept
Templates (pkd-mediahub-*) Removed Removed
Fields (pkd_mediahub_*, pkd_mhc_*, pkd_mhv_*) Removed Removed
Fieldgroups Removed Removed
Database tables Dropped Dropped
Admin pages (Setup → Media Hub) Removed Removed
Permission (media-hub-admin) Removed Removed

Accessing files after a Keep Assets uninstall

After a Keep Assets uninstall your files are still on disk in numbered directories under site/assets/files/. You can map page IDs to filenames by querying the pages table directly:

SELECT id, name, parent_id
FROM pages
WHERE parent_id IN (
    SELECT id FROM pages WHERE name = 'pkd-mediahub'
)
ORDER BY id;

Each id corresponds to a directory at site/assets/files/{id}/ containing the uploaded file and any ProcessWire-generated size variations.

If you are migrating to standard ProcessWire image fields, you can copy the original files (not the size variations, which contain dimension strings in their filename) to a staging directory and then attach them to your new fields programmatically.