/** * Enable a plugin for a site (default current site) * * Important: You should regenerate simplecache and the viewpath cache after executing this function * otherwise you may experience view display artifacts. Do this with the following code: * * elgg_regenerate_simplecache(); * elgg_reset_system_cache(); * * @deprecated 1.8 Use ElggPlugin->activate() * * @param string $plugin The plugin name. * @param int $site_guid The site id, if not specified then this is detected. * * @return array * @throws InvalidClassException */ function enable_plugin($plugin, $site_guid = null) { elgg_deprecated_notice('enable_plugin() was deprecated by ElggPlugin->activate()', 1.8); $plugin = sanitise_string($plugin); $site_guid = (int) $site_guid; if (!$site_guid) { $site = get_config('site'); $site_guid = $site->guid; } try { $plugin = new ElggPlugin($plugin); } catch (Exception $e) { return false; } if (!$plugin->canActivate($site_guid)) { return false; } return $plugin->activate($site_guid); }