/**
  * Compute the content of the widget
  * @return string html
  */
 public function getContent()
 {
     $hp = Codendi_HTMLPurifier::instance();
     $se = SystemEventManager::instance();
     $content = '';
     $content .= $se->fetchLastEventsStatus(0, 10);
     $content .= '<div style="text-align:center"><a href="/admin/system_events/">[ ' . $GLOBALS['Language']->getText('global', 'more') . ' ]</a></div>';
     return $content;
 }
Exemplo n.º 2
0
 private function getTV3MigrationManager()
 {
     return new Tracker_Migration_MigrationManager(new Tracker_SystemEventManager(SystemEventManager::instance()), $this->getTrackerFactory(), $this->getArtifactFactory(), $this->getTrackerFormElementFactory(), UserManager::instance(), ProjectManager::instance());
 }
 private function getTrackerSystemEventManager()
 {
     $form_element_factory = Tracker_FormElementFactory::instance();
     $permissions_serializer = new Tracker_Permission_PermissionsSerializer(new Tracker_Permission_PermissionRetrieveAssignee(UserManager::instance()));
     $artifact_properties_extractor = new ElasticSearch_1_2_ArtifactPropertiesExtractor($form_element_factory, $permissions_serializer);
     return new FullTextSearch_TrackerSystemEventManager(SystemEventManager::instance(), new FullTextSearchTrackerActions($this->getIndexClient(self::SEARCH_TRACKER_TYPE), new ElasticSearch_1_2_RequestTrackerDataFactory($artifact_properties_extractor), $this->getFullTextSearchSystemEventQueue()->getLogger()), Tracker_ArtifactFactory::instance(), TrackerFactory::instance(), $this, $this->getFullTextSearchSystemEventQueue()->getLogger());
 }
