Difference between revisions of "Preparing your Geeklog Plugin Distribution"

From GeeklogWiki
Jump to: navigation, search
(No difference)

Revision as of 09:20, 8 May 2009

The plugin tarfile

All Geeklog plugin tarfiles should use the following naming convention:

<plugin name>_<plugin version>_<geeklog version>.tar.gz

Descriptions

<plugin name>:
this is one of the single most important values you will choose for your plugin as it dictates the following:

  • The exact API function names that the Geeklog code will try to call for your plugin
  • The exact directory within the webtree to put all your plugin code
  • The exact directory within the admin directory to put your admin code
  • If using moderation, the exact table name main table being moderated
  • If using moderation, the submission table will be <plugin name>submission

<plugin version>:
used during the installation process to determine if you are attempting to upgrade a plugin or do a new installation. It is also checked to verify that you aren't trying to install and old version of the plugin when a new installation already exists.

<geeklog version>:
this is the Geeklog version the plugin works under.

The organization of your tarfile is standardized as well. For each directory and file a description is given. Your base plugin directory when you create the tarfile should be <plugin name>. Under there you will have the following:

config.php:
configuration page for your plugin. We'd prefer you to data-drive most the values if possible but using config.php is fine. This file can be called whatever you want...you are not restricted.

functions.inc:
this is the file where you implement the Geeklog API and where your plugin code should reside. It MUST be named this because we automatically include all enabled plugins function.inc files at the bottom of lib-common.php. Note that this means you have access to all the functions in lib-common.php in your plugin code.

lang.php or language/ directory:
the language file(s) for your plugin. You should include this file in your functions.inc. We recommend that you use a language directory and have a seperate language file for each supported language (english.php, etc.), mirroring Geeklog's behaviour and selecting the language file based on the user's preferred language (falling back to english.php if you can't find a language file for the selected language).

table.sql
the DDL needed to modify the Geeklog database so that your plugin will work. Note: you must provide an entry in the plugin table in your database. Without it, Geeklog will not know your plugin exists. Example: REPLACE INTO plugins (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) VALUES ('photos', '0.1', '1.2.2', 'http://www.tonybibbs.com', 1);

data.sql
sample data for your plugin

README
standard readme for software

/docs:
includes any documentation you may want to provide for your plugin such as history, to-do, etc

/admin:
includes only your admininstation pages

/public_html:
include your regular web pages

/updates:
includes all update sql and scripts. if you are writing an update SQL script be sure that you name it update_<previous version>.sql. The way this work is if you have version 0.1 installed for a plugin and you are installing version 0.2 the code will look for the update script for the currently isntalled version (0.1) and if it finds it, in this case update_0.1.sql then it will execute it automatically.