===== Plugin Specific Files ===== ==== makelos ==== This is a script that is used for installing, uninstalling and testing your plugin. Search for ''geo_kit'' in this file for places that will need modification for your plugin. The installation script, called from this script, is what does the actual installation and uninstallation. In this example, it is ''plugin_home/installer/geo_kit_installer.php''. #!/usr/bin/env php _getInstaller(); $Installer->install(); } function uninstall() { $Installer =& $this->_getInstaller(); $Installer->uninstall(); } function &_getInstaller() { $plugin_dir = AK_BASE_DIR.DS.'app'.DS.'vendor'.DS.'plugins'.'geo_kit'; $installer_file = $plugin_dir.DS.'installer'.DS.'geo_kit_installer.php'; require_once($installer_file); $Installer =& new GeoKitInstaller(); return $Installer; } function connectToDatabase($database_settings) { $this->_includeDependencies(); Ak::db($database_settings[AK_ENVIRONMENT]); } function _includeDependencies() { require_once(AK_LIB_DIR.DS.'Ak.php'); require_once(AK_LIB_DIR.DS.'AkObject.php'); require_once(AK_LIB_DIR.DS.'AkInflector.php'); require_once(AK_LIB_DIR.DS.'AkPlugin.php'); require_once(AK_LIB_DIR.DS.'AkPlugin/AkPluginManager.php'); require_once(AK_LIB_DIR.DS.'AkInstaller.php'); require_once(AK_LIB_DIR.DS.'utils'.DS.'generators'.DS.'AkelosGenerator.php'); } } $Makelos = new Makelos(); $Makelos->connectToDatabase($database_settings); $Makelos->$task(@$argv); ==== init.php ==== Contains code that is executed each time the user's project is started. In some cases, it may run the plugin. ==== geo_kit_installer.php ==== This script will perform the install and uninstall of the plugin. You will need to modify it for your plugin. If you have a neat piece of code for a plugin installer that you've written, please modify this entry to include your well-documented code, even though it doesn't apply to the geo_kit plugin. The installer is stored in ''plugin_home/installer/'' and is executed at a command line: cd project/app/vendor/plugins/geo_kit makelos install or makelos uninstall Following is a listing of ''plugin_dir/installer/geo_kit_installer.php''. When writing your plugin installer, you may copy, rename and modify this script. Make sure that your ''makelos'' script points to your installer file. ",$geo_kit_config."\n?>",$config); if(!file_put_contents($config_file,$config)) { echo "\ngeo_kit installation failed. Creation of new $config_file failed\n"; return; } # Copy the plugin program files from plugins/geo_kit/lib to app_home/lib. $plugin_lib = $plugin_dir.DS."lib".DS; $cmd = "cp -R $plugin_lib ".AK_BASE_DIR; exec($cmd); if(!file_exists(AK_BASE_DIR.DS.'lib')) { if(!mkdir(AK_BASE_DIR.DS.'lib',775)) { echo "\ngeo_kit installation failed during attempt to copy "; echo "\"lib\" directory files\n"; return; } echo "\ngeo_kit is now installed\n"; } // function install function uninstall() { # Restore /config/config.php to what it was before geo_kit # was installed. $config_file = AK_BASE_DIR.DS.'config'.DS.'config.php'; $backup = str_replace('config.php','BEFORE_geo_kit-config.php',$config_file); $config = file_get_contents($config_file); if(!file_exists($backup)) { echo "\ngeo_kit is not installed\n"; return; } if(!rename($backup,$config_file)) { echo "geo_kit uninstallation failed. Attempt to rename $backup to $config_file failed\n"; return; } # Delete app_home/lib/geo_kit and the files in it. $lib_dir = AK_BASE_DIR.DS.'lib'.DS.'geo_kit'; exec("rm -rf $lib_dir"); echo "\ngeo_kit has been uninstalled\n"; } } ?> ===== Return ===== [[plugin-create|Create A Plugin]]