Commit 58a6cc02 authored by Penny Leach's avatar Penny Leach
Browse files

fixing some of the documentation and things around the Plugin Class. NOTE

I changed the plugin postinst to also take $fromversion. nobody is using
this yet though
parent c882497f
......@@ -53,9 +53,6 @@ class PluginArtefactFile extends PluginArtefact {
return array('file');
}
public static function postinst() {
}
public static function sort_child_data($a, $b) {
if ($a->container && !$b->container) {
return -1;
......
......@@ -53,41 +53,6 @@ abstract class PluginArtefact extends Plugin {
* Gets a list of top level artefact types, used in the view creation wizard
*/
public static abstract function get_toplevel_artefact_types();
/**
* This function returns an array of menu items
* to be displayed
* Each item should be a StdClass object containing -
* - name language pack key
* - url relative to wwwroot
* @return array
*/
public static function menu_items() {
return array();
}
/**
* This function returns an array of crons it wants to have run
* Each item should be a StdtClass object containing -
* - name (will have artefact.$pluginname added for uniqueness)
* - script to hit relative to the documentroot
* NOTE THAT each plugin that implements this should ship with a
* .htaccess that denies access to all cron scripts
*/
public static function get_cron_options() {
return array();
}
/**
* This function returns an array of events to subscribe to
* by unique name.
* If an event the plugin is trying to subscribe to is unknown by the
* core, an exception will be thrown.
* @return array
*/
public static function get_event_subscriptions() {
return array();
}
}
/**
......
......@@ -711,18 +711,43 @@ define('DEBUG_DEVELOPER', 'whocares');
*/
class Plugin {
/**
* This function returns an array of crons it wants to have run
* Each item should be a StdtClass object containing -
* - callfunction (static function on the Plugin Class)
* - any or all of minute, hour, day, month, dayofweek
* (will default to * if not supplied)
*/
public static function get_cron() {
return array();
}
/**
* This function returns an array of events to subscribe to
* by unique name.
* If an event the plugin is trying to subscribe to is unknown by the
* core, an exception will be thrown.
* @return array
*/
public static function get_event_subscriptions() {
return array();
}
public static function postinst() {
/**
* This function will be run after every upgrade to the plugin.
*
* @param int $fromversion version upgrading from (or 0 if installing)
*/
public static function postinst($fromversion) {
return true;
}
/**
* Whether this plugin has admin plugin config options.
* If you return true here, you must supply a valid pieform
* in {@link get_config}
*/
public static function has_config() {
return false;
}
......
......@@ -333,8 +333,8 @@ function upgrade_plugin($upgrade) {
array_merge(array($pluginname),$types));
}
}
call_static_method($pcname, 'postinst');
call_static_method($pcname, 'postinst', $upgrade->from);
if ($db->HasFailedTrans()) {
$status = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment