private function doInstall(Tiki_Profile $profile) { global $tikilib; $this->installed[$profile->url] = $profile; foreach ($profile->getPreferences() as $pref => $value) { $tikilib->set_preference($pref, $value); } foreach ($profile->getObjects() as $object) { $this->getInstallHandler($object)->install(); } $permissions = $profile->getPermissions(); $profile->replaceReferences($permissions); foreach ($permissions as $groupName => $info) { $this->setupGroup($groupName, $info['general'], $info['permissions'], $info['objects']); } }
function isInstallable(Tiki_Profile $profile) { foreach ($profile->getObjects() as $object) { $handler = $this->getInstallHandler($object); if (!$handler) { throw new Exception("No handler found for object type {$object->getType()} in {$profile->domain}:{$profile->profile}"); } if (!$handler->canInstall()) { throw new Exception("Object (#{$object->getRef()}) of type {$object->getType()} in {$profile->domain}:{$profile->profile} does not validate"); } } return true; }
private function doInstall(Tiki_Profile $profile) { global $tikilib, $prefs; $this->setFeedback(tra('Applying profile') . ': ' . $profile->profile); $this->installed[$profile->getProfileKey()] = $profile; $preferences = $profile->getPreferences(); $profile->replaceReferences($preferences, $this->userData); foreach ($preferences as $pref => $value) { if ($this->allowedGlobalPreferences === false || in_array($pref, $this->allowedGlobalPreferences)) { global $prefslib; include_once 'lib/prefslib.php'; $pinfo = $prefslib->getPreference($pref); if (!empty($pinfo['separator']) && !is_array($value)) { $value = explode($pinfo['separator'], $value); } if ($prefs[$pref] != $value) { $this->setFeedback(tra('Preference set') . ': ' . $pref . '=' . $value); } $tikilib->set_preference($pref, $value); } } require_once 'lib/setup/events.php'; tiki_setup_events(); foreach ($profile->getObjects() as $object) { $this->getInstallHandler($object)->install(); $this->setFeedback(tra('Added (or modified)') . ': ' . $object->getDescription()); } $groupMap = $profile->getGroupMap(); $profile->replaceReferences($groupMap, $this->userData); $permissions = $profile->getPermissions($groupMap); $profile->replaceReferences($permissions, $this->userData); foreach ($permissions as $groupName => $info) { $this->setFeedback(tra('Group changed (or modified)') . ': ' . $groupName); $this->setupGroup($groupName, $info['general'], $info['permissions'], $info['objects'], $groupMap); } tiki_setup_events(); }