Aspen:Module Install
From Aspen Documentation
Aspen was designed to be a modular framework, so that functionality you develop may be shared with others.
Install
To create an installation process for your module, you'll need to create an install method inside. For example, our blog module may have an install process of the following:
public function install($my_guid = false){ return $this->APP->model->query(' CREATE TABLE `blog` ( `entry_id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `entry_title` TEXT NOT NULL , `entry_body` LONGTEXT NOT NULL , `date_posted` DATETIME NOT NULL , PRIMARY KEY ( `entry_id` ) ) ENGINE = MYISAM; '); }
When you click the install link for this module, the installation class calls this functions and expects a return value. If false, the installation reports an array so be careful of how you return the value.
The installation process automatically provides the GUID of the current module to this function in case you need for automatically assigning permissions, etc.
Uninstall
The same process occurs for the uninstall functionality. A sample uninstall method for the blog module might look like this:
public function uninstall($my_guid = false){ return $this->APP->model->drop('blog'); }
The install process handles removing the module from the permissions table, the modules table, and any autoload_with connections.