本文整理汇总了PHP中Services::startManagerAsService方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::startManagerAsService方法的具体用法?PHP Services::startManagerAsService怎么用?PHP Services::startManagerAsService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::startManagerAsService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @return void
* @access public
* @since 10/4/07
*/
public function __construct()
{
$this->idMgr = new SimpleTableIdManager();
try {
$this->dbc = Services::getService("DBHandler");
} catch (Exception $e) {
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$this->dbc = Services::getService("DBHandler");
}
}
示例2: execute_update
function execute_update(array $types, array $functions)
{
if (!array_key_exists($_REQUEST['function'], $functions)) {
throw new Exception("Unknown function, '" . $_REQUEST['function'] . "'.");
}
if (!array_key_exists($_REQUEST['db_type'], $types)) {
throw new Exception("Unknown database type, '" . $_REQUEST['db_type'] . "'.");
}
switch ($_REQUEST['db_type']) {
case MYSQL:
$utilClass = "MySqlUtils";
break;
case POSTGRESQL:
$utilClass = "PostgreSQLUtils";
break;
default:
throw new Exception($types[$_REQUEST['db_type']] . " databases are not currently supported for updates.");
}
if (!class_exists($utilClass)) {
throw new Exception("The selected database utility class, '" . $utilClass . "', does not exist.");
}
if (!method_exists($utilClass, $_REQUEST['function'])) {
throw new Exception("The selected function, " . $_REQUEST['function'] . "(), is not currently supported by this database.");
}
// Now execute the update.
$configuration = new ConfigurationProperties();
$context = new OSIDContext();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$dbc = Services::getService('DBHandler');
$dbIndex = $dbc->createDatabase($_REQUEST['db_type'], $_REQUEST['db_host'], $_REQUEST['db_name'], $_REQUEST['db_user'], $_REQUEST['db_pass']);
$dbc->connect($dbIndex);
try {
eval($utilClass . "::" . $_REQUEST['function'] . '($dbIndex);');
} catch (Exception $e) {
// Close our connection
$dbc->disconnect($dbIndex);
throw $e;
}
$dbc->disconnect($dbIndex);
}
示例3: ConfigurationProperties
<?php
/**
* Set up the SetsManager
*
* USAGE: Copy this file to sets.conf.php to set custom values.
*
* @package concerto.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id$
*/
// :: Set up the Sets Manager ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
Services::startManagerAsService("SetManager", $context, $configuration);
示例4: define
*
*
* @package harmoni.utilities.tests
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: testList.php,v 1.4 2007/09/04 20:25:56 adamfranco Exp $
**/
if (!defined('HARMONI')) {
require_once "../../harmoni.inc.php";
}
if (!defined('SIMPLE_TEST')) {
define('SIMPLE_TEST', HARMONI . 'simple_test/');
}
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
if (!Services::serviceAvailable("ErrorHandler")) {
Services::registerService("ErrorHandler", "ErrorHandler");
require_once OKI2 . "osid/OsidContext.php";
$context = new OsidContext();
$context->assignContext('harmoni', $harmoni);
require_once HARMONI . "oki2/shared/ConfigurationProperties.class.php";
$configuration = new ConfigurationProperties();
Services::startManagerAsService("ErrorHandler", $context, $configuration);
}
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
$test = new GroupTest('Utilities tests');
$test->addTestFile(HARMONI . 'utilities/tests/OrderedListTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
示例5: ConfigurationProperties
<?php
/**
* Set up the IdManager as this is required for the ID service
*
* USAGE: Copy this file to id.conf.php to set custom values.
*
* @package concerto.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: logging_default.conf.php,v 1.3 2008/02/26 14:08:11 adamfranco Exp $
*/
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
Services::startManagerAsService("LoggingManager", $context, $configuration);
/*********************************************************
* If you wish to add a list of user agents and their uncaught
* exceptions that should not be logged, uncomment the
* lines below and add/remove Exception classes as needed.
*********************************************************/
// $printer = SegueErrorPrinter::instance();
// $printer->addUserAgentFilter(
// "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
// array('UnknownActionException'));
示例6: runUpdate
/**
* Run the update
*
* @return boolean
* @access public
* @since 3/24/08
*/
function runUpdate($dbIndex)
{
$prepStatus = new StatusStars("Preparing Migration");
$prepStatus->initializeStatistics(3);
// Configure the original Hierarchy and AZ services
$context = new OsidContext();
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbIndex);
$configuration->addProperty('database_name', $_REQUEST['db_name']);
$configuration->addProperty('harmoni_db_name', 'migration_db');
Services::startManagerAsService("IdManager", $context, $configuration);
Services::startManagerAsService("HierarchyManager", $context, $configuration);
Services::startManagerAsService("AuthorizationManager", $context, $configuration);
// Agent Manager
$configuration = new ConfigurationProperties();
// default agent Flavor is one that can be editted
$agentFlavor = "HarmoniEditableAgent";
$agentHierarchyId = "edu.middlebury.authorization.hierarchy";
$configuration->addProperty('hierarchy_id', $agentHierarchyId);
$configuration->addProperty('defaultAgentFlavor', $agentFlavor);
$configuration->addProperty('database_index', $dbIndex);
$configuration->addProperty('database_name', $_REQUEST['db_name']);
Services::startManagerAsService("AgentManager", $context, $configuration);
// :: Set up PropertyManager ::
//the property manager operates in the same context as the AgentManager and is more or less an adjunct to it
$configuration->addProperty('database_index', $dbIndex);
$configuration->addProperty('database_name', $_REQUEST['db_name']);
Services::startManagerAsService("PropertyManager", $context, $configuration);
// :: Start the AuthenticationManager OSID Impl.
$configuration = new ConfigurationProperties();
$tokenCollectors = array(serialize(new Type("Authentication", "edu.middlebury.harmoni", "Harmoni DB")) => new FormActionNamePassTokenCollector('does not exist'));
$configuration->addProperty('token_collectors', $tokenCollectors);
Services::startManagerAsService("AuthenticationManager", $context, $configuration);
// :: Start and configure the AuthenticationMethodManager
$configuration = new ConfigurationProperties();
// set up a Database Authentication Method
require_once HARMONI . "/oki2/agentmanagement/AuthNMethods/SQLDatabaseAuthNMethod.class.php";
require_once HARMONI . "/oki2/agentmanagement/AuthNMethods/SQLDatabaseMD5UsernamePasswordAuthNTokens.class.php";
$dbAuthType = new Type("Authentication", "edu.middlebury.harmoni", "Harmoni DB");
$dbMethodConfiguration = new ConfigurationProperties();
$dbMethodConfiguration->addProperty('tokens_class', 'SQLDatabaseMD5UsernamePasswordAuthNTokens');
$dbMethodConfiguration->addProperty('database_id', $dbIndex);
$dbMethodConfiguration->addProperty('authentication_table', 'auth_db_user');
$dbMethodConfiguration->addProperty('username_field', 'username');
$dbMethodConfiguration->addProperty('password_field', 'password');
$propertiesFields = array('username' => 'username');
$dbMethodConfiguration->addProperty('properties_fields', $propertiesFields);
$dbAuthNMethod = new SQLDatabaseAuthNMethod();
$dbAuthNMethod->assignConfiguration($dbMethodConfiguration);
$configuration->addProperty($dbAuthType, $dbAuthNMethod);
Services::startManagerAsService("AuthNMethodManager", $context, $configuration);
// :: Agent-Token Mapping Manager ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_id', $dbIndex);
$configuration->addProperty('harmoni_db_name', 'migration_db');
Services::startManagerAsService("AgentTokenMappingManager", $context, $configuration);
$prepStatus->updateStatistics();
$dbc = Services::getService("DatabaseManager");
try {
/*********************************************************
* Check for the old tables. They must exist for us to run
*********************************************************/
$azTables = array('az_authorization', 'az_function', 'hierarchy', 'j_node_node', 'node', 'node_ancestry');
// Check for old tables
$tables = $dbc->getTableList($dbIndex);
foreach ($azTables as $table) {
if (!in_array($table, $tables)) {
throw new Exception("Old AZ table, {$table}, is missing. Can not run Update.");
}
}
/*********************************************************
* Create the new tables
*********************************************************/
$type = $dbc->getDatabaseType($dbIndex);
switch ($type) {
case MYSQL:
SQLUtils::runSQLfile(HARMONI_BASE . "/SQL/MySQL/AuthZ2.sql", $dbIndex);
break;
case POSTGRESQL:
SQLUtils::runSQLfile(HARMONI_BASE . "/SQL/PostgreSQL/AuthZ2.sql", $dbIndex);
break;
case ORACLE:
SQLUtils::runSQLfile(HARMONI_BASE . "/SQL/PostgreSQL/AuthZ2.sql", $dbIndex);
break;
default:
throw new Exception("Database schemas are not defined for specified database type.");
}
/*********************************************************
* Hierarchy
*********************************************************/
$hierarchyMgr1 = Services::getService("Hierarchy");
if (get_class($hierarchyMgr1) == "AuthZ2_HierarchyManager") {
throw new OperationFailedException("Original HierarchyManager not configured.");
//.........这里部分代码省略.........
示例7: ConfigurationProperties
<?php
/**
* Set up the ImageProcessor service for generating thumbnails
*
* USAGE: Copy this file to imageprocessor.conf.php to set custom values.
*
* @package segue.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: imageprocessor_default.conf.php,v 1.4 2007/09/25 19:46:17 adamfranco Exp $
*/
// :: Set up the ImageProcessor service for generating thumbnails ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('thumbnail_format', "image/jpeg");
$configuration->addProperty('use_gd', FALSE);
$configuration->addProperty('gd_formats', array());
$configuration->addProperty('use_imagemagick', TRUE);
$configuration->addProperty('imagemagick_path', "/usr/local/bin");
$configuration->addProperty('imagemagick_temp_dir', "/tmp");
$configuration->addProperty('imagemagick_formats', array());
Services::startManagerAsService("ImageProcessingManager", $context, $configuration);
示例8: ConfigurationProperties
* Set up the SchedulingManager
*
* USAGE: Copy this file to coursemanagament.conf.php to set custom values.
*
* @package segue.config
*
* @copyright Copyright © 2006, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: scheduling_default.conf.php,v 1.2 2007/09/04 18:00:43 adamfranco Exp $
*/
// :: Set up the SchedulingManager ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
$defaultAuthority = "edu.middlebury.authorization.hierarchy";
$configuration->addProperty('default_authority', $defaultAuthority);
/*
$courseManagamentHierarchyId = "edu.middlebury.authorization.hierarchy";
$courseManagamentRootId = "edu.middlebury.authorization.root";
$courseManagementId ="edu.middlebury.coursemanagement";
$canonicalCoursesId="edu.middlebury.coursemanagement.canonicalcourses";
$courseGroupsId ="edu.middlebury.coursemanagement.coursegroups";
$configuration->addProperty('hierarchy_id', $courseManagamentHierarchyId);
$configuration->addProperty('root_id', $courseManagamentHierarchyId);
$configuration->addProperty('course_management_id', $courseManagementId);
$configuration->addProperty('canonical_courses_id', $canonicalCoursesId);
$configuration->addProperty('course_groups_id', $courseGroupsId);
*/
Services::startManagerAsService("SchedulingManager", $context, $configuration);
示例9: ConfigurationProperties
// $ldapConfiguration->addProperty("GroupBaseDN", $arg3 = "ou=groups,dc=middlebury,dc=edu");
// $ldapConfiguration->addProperty("bindDN", $arg4 = "juser");
// $ldapConfiguration->addProperty("bindDNPassword", $arg5 = "password");
// $propertiesFields = array (
// 'username' => 'samaccountname',
// 'name' => 'displayname',
// 'first name' => 'givenname',
// 'last name' => 'sn',
// 'department' => 'department',
// 'email' => 'mail',
// );
// $ldapConfiguration->addProperty('properties_fields', $propertiesFields);
// $loginFields = array (
// 'samaccountname',
// 'mail',
// 'cn',
// );
// $ldapConfiguration->addProperty('login_fields', $loginFields);
// $ldapConfiguration->addProperty("display_name_property", $arg6 = "name");
//
// $ldapAuthNMethod = new LDAPAuthNMethod;
// $ldapAuthNMethod->assignConfiguration($ldapConfiguration);
// unset($arg0, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $propertiesFields, $loginFields, $ldapConfiguration);
//
// $configuration->addProperty($ldapAuthType, $ldapAuthNMethod);
Services::startManagerAsService("AuthNMethodManager", $context, $configuration);
// :: Agent-Token Mapping Manager ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_id', $dbID);
Services::startManagerAsService("AgentTokenMappingManager", $context, $configuration);
示例10: ConfigurationProperties
<?php
/**
* Set up the AuthorizationManager
*
* USAGE: Copy this file to authorization.conf.php to set custom values.
*
* @package segue.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: authorization_default.conf.php,v 1.3 2007/09/04 18:00:42 adamfranco Exp $
*/
// :: Set up the Authorization System ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
$configuration->addProperty('database_name', $dbName);
$configuration->addProperty('harmoni_db_name', 'segue_db');
try {
require_once HARMONI . "/oki2/AuthZ2/authz/AuthorizationManager.class.php";
$azMgr = new AuthZ2_AuthorizationManager();
$azMgr->assignConfiguration($configuration);
Services::registerObjectAsService("AuthorizationManager", $azMgr);
} catch (ConfigurationErrorException $e) {
Services::startManagerAsService("AuthorizationManager", $context, $configuration);
print "<div class='config_error'>" . _("Please run the Segue Updates under Admin Tools") . "</div>";
}
示例11: ConfigurationProperties
<?php
/**
* Set up the RepositoryManager
*
* USAGE: Copy this file to repository.conf.php to set custom values.
*
* @package segue.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: repository_default.conf.php,v 1.6 2007/09/04 18:00:43 adamfranco Exp $
*/
// :: Set up the RepositoryManager ::
$repositoryHierarchyId = "edu.middlebury.authorization.hierarchy";
$defaultParentId = "edu.middlebury.repositories_root";
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
$configuration->addProperty('hierarchy_id', $repositoryHierarchyId);
$configuration->addProperty('default_parent_id', $defaultParentId);
$configuration->addProperty('version_control_all', $arg2 = TRUE);
$configuration->addProperty('use_filesystem_for_files', $arg3 = FALSE);
// $configuration->addProperty('file_data_path', $arg4 = MYPATH."/../segue_data");
Services::startManagerAsService("RepositoryManager", $context, $configuration);
unset($arg0, $arg1, $arg2, $arg3, $arg4);
示例12: array
$configuration->addProperty('whether_to_add_terms', $CREATE_TERMS);
for ($year = 2004; $year < 2010; $year++) {
$array = array();
$array['name'] = "Winter " . $year;
$array['start'] = Timestamp::fromString($year . "-01-01T00:00:00");
$array['end'] = Timestamp::fromString($year . "-02-01T00:00:00");
$array['type'] = new Type("TermType", "edu.middlebury", "Winter");
$terms[] = $array;
$array = array();
$array['name'] = "Spring " . $year;
$array['start'] = Timestamp::fromString($year . "-02-01T00:00:00");
$array['end'] = Timestamp::fromString($year . "-06-01T00:00:00");
$array['type'] = new Type("TermType", "edu.middlebury", "Spring");
$terms[] = $array;
$array = array();
$array['name'] = "Summer " . $year;
$array['start'] = Timestamp::fromString($year . "-06-01T00:00:00");
$array['end'] = Timestamp::fromString($year . "-09-01T00:00:00");
$array['type'] = new Type("TermType", "edu.middlebury", "Summer");
$terms[] = $array;
$array = array();
$array['name'] = "Fall " . $year;
$array['start'] = Timestamp::fromString($year . "-09-01T00:00:00");
$array['end'] = Timestamp::fromString($year + 1 . "-01-01T00:00:00");
$array['type'] = new Type("TermType", "edu.middlebury", "Fall");
$terms[] = $array;
}
$configuration->addProperty('terms_to_add', $terms);
$configuration->addProperty('authority', $authority = "edu.middlebury");
Services::startManagerAsService("CourseManagementManager", $context, $configuration);
示例13: dirname
require_once dirname(__FILE__) . "/main/library/ResultPrinter/EmbeddedArrayResultPrinter.class.php";
require_once dirname(__FILE__) . "/main/library/Basket/Basket.class.php";
require_once dirname(__FILE__) . "/main/library/AuthZPrinter.abstract.php";
require_once dirname(__FILE__) . "/main/modules/help/Help.class.php";
require_once dirname(__FILE__) . "/main/modules/auth/PolyphonyLogin.class.php";
require_once dirname(__FILE__) . "/main/library/RepositoryInputOutputModules/RepositoryInputOutputModuleManager.class.php";
Services::registerService("InOutModules", "RepositoryInputOutputModuleManager");
require_once dirname(__FILE__) . "/main/library/RepositorySearchModules/RepositorySearchModuleManager.class.php";
Services::registerService("RepositorySearchModules", "RepositorySearchModuleManager");
require_once OKI2 . "osid/OsidContext.php";
$context = new OsidContext();
$context->assignContext('harmoni', $harmoni);
require_once HARMONI . "oki2/shared/ConfigurationProperties.class.php";
$configuration = new ConfigurationProperties();
Services::startManagerAsService("InOutModules", $context, $configuration);
Services::startManagerAsService("RepositorySearchModules", $context, $configuration);
require_once dirname(__FILE__) . "/main/library/HierarchyPrinter/GroupPrinter.class.php";
require_once dirname(__FILE__) . "/main/library/HierarchyPrinter/HierarchyPrinter.class.php";
// NEW CONFIGS AFTER HERE!!!:
if (file_exists(dirname(__FILE__) . "/config/domit.conf.php")) {
require_once dirname(__FILE__) . "/config/domit.conf.php";
} else {
require_once dirname(__FILE__) . "/config/domit_default.conf.php";
}
if (file_exists(dirname(__FILE__) . "/config/exif.conf.php")) {
require_once dirname(__FILE__) . "/config/exif.conf.php";
} else {
require_once dirname(__FILE__) . "/config/exif_default.conf.php";
}
require_once dirname(__FILE__) . "/main/modules/help/browse_help.act.php";
/*********************************************************
示例14: ConfigurationProperties
<?php
/**
* Set up the HierarchyManager
*
* USAGE: Copy this file to hierarchy.conf.php to set custom values.
*
* @package concerto.config
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id$
*/
// :: Set up the Hierarchy Manager ::
$configuration = new ConfigurationProperties();
$configuration->addProperty('database_index', $dbID);
$configuration->addProperty('database_name', $dbName);
Services::startManagerAsService("HierarchyManager", $context, $configuration);
示例15: Timer
$harmonyLoadupTimer = new Timer();
$harmonyLoadupTimer->start();
require_once dirname(__FILE__) . "/../../../../harmoni.inc.php";
//require_once(dirname(__FILE__)."/../../../../../concerto/main/include/setup.inc.php");
$harmonyLoadupTimer->end();
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'oki_simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
/* if (!defined('CONCERTODBID')) { */
/* require_once(CONCERTO.'/tests/dbconnect.inc.php'); */
/* } */
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler");
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$test = new GroupTest('CourseManagementTest');
$test->addTestFile(dirname(__FILE__) . '/CanonicalCourseTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGroupTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseOfferingTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TermTest.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseSectionTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/EnrollmentRecordTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGradeRecordTest.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
$timer->end();
print "\n<br />Harmoni Load Time: " . $harmonyLoadupTimer->printTime();
print "\n<br />Overall Time: " . $timer->printTime();
$dbhandler = Services::getService("DBHandler");
printpre("NumQueries: " . $dbhandler->getTotalNumberOfQueries());