当前位置: 首页>>代码示例>>PHP>>正文


PHP Backend::instance方法代码示例

本文整理汇总了PHP中Backend::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Backend::instance方法的具体用法?PHP Backend::instance怎么用?PHP Backend::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Backend的用法示例。


在下文中一共展示了Backend::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /** 
  * Process stored event
  */
 function process()
 {
     list($group_id, $shortname, $is_used) = $this->getParametersAsArray();
     if ($project = $this->getProject($group_id)) {
         // If 'CVS' was activated, create the repo (if it does not exist) and regenerate cvs_root_allow.
         // if 'CVS' was inactivated... keep the repository, and do nothing.
         if ($shortname == 'cvs' && $is_used) {
             // This function will not create the repo if it already exists
             if (!Backend::instance('CVS')->createProjectCVS($group_id)) {
                 $this->error("Could not create CVS repo for project {$group_id} after service activation");
                 return false;
             }
             Backend::instance('CVS')->setCVSRootListNeedUpdate();
         }
         // Same as for CVS.
         if ($shortname == 'svn' && $is_used) {
             $backendSVN = Backend::instance('SVN');
             if (!$backendSVN->createProjectSVN($group_id)) {
                 $this->error("Could not create SVN repo for project {$group_id} after service activation");
                 return false;
             }
             $backendSVN->setSVNApacheConfNeedUpdate();
         }
         $this->done();
         return true;
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:SystemEvent_SERVICE_USAGE_SWITCH.class.php

示例2: process

 public function process()
 {
     global $sys_allow_restricted_users;
     $parameters = $this->getParametersAsArray();
     $project = null;
     if (!empty($parameters[0])) {
         $project = $this->getProject($parameters[0]);
     } else {
         $this->error('Missing argument project id');
         return false;
     }
     $repositoryName = '';
     if (!empty($parameters[1])) {
         $repositoryName = $parameters[1];
     } else {
         $this->error('Missing argument repository name');
         return false;
     }
     $userId = 0;
     if (!empty($parameters[2])) {
         $userId = $parameters[2];
     } else {
         $this->error('Missing argument user id');
         return false;
     }
     try {
         $repository = new GitRepository();
         $repository->setBackend(Backend::instance('Git', 'GitBackend'));
         $repository->setDescription('-- Default description --');
         //default access is private when restricted users are allowed
         if ($sys_allow_restricted_users == 1) {
             $repository->setAccess(GitRepository::PRIVATE_ACCESS);
         } else {
             $repository->setAccess(GitRepository::PUBLIC_ACCESS);
         }
         $user = null;
         if (!empty($userId)) {
             $user = UserManager::instance()->getUserById($userId);
         }
         if (!empty($user)) {
             $repository->setCreator($user);
         }
         $repository->setProject($project);
         $repository->setName($repositoryName);
         $repository->create();
         $this->done();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitDriverException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitBackendException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:60,代码来源:SystemEvent_GIT_REPO_CREATE.class.php

示例3: createUser

 /**
  * Perform user creation on system
  * 
  * @param PFUser $user
  * 
  * @return Boolean
  */
 private function createUser(PFUser $user)
 {
     Backend::instance('Aliases')->setNeedUpdateMailAliases();
     $system_backend = Backend::instance('System');
     $system_backend->flushNscdAndFsCache();
     return $system_backend->createUserHome($user);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:SystemEvent_USER_CREATE.class.php

示例4: getProcessForQueue

 public function getProcessForQueue($request_queue)
 {
     $owner = SystemEvent::OWNER_APP;
     $custom_queues = array();
     $this->event_manager->processEvent(Event::SYSTEM_EVENT_GET_CUSTOM_QUEUES, array('queues' => &$custom_queues));
     if (isset($custom_queues[$request_queue])) {
         $this->logger = $custom_queues[$request_queue]->getLogger();
         $this->logger->debug('Processing ' . $request_queue . ' queue.');
         $process = new SystemEventProcessCustomQueue($request_queue);
         $owner = $custom_queues[$request_queue]->getOwner();
     } else {
         switch ($request_queue) {
             case SystemEvent::OWNER_APP:
                 $this->logger->debug('Processing default queue as app user.');
                 $process = new SystemEventProcessApplicationOwnerDefaultQueue();
                 break;
             case SystemEvent::DEFAULT_QUEUE:
                 $this->logger->debug('Processing default queue as root user.');
                 $owner = SystemEvent::OWNER_ROOT;
                 $process = new SystemEventProcessRootDefaultQueue();
                 break;
             default:
                 $this->logger->debug('Ignoring ' . $request_queue . ' queue.');
                 exit(0);
         }
     }
     if ($owner === SystemEvent::OWNER_APP) {
         return new SystemEventProcessor_ApplicationOwner($process, $this->system_event_manager, new SystemEventDao(), $this->logger);
     }
     return new SystemEventProcessor_Root($process, $this->system_event_manager, new SystemEventDao(), $this->logger, Backend::instance('Aliases'), Backend::instance('CVS'), Backend::instance('SVN'), Backend::instance('System'), new SiteCache($this->logger));
 }
开发者ID:ansarbek,项目名称:tuleap,代码行数:31,代码来源:SystemEventProcessor_Factory.php

示例5: Instance

 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new Backend();
     }
     return self::$instance;
 }
开发者ID:vortex52,项目名称:chat,代码行数:7,代码来源:backend.php

示例6: process

 public function process()
 {
     // Need to update aliases
     Backend::instance('Aliases')->setNeedUpdateMailAliases();
     $this->done();
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:SystemEvent_USER_EMAIL_CHANGED.class.php

示例7: process

 /** 
  * Process stored event
  */
 function process()
 {
     list($group_id, $project_is_private) = $this->getParametersAsArray();
     if ($project = $this->getProject($group_id)) {
         if ($project->usesCVS()) {
             if (!Backend::instance('CVS')->setCVSPrivacy($project, $project_is_private)) {
                 $this->error("Could not set cvs privacy for project {$group_id}");
                 return false;
             }
         }
         if ($project->usesSVN()) {
             $backendSVN = Backend::instance('SVN');
             if (!$backendSVN->setSVNPrivacy($project, $project_is_private)) {
                 $this->error("Could not set svn privacy for project {$group_id}");
                 return false;
             }
             if (!$backendSVN->updateSVNAccess($group_id)) {
                 $this->error("Could not update svn access file for project {$group_id}");
                 return false;
             }
         }
         //allows to link plugins to this system event
         $this->callSystemEventListeners(__CLASS__);
         $this->done();
         return true;
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:SystemEvent_PROJECT_IS_PRIVATE.class.php

示例8: process

 /** 
  * Process stored event
  */
 function process()
 {
     list($group_id, $user_id) = $this->getParametersAsArray();
     if ($project = $this->getProject($group_id)) {
         if ($user_id == 0) {
             return $this->setErrorBadParam();
         }
         // CVS writers
         if ($project->usesCVS()) {
             if (!Backend::instance('CVS')->updateCVSwriters($group_id)) {
                 $this->error("Could not update CVS writers for group {$group_id}");
                 return false;
             }
         }
         // SVN access file
         if ($project->usesSVN()) {
             if (!Backend::instance('SVN')->updateSVNAccess($group_id)) {
                 $this->error("Could not update SVN access file ({$group_id})");
                 return false;
             }
         }
         // Need to update system group cache
         Backend::instance('System')->setNeedRefreshGroupCache();
         $this->done();
         return true;
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:31,代码来源:SystemEvent_MEMBERSHIP_DELETE.class.php

示例9: restoreOwnership

 /**
  * Some files might have been generated as root but should be owned by codendiadm
  */
 public function restoreOwnership()
 {
     $backend = Backend::instance();
     $this->logger->debug("Restore ownership to " . $GLOBALS['Language']->getCacheDirectory());
     $backend->recurseChownChgrp($GLOBALS['Language']->getCacheDirectory(), ForgeConfig::get('sys_http_user'), ForgeConfig::get('sys_http_user'));
     $plugin_manager = PluginManager::instance();
     $this->logger->debug("Restore ownership to " . $plugin_manager->getCacheFile());
     $backend->changeOwnerGroupMode($plugin_manager->getCacheFile(), ForgeConfig::get('sys_http_user'), ForgeConfig::get('sys_http_user'), 0600);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:SiteCache.php

示例10: getBackend

 /**
  * Return a Backend instance
  *
  * Let plugins propose their own backend. If none provided, use the default one.
  *
  * @return Backend
  */
 public static function getBackend()
 {
     $backend = null;
     $params = array('backend' => &$backend);
     EventManager::instance()->processEvent('backend_factory_get_backend', $params);
     if ($backend === null) {
         $backend = Backend::instance();
     }
     return $backend;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:17,代码来源:BackendFactory.class.php

示例11: get_system_event_class

 public function get_system_event_class($params)
 {
     switch ($params['type']) {
         case 'SVN_CREATE_REPOSITORY':
             include_once dirname(__FILE__) . '/events/SystemEvent_SVN_CREATE_REPOSITORY.class.php';
             $params['class'] = 'SystemEvent_SVN_CREATE_REPOSITORY';
             $params['dependencies'] = array(Backend::instance(Backend::SVN));
             break;
     }
 }
开发者ID:blestab,项目名称:tuleap,代码行数:10,代码来源:svnPlugin.class.php

示例12: tearDown

 public function tearDown()
 {
     parent::tearDown();
     EventManager::clearInstance();
     unset($GLOBALS['homedir_prefix']);
     $backend = Backend::instance();
     $backend->recurseDeleteInDir($this->toto_home);
     rmdir($this->toto_home);
     $backend->recurseDeleteInDir($this->foobar_home);
     rmdir($this->foobar_home);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:User_SSHKeyDumperTest.php

示例13: process

 public function process()
 {
     $user_id = $this->getIdFromParam($this->parameters);
     if ($user = UserManager::instance()->getUserById($user_id)) {
         if (!Backend::instance('System')->dumpSSHKeysForUser($user)) {
             $this->error("Could not dump ssh keys for user " . $user->getUserName());
             return false;
         }
     } else {
         $this->error("Could not create/initialize user object");
         return false;
     }
     $this->done();
     return true;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:15,代码来源:SystemEvent_EDIT_SSH_KEYS.class.php

示例14: process

 /** 
  * Process stored event
  */
 function process()
 {
     list($group_id, $cvs_is_private) = $this->getParametersAsArray();
     if ($project = $this->getProject($group_id)) {
         if ($project->usesCVS()) {
             if (!Backend::instance('CVS')->setCVSPrivacy($project, $cvs_is_private)) {
                 $this->error("Could not set cvs is private for group {$group_id}");
                 return false;
             }
         }
         $this->done();
         return true;
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:18,代码来源:SystemEvent_CVS_IS_PRIVATE.class.php

示例15: process

 /** 
  * Process stored event
  */
 function process()
 {
     // Check parameters
     $group_list_id = $this->getIdFromParam($this->parameters);
     if ($group_list_id == 0) {
         return $this->setErrorBadParam();
     }
     if (!Backend::instance('MailingList')->createList($group_list_id)) {
         $this->error("Could not create mailing list {$group_list_id}");
         return false;
     }
     // Need to add list aliases
     Backend::instance('Aliases')->setNeedUpdateMailAliases();
     $this->done();
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:19,代码来源:SystemEvent_MAILING_LIST_CREATE.class.php


注:本文中的Backend::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。