Exemplo n.º 4
0
require_once 'www/admin/admin_utils.php';
require_once 'www/project/admin/project_admin_utils.php';
require_once 'www/project/export/project_export_utils.php';
require_once 'www/project/admin/project_history.php';
require_once 'common/include/TemplateSingleton.class.php';
require_once 'common/event/EventManager.class.php';
session_require(array('group' => '1', 'admin_flags' => 'A'));
$pm = ProjectManager::instance();
$group = $pm->getProject($group_id, false, true);
$currentproject = new project($group_id);
$em = EventManager::instance();
$Rename = $request->get('Rename');
if ($Rename) {
    $new_name = $request->get('new_name');
    if (isset($new_name) && $group_id) {
        if (SystemEventManager::instance()->canRenameProject($group)) {
            $rule = new Rule_ProjectName();
            if (!$rule->isValid($new_name)) {
                $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('admin_groupedit', 'invalid_short_name'));
                $GLOBALS['Response']->addFeedback('error', $rule->getErrorMessage());
                $GLOBALS['Response']->redirect('/admin/groupedit.php?group_id=' . $group_id);
            } else {
                $em->processEvent(Event::PROJECT_RENAME, array('group_id' => $group_id, 'new_name' => $new_name));
                //update group history
                group_add_history('rename_request', $group->getUnixName(false) . ' :: ' . $new_name, $group_id);
                $GLOBALS['Response']->addFeedback('info', $Language->getText('admin_groupedit', 'rename_project_msg', array($group->getUnixName(false), $new_name)));
                $GLOBALS['Response']->addFeedback('warning', $Language->getText('admin_groupedit', 'rename_project_warn'));
                $GLOBALS['Response']->redirect('/admin/groupedit.php?group_id=' . $group_id);
            }
        } else {
            $GLOBALS['Response']->addFeedback('warning', $Language->getText('admin_groupedit', 'rename_project_already_queued'), CODENDI_PURIFIER_DISABLED);
Exemplo n.º 5
0
    if (!$user->isSuperUser() && !$user->isAdmin($project_id) || !$user->isActive()) {
        throw new RuntimeException($GLOBALS['Language']->getText('project_import', 'invalid_user', array($username)));
    }
    if (is_dir($archive_path)) {
        $archive = new Import\DirectoryArchive($archive_path);
    } else {
        $archive = new Import\ZipArchive($archive_path, ForgeConfig::get('tmp_dir'));
    }
    $archive->extractFiles();
    $collection_from_archive = $builder->buildFromArchive($archive);
    $users_collection = $transformer->transform($collection_from_archive, $mapping_path);
    $users_collection->process($user_manager, $broker_log);
    $user_finder = new User\XML\Import\Mapping($user_manager, $users_collection, $broker_log);
    $xml_importer = new ProjectXMLImporter(EventManager::instance(), ProjectManager::instance(), $xml_validator, new UGroupManager(), $user_finder, $broker_log);
    if (empty($project_id)) {
        $factory = new SystemEventProcessor_Factory($logger, SystemEventManager::instance(), EventManager::instance());
        $system_event_runner = new Tuleap\Project\SystemEventRunner($factory);
        $xml_importer->importNewFromArchive($archive, $system_event_runner, $project_name_override);
    } else {
        $xml_importer->importFromArchive($project_id, $archive);
    }
    $archive->cleanUp();
    exit(0);
} catch (XML_ParseException $exception) {
    foreach ($exception->getErrors() as $parse_error) {
        $broker_log->error('XML: ' . $parse_error . ' line:' . $exception->getSourceXMLForError($parse_error));
    }
} catch (Exception $exception) {
    $broker_log->error(get_class($exception) . ': ' . $exception->getMessage() . ' in ' . $exception->getFile() . ' L' . $exception->getLine());
}
exit(1);
Exemplo n.º 6
0
 private function getRepositoryManager()
 {
     require_once 'GitRepositoryManager.class.php';
     return new GitRepositoryManager($this->getRepositoryFactory(), SystemEventManager::instance());
 }
 private function getProftpdSystemEventManager()
 {
     return new \Tuleap\ProFTPd\SystemEventManager(SystemEventManager::instance(), Backend::instance(), $this->getPermissionsManager(), ProjectManager::instance(), $this->getPluginInfo()->getPropVal('proftpd_base_directory'));
 }
Exemplo n.º 8
0
 /**
  * Wrapper for SystemEventManager object
  *
  * @return SystemEventManager
  */
 protected function getSystemEventManager()
 {
     return SystemEventManager::instance();
 }
 public function __construct()
 {
     $this->project_manager = ProjectManager::instance();
     $this->resource_restrictor = new MediawikiSiteAdminResourceRestrictor(new MediawikiSiteAdminResourceRestrictorDao(), $this->project_manager);
     $this->system_event_manager = SystemEventManager::instance();
 }
Exemplo n.º 10
0
 /**
  * Instantiate an action based on a given name.
  *
  * Can be overriden to pass additionnal parameters to the action
  *
  * @param string $action The name of the action
  *
  * @return PluginActions
  */
 protected function instantiateAction($action)
 {
     return new $action($this, SystemEventManager::instance(), $this->factory);
 }
Exemplo n.º 11
0
             }
             break;
         case User::STATUS_DELETED:
             $user->setStatus($request->get('form_status'));
             $user->setUnixStatus($user->getStatus());
             $accountActivationEvent = 'project_admin_delete_user';
             break;
         case User::STATUS_SUSPENDED:
             $user->setStatus($request->get('form_status'));
             $user->setUnixStatus($user->getStatus());
             break;
     }
 }
 // Change login name
 if ($user->getUserName() != $request->get('form_loginname')) {
     if (SystemEventManager::instance()->canRenameUser($user)) {
         $vLoginName = new Valid_UserNameFormat('form_loginname');
         $vLoginName->required();
         if ($request->valid($vLoginName)) {
             switch ($user->getStatus()) {
                 case User::STATUS_PENDING:
                 case User::STATUS_VALIDATED:
                 case User::STATUS_VALIDATED_RESTRICTED:
                     $user->setUserName($request->get('form_loginname'));
                     break;
                 default:
                     $em->processEvent(Event::USER_RENAME, array('user_id' => $user->getId(), 'new_name' => $request->get('form_loginname')));
                     $GLOBALS['Response']->addFeedback('info', $Language->getText('admin_usergroup', 'rename_user_msg', array($user->getUserName(), $request->get('form_loginname'))));
                     $GLOBALS['Response']->addFeedback('warning', $Language->getText('admin_usergroup', 'rename_user_warn'));
             }
         }
Exemplo n.º 12
0
<?php

/**
 * Copyright (c) Enalean SAS, 2013-2015. All rights reserved
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
require_once 'pre.php';
$request_queue = isset($argv[1]) ? $argv[1] : SystemEvent::DEFAULT_QUEUE;
$factory = new SystemEventProcessor_Factory(new BackendLogger(), SystemEventManager::instance(), EventManager::instance());
$processor = $factory->getProcessForQueue($request_queue);
$mutex = new SystemEventProcessorMutex(new SystemEventProcessManager(), $processor);
$mutex->execute();
Exemplo n.º 13
0
 /**
  * Instantiate an action based on a given name.
  *
  * Can be overriden to pass additionnal parameters to the action
  *
  * @param string $action The name of the action
  *
  * @return PluginActions
  */
 protected function instantiateAction($action)
 {
     $system_event_manager = SystemEventManager::instance();
     $git_repository_manager = new GitRepositoryManager($this->factory, $system_event_manager);
     return new $action($this, $system_event_manager, $this->factory, $git_repository_manager);
 }
Exemplo n.º 14
0
 public function __construct()
 {
     parent::__construct();
     $this->system_event_manager = SystemEventManager::instance();
 }
 public function __construct()
 {
     $this->project_manager = ProjectManager::instance();
     $this->wiki_migrator = new PHPWikiAdminMigrator(new PHPWikiAdminMigratorDao(), $this->project_manager);
     $this->system_event_manager = SystemEventManager::instance();
 }
Exemplo n.º 16
0
 public function getGitSystemEventManager()
 {
     return new Git_SystemEventManager(SystemEventManager::instance(), $this->getRepositoryFactory());
 }
Exemplo n.º 17
0
    $sefdao->delete($request->get('delete'));
    $GLOBALS['Response']->redirect('/admin/system_events/');
}
if ($request->get('cancel')) {
    $GLOBALS['Response']->redirect('/admin/system_events/');
}
if ($request->get('save') && ($followers = $request->get('followers'))) {
    list($id, $info) = each($followers);
    $sefdao->save($id, $info['emails'], implode(',', $info['types']));
    $GLOBALS['Response']->redirect('/admin/system_events/');
}
$hp = Codendi_HTMLPurifier::instance();
$title = $Language->getText('admin_system_events', 'title');
$HTML->header(array('title' => $title));
echo '<h2>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</h2>';
$se = SystemEventManager::instance();
$offset = $request->get('offset') && !$request->exist('filter') ? (int) $request->get('offset') : 0;
$limit = 50;
$full = true;
$filter_status = $request->get('filter_status');
if (!$filter_status) {
    $filter_status = array(SystemEvent::STATUS_NEW, SystemEvent::STATUS_RUNNING, SystemEvent::STATUS_DONE, SystemEvent::STATUS_WARNING, SystemEvent::STATUS_ERROR);
}
$filter_type = $request->get('filter_type');
if (!$filter_type) {
    $filter_type = $se->getTypes();
}
echo '<form action="" method="POST">';
echo '<fieldset>';
echo '<legend id="system_events_filter" class="' . Toggler::getClassname('system_events_filter') . '">Filter:</legend>';
echo '<strong>' . 'Status:' . '</strong> <input type="hidden" name="filter_status[]" value="' . $hp->purify(SystemEvent::STATUS_NONE, CODENDI_PURIFIER_CONVERT_HTML) . '" />';
Exemplo n.º 18
0
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'pre.php';
$git_dao = new GitDao();
$user_manager = UserManager::instance();
$git_repository_factory = new GitRepositoryFactory($git_dao, ProjectManager::instance());
$system_event_manager = new Git_SystemEventManager(SystemEventManager::instance(), $git_repository_factory);
$git_plugin = PluginManager::instance()->getPluginByName('git');
$logger = $git_plugin->getLogger();
if ($argv[1] == "--init") {
    $repository_path = $argv[2];
    $user_name = $argv[3];
    $repository = $git_repository_factory->getFromFullPath($repository_path);
    if ($repository) {
        $system_event_manager->queueGrokMirrorManifestFollowingAGitPush($repository);
    }
} else {
    $repository_path = $argv[1];
    $user_name = $argv[2];
    $old_rev = $argv[3];
    $new_rev = $argv[4];
    $refname = $argv[5];
Exemplo n.º 19
0
 /**
  * @see root_daily_start
  */
 public function root_daily_start($params)
 {
     SystemEventManager::instance()->createEvent(SystemEvent_STATISTICS_DAILY::NAME, null, SystemEvent::PRIORITY_LOW, SystemEvent::OWNER_ROOT);
 }
Exemplo n.º 20
0
 private function getSystemEventManager()
 {
     return SystemEventManager::instance();
 }
Exemplo n.º 21
0
 protected function _informAboutPendingEvents($repoId)
 {
     $sem = SystemEventManager::instance();
     $dar = $sem->_getDao()->searchWithParam('head', $this->groupId, array('GIT_REPO_CREATE', 'GIT_REPO_DELETE'), array(SystemEvent::STATUS_NEW, SystemEvent::STATUS_RUNNING));
     foreach ($dar as $row) {
         $p = explode(SystemEvent::PARAMETER_SEPARATOR, $row['parameters']);
         $repository = $this->factory->getDeletedRepository($p[1]);
         switch ($row['type']) {
             case 'GIT_REPO_CREATE':
                 $GLOBALS['Response']->addFeedback('info', $this->getText('feedback_event_create', array($p[1])));
                 break;
             case 'GIT_REPO_DELETE':
                 $GLOBALS['Response']->addFeedback('info', $this->getText('feedback_event_delete', array($repository->getFullName())));
                 break;
         }
     }
     if ($repoId !== 0) {
         $dar = $sem->_getDao()->searchWithParam('head', $repoId, array('GIT_REPO_ACCESS'), array(SystemEvent::STATUS_NEW, SystemEvent::STATUS_RUNNING));
         foreach ($dar as $row) {
             $GLOBALS['Response']->addFeedback('info', $this->getText('feedback_event_access'));
         }
     }
 }
Exemplo n.º 22
0
}
$cookie_manager = new CookieManager();
if (!IS_SCRIPT) {
    // Prevent "Pragma: no-cache" to be sent to user (break https & IE)
    session_cache_limiter(false);
    session_start();
    $GLOBALS['session_hash'] = $cookie_manager->isCookie('session_hash') ? $cookie_manager->getCookie('session_hash') : false;
}
//}}}
// Create cache directory if needed
if (!file_exists($GLOBALS['codendi_cache_dir'])) {
    // This directory must be world reachable, but writable only by the web-server
    mkdir($GLOBALS['codendi_cache_dir'], 0755);
}
// Instantiate System Event listener
$system_event_manager = SystemEventManager::instance();
//Load plugins
$plugin_manager =& PluginManager::instance();
$plugin_manager->loadPlugins();
$feedback = '';
// Initialize global var
//library to determine browser settings
if (!IS_SCRIPT) {
    require_once 'browser.php';
}
//Language
if (!$GLOBALS['sys_lang']) {
    $GLOBALS['sys_lang'] = "en_US";
}
$Language = new BaseLanguage($GLOBALS['sys_supported_languages'], $GLOBALS['sys_lang']);
//various html utilities
Exemplo n.º 23
0
 private function createSystemEvent($type, $priority, Docman_Item $item, $additional_params = '')
 {
     if ($this->isAllowed($item->getGroupId())) {
         $params = $item->getGroupId() . SystemEvent::PARAMETER_SEPARATOR . $item->getId();
         if ($additional_params) {
             $params .= SystemEvent::PARAMETER_SEPARATOR . $additional_params;
         }
         SystemEventManager::instance()->createEvent($type, $params, $priority);
     }
 }