A plugin for Textpattern.
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.
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.
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
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 yourcleanups.php
file instructs it to. - Any directory you’ve scripted in your optional
cleanups.php
file
After searching out all the above sed_cleaner will self-terminate.
- Either compile the plugin or download the latest compiled version.
- In your new installation, go to
admin > plugins
and upload the plugin. - Read the message that appears upon installation then click “Ok”.
- If you now Enable the plugin it will be live and ready to go. This can delete ALL your content.
- 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.
- 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’scontent > 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. - 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.
- Create a customised
cleanups.php
script. - Upload it to the site’s
files
directory (either via ftp or textpattern’scontent > files
tab.) - Now proceed with the steps in b) above.
Your site should now have its content removed, plugins installed and preferences set.
- Prepare your pages, styles and forms for import. These must follow a specific naming convention for sed_cleaner to recognise them.
- Your stylesheets must follow the pattern: stylename.css where stylename is the name you wish the sheet to appear as inside Textpattern.
- Your pages must follow the pattern: pagename.page where pagename is the name of the page in Textpattern.
- 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.
- Upload them to the site’s
files
directory (via the Textpattern interface, ftp, scp, sshfs or other mechanism.) - Now proceed with the steps in c) above.
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 | 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.
GPLv2