本文整理汇总了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;
}
示例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;
}
}
示例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);
}
示例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));
}
示例5: Instance
public static function Instance()
{
if (self::$instance == null) {
self::$instance = new Backend();
}
return self::$instance;
}
示例6: process
public function process()
{
// Need to update aliases
Backend::instance('Aliases')->setNeedUpdateMailAliases();
$this->done();
return true;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}