Exemplo n.º 1
0
 /**
  * Delete all project repositories (on project deletion).
  *
  * @param Project $project
  */
 public function deleteProjectRepositories(Project $project)
 {
     $repositories = $this->repository_factory->getAllRepositories($project);
     foreach ($repositories as $repository) {
         $repository->forceMarkAsDeleted();
         $this->system_event_manager->createEvent('GIT_REPO_DELETE', $project->getID() . SystemEvent::PARAMETER_SEPARATOR . $repository->getId(), SystemEvent::PRIORITY_MEDIUM);
     }
 }
 private function migrateProject($project_to_migrate)
 {
     $project = $this->project_manager->getProjectFromAutocompleter($project_to_migrate);
     if ($project && $this->wiki_migrator->canMigrate($project)) {
         $this->system_event_manager->createEvent(SystemEvent_PHPWIKI_SWITCH_TO_PLUGIN::NAME, $project->getId(), SystemEvent::PRIORITY_HIGH);
         $GLOBALS['Response']->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_phpwiki', 'allowed_project_allow_project'));
     } else {
         $this->sendUpdateProjectListError();
     }
 }
 public function queueTrackerReindexation(Tracker $tracker)
 {
     $project_id = $tracker->getGroupId();
     if ($this->plugin->isAllowed($project_id)) {
         $this->system_event_manager->createEvent(SystemEvent_FULLTEXTSEARCH_TRACKER_REINDEX::NAME, $this->implodeParams(array($tracker->getId())), SystemEvent::PRIORITY_LOW, SystemEvent::OWNER_APP);
     }
 }
Exemplo n.º 4
0
 /**
  * This method allows one to save any repository attribues changes from the web interface.
  * @param <type> $repoId
  * @param <type> $repoAccess
  * @param <type> $repoDescription
  * @return <type>
  */
 public function save($projectId, $repoId, $repoAccess, $repoDescription)
 {
     $c = $this->getController();
     if (empty($repoId)) {
         $c->addError($this->getText('actions_params_error'));
         $c->redirect('/plugins/git/?action=index&group_id=' . $projectId);
         return false;
     }
     if (empty($repoAccess) || empty($repoDescription)) {
         $c->addError($this->getText('actions_params_error'));
         $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
         return false;
     }
     $repository = new GitRepository();
     $repository->setId($repoId);
     try {
         $repository->load();
         if (!empty($repoAccess)) {
             if ($repository->getBackend() instanceof Git_Backend_Gitolite) {
                 $repository->getBackend()->savePermissions($repository, $repoAccess);
             } else {
                 if ($repository->getAccess() != $repoAccess) {
                     $this->systemEventManager->createEvent('GIT_REPO_ACCESS', $repoId . SystemEvent::PARAMETER_SEPARATOR . $repoAccess, SystemEvent::PRIORITY_HIGH);
                     $c->addInfo($this->getText('actions_repo_access'));
                 }
             }
         }
         if (strlen($repoDescription) > 1024) {
             $c->addError($this->getText('actions_long_description'));
         } elseif (!empty($repoDescription)) {
             $repository->setDescription($repoDescription);
         }
     } catch (GitDaoException $e) {
         $c->addError($this->getText('actions_repo_not_found'));
         $c->redirect('/plugins/git/?group_id=' . $projectId);
         return false;
     } catch (GitRepositoryException $e1) {
         die('GitRepositoryException');
         $c->addError($e1->getMessage());
         return false;
     }
     try {
         $repository->save();
     } catch (GitDaoException $e) {
         $c->addError($e->getMessage());
         $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
         return false;
     }
     $c->addInfo($this->getText('actions_save_repo_process'));
     $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
     return;
 }
 public function queueCopyDocument(Docman_Item $item)
 {
     if ($this->plugin->isAllowed($item->getGroupId())) {
         $this->system_event_manager->createEvent(SystemEvent_FULLTEXTSEARCH_DOCMAN_COPY::NAME, $this->getDocmanSerializedParameters($item), SystemEvent::PRIORITY_MEDIUM, SystemEvent::OWNER_APP);
     }
 }
 public function queueDeleteMirror($mirror_id, $old_hostname)
 {
     $this->system_event_manager->createEvent(SystemEvent_GIT_DELETE_MIRROR::NAME, $mirror_id . SystemEvent::PARAMETER_SEPARATOR . $old_hostname, SystemEvent::PRIORITY_HIGH, SystemEvent::OWNER_APP);
 }
 public function queueWikiProjectReindexation($project_id)
 {
     if ($this->plugin->isAllowed($project_id)) {
         $this->system_event_manager->createEvent(SystemEvent_FULLTEXTSEARCH_WIKI_REINDEX_PROJECT::NAME, $project_id, SystemEvent::PRIORITY_LOW, SystemEvent::OWNER_APP);
     }
 }
 public static function queueInSystemEventManager(SystemEventManager $system_event_manager, GitRepository $repository)
 {
     $system_event_manager->createEvent(self::NAME, $repository->getId(), SystemEvent::PRIORITY_HIGH, SystemEvent::OWNER_APP);
 }
 public function queueTV3Migration(PFUser $user, Project $project, $tracker_id, $name, $description, $short_name)
 {
     $this->system_event_manager->createEvent(SystemEvent_TRACKER_V3_MIGRATION::NAME, $short_name . SystemEvent::PARAMETER_SEPARATOR . $name . SystemEvent::PARAMETER_SEPARATOR . $description . SystemEvent::PARAMETER_SEPARATOR . $user->getUnixName() . SystemEvent::PARAMETER_SEPARATOR . $project->getGroupId() . SystemEvent::PARAMETER_SEPARATOR . $tracker_id, SystemEvent::PRIORITY_HIGH, SystemEvent::OWNER_APP);
 }