User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:dynamic_plugin_requirements

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mantisbt:dynamic_plugin_requirements [2007/10/30 11:58] jreesemantisbt:dynamic_plugin_requirements [2008/10/29 04:25] (current) – external edit 127.0.0.1
Line 26: Line 26:
  
 There will need to be a simple and unified method for plugins to maintain their database schema, otherwise plugins will get released without proper upgrade paths for users.  The plugin manager should provide an automated schema upgrade mechanism that works the same as the Mantis upgrade mechanism.  For performance reasons, the schema for plugins should only be checked when the plugin management screens are accessed, where it should notify the user of the need to upgrade the schema. There will need to be a simple and unified method for plugins to maintain their database schema, otherwise plugins will get released without proper upgrade paths for users.  The plugin manager should provide an automated schema upgrade mechanism that works the same as the Mantis upgrade mechanism.  For performance reasons, the schema for plugins should only be checked when the plugin management screens are accessed, where it should notify the user of the need to upgrade the schema.
 +
  
 ==== Event Types ====  ==== Event Types ==== 
Line 42: Line 43:
   * No return value   * No return value
   * Includes EVENT_PAGE_TOP and EVENT_PAGE_BOTTOM   * Includes EVENT_PAGE_TOP and EVENT_PAGE_BOTTOM
-** Process event **+** Chain event **
   * Event allowing a plugin to process an input string and return a modified version to the originator.   * Event allowing a plugin to process an input string and return a modified version to the originator.
   * Parameters:   * Parameters:
Line 94: Line 95:
   * Output content if necessary   * Output content if necessary
   * Return callback values to event originator if necessary   * Return callback values to event originator if necessary
 +
 +
  
 ===== Plugin Hierarchy ===== ===== Plugin Hierarchy =====
Line 113: Line 116:
   * ''register.php'' is the only file required for a plugin to be valid.  It must contain two callbacks for plugin information and event registrations.  This file should only have the following callbacks, but may include additional functions or callbacks for more complex plugins.     * ''register.php'' is the only file required for a plugin to be valid.  It must contain two callbacks for plugin information and event registrations.  This file should only have the following callbacks, but may include additional functions or callbacks for more complex plugins.  
     * ''plugin_callback_<basename>_info()'' - This function must return an array of plugin information, including name, version, ad dependencies.       * ''plugin_callback_<basename>_info()'' - This function must return an array of plugin information, including name, version, ad dependencies.  
-    * ''plugin_callback_<basename>_register()'' - This function must return an array of event names and corresponding function callbacks.+    * ''plugin_callback_<basename>_init()'' - This function must set up the plugin, and hook any events needed.
     * ''plugin_callback_<basename>_schema()'' - This function is only required if the plugin needs to maintain changes or additions to the Mantis schema.  It must return an array of schema upgrades in the same format as the ''admin/schema.php'' upgrade script.     * ''plugin_callback_<basename>_schema()'' - This function is only required if the plugin needs to maintain changes or additions to the Mantis schema.  It must return an array of schema upgrades in the same format as the ''admin/schema.php'' upgrade script.
   * ''events.php'' is required for using event hooks.  It should contain all the event callback functions, or include additional scripts with the necessary callbacks.  All event callback functions must be named as ''plugin_event_callback_<basename>_<name>()'' This script will only be loaded if the plugin has registered for an event.   * ''events.php'' is required for using event hooks.  It should contain all the event callback functions, or include additional scripts with the necessary callbacks.  All event callback functions must be named as ''plugin_event_callback_<basename>_<name>()'' This script will only be loaded if the plugin has registered for an event.
   * ''lang/'' is only required if the plugin needs to use language strings that don't appear in the standard language files.  These files will only be loaded if the requested strings cannot be found otherwise.   * ''lang/'' is only required if the plugin needs to use language strings that don't appear in the standard language files.  These files will only be loaded if the requested strings cannot be found otherwise.
   * ''pages/'' is only required if a plugin needs to have its own pages.  They can be accessed by linking a url returned by the ''plugin_page()'' function.  These pages need not load the core libraries, as it will already be loaded for them.   * ''pages/'' is only required if a plugin needs to have its own pages.  They can be accessed by linking a url returned by the ''plugin_page()'' function.  These pages need not load the core libraries, as it will already be loaded for them.
 +
 +
 +
  
 ==== Sample Plugin (Super Cow Powers) ==== ==== Sample Plugin (Super Cow Powers) ====
Line 152: Line 158:
  
 /** /**
- Register callback methods for any events necessary.+ Intitialize the plugin.
  */  */
-function plugin_callback_supercow_register() { +function plugin_callback_supercow_init() { 
-  plugin_register( 'EVENT_PLUGIN_INIT', 'header' );+  plugin_event_hook( 'EVENT_PLUGIN_INIT', 'header' );
 } }
 </code> </code>
Line 166: Line 172:
  * Handle the EVENT_PLUGIN_INIT callback.  * Handle the EVENT_PLUGIN_INIT callback.
  */  */
-function plugin_event_callback_supercow_header() {+function plugin_event_supercow_header() {
   header( 'X-Mantis: This Mantis has super cow powers.' );   header( 'X-Mantis: This Mantis has super cow powers.' );
 } }
 </code> </code>
 +
  
  
Line 196: Line 203:
   * (vboctor): It should be easy to develop features like Twitter notifications as plug-ins.  Once we do that, then the community can have plugins for all similar services like SMS, Jaiku, Pownce, etc.   * (vboctor): It should be easy to develop features like Twitter notifications as plug-ins.  Once we do that, then the community can have plugins for all similar services like SMS, Jaiku, Pownce, etc.
     * (jreese) Once again, this comes down to picking appropriate and useful events.     * (jreese) Once again, this comes down to picking appropriate and useful events.
 +  * (DGtlRift): In the above explanation and examples should ''plugin_callback_<basename>_register()'' be ''plugin_callback_<basename>_init()''?
mantisbt/dynamic_plugin_requirements.1193759884.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

Driven by DokuWiki