| |
| META TOPICPARENT |
name="WebHome" |
Creating a New cPAddon Script |
| | Assuming we are making a cPAddon for a CMS called "Foo" version 1.0, we would follow these steps:
- Create the working directory, as well as a backup.
|
|
< < |
-
- Example:
mkdir Foo_1.0.work & mkdir Foo_1.0.orig
|
> > |
-
- Example:
mkdir Foo_1.0.work && mkdir Foo_1.0.orig
|
| |
- Put
Foo_1.0.tar.gz into the working directory.
- Untar
Foo_1.0.tar.gz into Foo_1.0.orig/ and Foo_1.0.work/
|
|
< < |
-
-
tar -xvfz Foo_1.0.tar.gz ./Foo_1.0.orig/ & tar -xvfz Foo_1.0.tar.gz ./Foo_1.0.work/
|
> > |
-
-
tar xvfz Foo_1.0.tar.gz -C ./Foo_1.0.orig/ && tar xvfz Foo_1.0.tar.gz -C ./Foo_1.0.work/
|
| |
- Make a directory
Foo/
- Make
Foo.pm and place it into the working directory.
|
|
< < | |
> > | |
| |
- Modify
Foo_1.0.work/ here as needed.
- Your goal is to get the files necessary for the install all prepped and together.
- Remove any install scripts and upgrade scripts, as this is all handled via the cPAddons interface.
- Prepare any config files. This entails:
|
|
< < | |
> > | |
| |
-
- Set appropriate permissions on all the files (world readable config files and world writable directories will result in a much lower security rating).
- Create
Foo/1.0.mysql if needed.
|
|
< < | |
> > | |
| |
-
- You should also include a use statement at the top. Assuming the
mysql key in the module's $meta_info is 'mysql' => ['foo'],, your mysql file would start like this:
-
| USE [% foo %];|
-
| CREATE TABLE [% table_prefix %]_barbaz (|
|