Search by

ycloudyusa / useless_machines

podarok

Modules that turn themselves off.

Package info

github.com/YCloudYUSA/useless_machines

Type:drupal-module

pkg:composer/ycloudyusa/useless_machines

Statistics

Installs: 52 297

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 1

3.1.0 2026-12-02 14:28 UTC

README

An animation of a "useless machine" turning itself off.

useless_machines

Modules that turn themselves off.

A useless machine or useless box is a device whose only function is to turn itself off.

-- Wikipedia

What a stub is

A stub is a module with the machine name of a module that was removed from your site's code. Your database still lists the removed module as enabled, and Drupal cannot update a site with a missing module (troubleshooting). The stub fills that name with an empty module that uninstalls itself on drush updb and takes the module out of the configuration.

A stub is two files in a directory named like the module:

toolbar/toolbar.info.yml
toolbar/toolbar.post_update.php
name: toolbar
type: module
description: Dummy module to replace toolbar.
package: Useless Machines
core_version_requirement: ^12
/**
 * Uninstall me.
 */
function toolbar_post_update_uninstall() {
  \Drupal::service('module_installer')->uninstall(['toolbar']);
}

Current stubs: toolbar, admin_toolbar, admin_toolbar_tools, openy_gxp, openy_group_schedules, openy_prgf_group_schedules, jquery_ui_autocomplete, jquery_ui_menu, blazy, blazy_ui, blazy_layout, slick, slick_ui, slick_views, video_embed_field, video_embed_media, video_embed_wysiwyg, vem_migrate_oembed, openy_tour, jquery_ui_touch_punch, jquery_ui_tabs, jquery_ui_tooltip.

Add a stub

  1. Create the directory and the two files above, with the module's machine name everywhere (the post update function is <module>_post_update_<name>).
  2. A stub never admits a core where the real module still exists. toolbar is a core module on Drupal 11, openy_prgf_group_schedules and openy_tour are shipped by released versions of their packages that run on 11, so those stubs say core_version_requirement: ^12; a stub of a module that Drupal 11 already removed may say ^11 || ^12.
  3. If the module also exists as a Composer package, add "drupal/<package>": "*" to conflict in composer.json in the same commit. Composer then refuses a project that has both the stub and the real module. A submodule needs no entry of its own: its package is already listed.
  4. Release a new major or minor version.

A module that owns data (a content entity type, fields) needs an update function that removes that data before the uninstall; see groupex_form_cache in the 2.x releases for an example.

Keep a stubbed module

A package that requires useless_machines cannot be installed together with the real module of a stub (conflict, and the same machine name). To keep one:

  • fork this repository
    • remove the module's directory
    • remove its package from the conflict section in composer.json
  • swap out your fork by using an inline alias in your project's composer.json.