A simple(ish) cleanup plugin for textpattern.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A plugin for Textpattern.

Download Location

You can download the latest compiled plugins from https://gist.github.com/1140873


Designed to do a little cleanup in new textpattern installations. Note the new in that statement.
It can also automatically install plugins that you might have included in your installation’s files directory.

There are Ogg Vorbis videos (with rough sound) of Basic and Advanced uses of this plugin.

Primary Targets.

When enabled, this plugin will terminate the following with extreme prejudice…

  • Comments
  • Links
  • Images
  • Categories (of all types)
  • Articles
  • Any files it loads as part of its advanced features
  • Any additional table’s content you’ve scripted in your optional cleanups.php file.

Do not use this plugin in existing installations with any content you wish to keep.

Secondary Targets.

In addition, this plugin will adjust a few preferences…

  • The default custom fields are removed
  • The site slogan is blanked
  • DNS and spam lookups are turned off
  • Email addresses are hidden in comments
  • Any preference you’ve scripted in your optional cleanups.php file

Filesystem Targets.

Where filesystem permissions allow, the plugin will…

  • Remove the setup directory
  • Remove the contents that it loads from the files directory (in case you used a cleanups file or autoloaded plugins — see later.) It does not remove the other files (if any) from that directory unless your cleanups.php file instructs it to.
  • Any directory you’ve scripted in your optional cleanups.php file

Final Target.

After searching out all the above sed_cleaner will self-terminate.

Usage & Installation.

a) Basic content reset…

  1. Either compile the plugin or download the latest compiled version.
  2. In your new installation, go to admin > plugins and upload the plugin.
  3. Read the message that appears upon installation then click “Ok”.
  4. If you now Enable the plugin it will be live and ready to go. This can delete ALL your content.
  5. Navigate to any other admin side tab to activate the plugin.

Your site should now have all its content removed and the sed_cleaner plugin will no longer be installed.

b) Content reset PLUS automatic plugin installation…

  1. Upload the compiled plugin files you wish to have autoinstalled into the site’s files directory. Each plugin file must end with the extension .plugin as all other extensions will be skipped. Uploading can be done via ftp or via textpattern’s content > files tab. If you take the time to collate all your standard plugins into your deployment before you transfer it to your new site’s server then you are really cooking.
  2. Now proceed with the steps in a) above.

Your site should now have all its content removed and have all the plugins installed that you uploaded to the files directory.

c) Content reset, plugin installation PLUS customised prefs…

  1. Create a customised cleanups.php script.
  2. Upload it to the site’s files directory (either via ftp or textpattern’s content > files tab.)
  3. Now proceed with the steps in b) above.

Your site should now have its content removed, plugins installed and preferences set.

d) Content reset, plugin installation, custom prefs PLUS presentation import…

  1. Prepare your pages, styles and forms for import. These must follow a specific naming convention for sed_cleaner to recognise them.
    1. Your stylesheets must follow the pattern: stylename.css where stylename is the name you wish the sheet to appear as inside Textpattern.
    2. Your pages must follow the pattern: pagename.page where pagename is the name of the page in Textpattern.
    3. Forms must follow the pattern: formname.type.form where formname is the name the form is to have and type is either article, link, comment, file or misc.
  2. Upload them to the site’s files directory (via the Textpattern interface, ftp, scp, sshfs or other mechanism.)
  3. Now proceed with the steps in c) above.

The cleanups.php file.

This optional file allows you to define additional custom actions to be taken by sed_cleaner.

You can customise the cleanup actions to be taken by editing the file. Once you’re happy with your cleanups file you should upload it to your site’s files directory. If sed_cleaner finds this “scripting” file it will attempt to perform the additional cleanup actions defined in it.

Command descriptions…

Command Purpose Arguments Examples
SetPref Sets the named preference to the given value. The name of the preference, followed by the value in double quotes. 'SetPref dateformat "%Y-%m-%d %H:%M"'
Truncate Resets the named table. The name of the table to reset. 'Truncate txp_discuss_ipban'
RemoveDir Removes the named directory (non recursive) relative to the textpattern directory The directory to be removed. 'RemoveDir ../rpc'
EnablePlugin Enables the named plugin (if installed) The plugin to be enabled. 'EnablePlugin smd_admin_themes'
DisablePlugin Disables the named plugin (if installed) The plugin to be disabled. 'DisablePlugin smd_admin_themes'
RemoveSection Remove a section from the site. The name (not the title) of the section to be deleted. RemoveSection about
AddSection Adds a section to the site. The title of the section to be deleted. The name will be infered from this. Optionally, the page to use, the style to use, appear in rss (0 or 1), on frontpage (0 or 1) and searchable (0 or 1) AddSection About single about 0 1 1 Adds a section titled ‘About’ using page single, style about, not in rss feed, on the frontpage and searchable.
RemovePage Remove a page from the site. The name of the page to be removed. RemovePage archive
BlankPage Remove the content of a page. If the page given is ‘default’ a little placeholder HTML will be inserted. The name of the page to be blanked. BlankPage default
BlankCSS Remove the content of a stylesheet. The name of the stylesheet to blank. BlankCSS default
RemoveForm Remove a form from the site. The name of the form to be removed. RemoveForm lofi
BlankForm Remove the content of a form. The name of the form to be blanked. BlankForm comment_display
RemoveFile Remove a file. The name of the file to be removed. Must be one of ‘license.txt’, ‘lgpl-2.1.txt’, ‘../HISTORY.txt’ or ‘../README.txt’ RemoveFile license.txt

Please study the packaged cleanups.php file for more examples.