/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { $action = strtolower($route); if ($action == 'install') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Get plugin published state $name = $manifest->name; $state = isset($manifest->published) ? (int) $manifest->published : 0; if ($state) { PFInstallerHelper::publishPlugin($name, $state); } } // Move CLI scripts to cli folder if ($action == 'install' || $action == 'update') { $cli_j2_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j2.php'; $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php'; $cli_j3_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j3.php'; $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php'; if (file_exists($cli_j2_source)) { if (file_exists($cli_j2_dest)) { if (JFile::delete($cli_j2_dest)) { JFile::copy($cli_j2_source, $cli_j2_dest); } } else { JFile::copy($cli_j2_source, $cli_j2_dest); } } if (file_exists($cli_j3_source)) { if (file_exists($cli_j3_dest)) { if (JFile::delete($cli_j3_dest)) { JFile::copy($cli_j3_source, $cli_j3_dest); } } else { JFile::copy($cli_j3_source, $cli_j3_dest); } } } // Remove CLI scripts if ($action == 'uninstall') { $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php'; $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php'; if (file_exists($cli_j2_dest)) { JFile::delete($cli_j2_dest); } if (file_exists($cli_j3_dest)) { JFile::delete($cli_j3_dest); } } return true; }
/** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param jadapterinstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter) { if (strtolower($route) == 'install' || strtolower($route) == 'update') { // Get the XML manifest data $manifest = $adapter->get('manifest'); // Get plugin published state $name = $manifest->name; $state = isset($manifest->published) ? (int) $manifest->published : 0; if ($state) { PFInstallerHelper::publishPlugin($name, $state); } } return true; }