O'Reilly logo

CMS Made Simple Development Cookbook by Samuel Goldstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cleaning up when a module is uninstalled

When a site administrator uninstalls a module, they are telling the system that they no longer want or need the functionality that the module provides. A good module doesn't waste resources or create unnecessary clutter, and therefore, when uninstalled, should remove all traces of itself.

This recipe shows you how to create a method that gets called when your module is uninstalled, and how to clean up database tables and sequences that it has created.

How to do it...

  1. Create a module stub by any of the methods described in Chapter 4, Getting Started with Modules. Call your new module "Enemies."
  2. Using your favorite editor, create a new file and type the following code:
    <?php if (!isset($gCms)) exit; $taboptarray ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required