In the process of customization, features coded by you can be packaged as extensions to ZenTao. The followings are the packaging standards for ZenTao.
1. Extension file structure
bin: newly added scripts, etc;config: modifying configuration files, etc;
db: install.sql and uninstall.sqldbcan be saved in this directory, these two SQL scripts are to install and uninstall the extension;
doc: documents related to your extension;
lib: add a new class or modify the existing class in this directory;
module: add a new module or extend existing modules in this directory;
www: add your style files or modify js file in this directory;
2. Files in the directory of doc
Configuration files of the extension should be included in the directory of doc and it saved by languages. For example, the English language files is saved as en.yaml and the Chinese language file as zh-cn.yaml. The configuration files of extensions are in the format of yaml, which include the basic information about the extensions and the release information about the previous builds.
3. Files included in the directory of db
install.sql and uninstall.sql are included in the directory of db. install.sql is the script executed when you install the extension and uninstall.sql is executed when you uninstall it. If your extensions involve changes to the database, save SQL scripts in these two files and ZenTao extension program will automatically execute it.4. Files included in the directory of module
Deploy the files in the directory of module according to extension mechanism.5. Extension of the master configuration files
If you have to extend the configuration files globally, put the extended configuration files to zentao/config/ext/.6. Install and delete hook scripts
If you have to do some executions before and after the installation and the uninstalling, create a directory for hook, then create preinstall.php, postinstall.php, preuninstall.php and postuninstall.php.7. Summary
Steps to create an extension.
1. Choose the name for you extensions, such as hello;
2. Create a directory for hello;3. Create the directory of doc hello;
4. Create the configuration file of yaml in doc;
5. If any changes to the database, you should create a directory of db in hello, and create install.sql and uninstall.sql in it.
6. If you use hook scripts, create a directory of hook, and create preinstall.php, postinstall.php, preuninstall.php and postuninstall.php in it.
7. Then deploy the code of hello. Create a directory of module in hello, and then save codes to it.
8. Pack and zip the entire directory of hello into hello.zip. Done=)