private static function InstallPlugins() { require_once($GLOBALS['g_campsiteDir'].'/include/campsite_constants.php'); require_once(dirname(dirname(dirname(__FILE__))) . DIR_SEP . 'db_connect.php'); require_once(CS_PATH_CONFIG.DIR_SEP.'liveuser_configuration.php'); foreach (CampPlugin::GetPluginsInfo() as $info) { $CampPlugin = new CampPlugin($info['name']); $CampPlugin->create($info['name'], $info['version']); $CampPlugin->install(); if ($CampPlugin->isEnabled()) { $CampPlugin->enable(); } else { $CampPlugin->disable(); } if (function_exists("plugin_{$info['name']}_addPermissions")) { call_user_func("plugin_{$info['name']}_addPermissions"); } } }
} $CampPlugin->delete(); } } foreach ($p_plugins as $plugin => $oldversion) { $CampPlugin = new CampPlugin($plugin); // installed version, if exists $currentVersion = $CampPlugin->getFsVersion(); if ($p_enabled && array_key_exists($plugin, $p_enabled) && $p_enabled[$plugin]) { if ($CampPlugin->exists()) { if ($CampPlugin->getDbVersion() != $currentVersion) { // update plugin $CampPlugin->delete(); $CampPlugin->create($plugin, $currentVersion); $CampPlugin->update(); $CampPlugin->enable(); // update autoload exec('php ' . $GLOBALS['g_campsiteDir'] . '/scripts/newscoop.php autoload:update'); } else { // just enable plugin $CampPlugin->enable(); } } else { // install + enable not previously installed plugin $CampPlugin->create($plugin, $currentVersion); $CampPlugin->install(); $CampPlugin->enable(); // update autoload exec('php ' . $GLOBALS['g_campsiteDir'] . '/scripts/newscoop.php autoload:update'); } } else {
private static function InstallPlugins() { require_once $GLOBALS['g_campsiteDir'] . '/include/campsite_constants.php'; require_once dirname(dirname(dirname(__FILE__))) . DIR_SEP . 'db_connect.php'; require_once dirname(dirname(dirname(__FILE__))) . '/classes/CampPlugin.php'; foreach (CampPlugin::GetPluginsInfo() as $info) { $CampPlugin = new CampPlugin($info['name']); $to_enable = true; if (isset($info['enabled_by_default'])) { $to_enable = in_array($info['enabled_by_default'], array(true, 1, 'Y')) ? true : false; } $CampPlugin->create($info['name'], $info['version'], $to_enable); $CampPlugin->install(); if ($CampPlugin->isEnabled()) { $CampPlugin->enable(); } else { $CampPlugin->disable(); } if (function_exists("plugin_{$info['name']}_addPermissions")) { call_user_func("plugin_{$info['name']}_addPermissions"); } } }