示例#1
0
 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();
 }