本文整理汇总了PHP中common_ext_ExtensionsManager::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP common_ext_ExtensionsManager::singleton方法的具体用法?PHP common_ext_ExtensionsManager::singleton怎么用?PHP common_ext_ExtensionsManager::singleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_ext_ExtensionsManager
的用法示例。
在下文中一共展示了common_ext_ExtensionsManager::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
*
* @param string $currentVersion
* @return string $versionUpdatedTo
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
//migrate from 2.6 to 2.6.1
if ($currentVersion == '2.6') {
//data upgrade
OntologyUpdater::syncModels();
$currentVersion = '2.6.1';
}
if ($currentVersion == '2.6.1') {
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
$className = $ext->getConfig(\taoDelivery_models_classes_execution_ServiceProxy::CONFIG_KEY);
if (is_string($className)) {
$impl = null;
switch ($className) {
case 'taoDelivery_models_classes_execution_OntologyService':
$impl = new \taoDelivery_models_classes_execution_OntologyService();
break;
case 'taoDelivery_models_classes_execution_KeyValueService':
$impl = new \taoDelivery_models_classes_execution_KeyValueService(array(\taoDelivery_models_classes_execution_KeyValueService::OPTION_PERSISTENCE => 'deliveryExecution'));
break;
default:
\common_Logger::w('Unable to migrate custom execution service');
}
if (!is_null($impl)) {
$proxy = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$proxy->setImplementation($impl);
$currentVersion = '2.6.2';
}
}
}
return $currentVersion;
}
示例2: __invoke
/**
* @param $params
* @return Report
*/
public function __invoke($params)
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoProctoring');
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
$report = new Report(Report::TYPE_INFO, 'Updating of delivery monitoring cache...');
$testCenters = TestCenterService::singleton()->getRootClass()->getInstances(true);
$deliveryMonitoringService = $this->getServiceLocator()->get(DeliveryMonitoringService::CONFIG_ID);
$deliveryService = $this->getServiceLocator()->get(DeliveryService::CONFIG_ID);
$eligibilityService = EligibilityService::singleton();
foreach ($testCenters as $testCenter) {
$deliveries = $eligibilityService->getEligibleDeliveries($testCenter, false);
foreach ($deliveries as $delivery) {
if ($delivery->exists()) {
$deliveryExecutions = $deliveryService->getCurrentDeliveryExecutions($delivery->getUri(), $testCenter->getUri());
foreach ($deliveryExecutions as $deliveryExecution) {
$data = $deliveryMonitoringService->getData($deliveryExecution, true);
if ($deliveryMonitoringService->save($data)) {
$report->add(new Report(Report::TYPE_SUCCESS, "Delivery execution {$deliveryExecution->getUri()} successfully updated."));
} else {
$errors = $data->getErrors();
$errorsStr = " " . PHP_EOL;
array_walk($errors, function ($val, $key) use(&$errorsStr) {
$errorsStr .= " {$key} - {$val}" . PHP_EOL;
});
$report->add(new Report(Report::TYPE_ERROR, "Delivery execution {$deliveryExecution->getUri()} was not updated. {$errorsStr}"));
}
}
}
}
}
return $report;
}
示例3: __construct
public function __construct($extName)
{
$configFile = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'generis.conf.php';
parent::__construct($configFile);
// load extension constants
common_ext_ExtensionsManager::singleton()->getExtensionById($extName);
}
示例4: run
public function run()
{
// load the constants
common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
$this->migrateCompiledDeliveryToAssembly();
$this->removeAssemblyFromGroup();
}
示例5: __construct
/**
* get the lang of the class in case we want to filter the media on language
*
* @param array $options
*/
public function __construct($options = array())
{
parent::__construct($options);
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoMediaManager');
$this->lang = isset($options['lang']) ? $options['lang'] : '';
$this->rootClassUri = isset($options['rootClass']) ? $options['rootClass'] : MediaService::singleton()->getRootClass();
}
示例6: run
public function run()
{
$extmanger = common_ext_ExtensionsManager::singleton();
$ext = $extmanger->getExtensionById('taoCe');
$extinstaller = new tao_install_ExtensionInstaller($ext);
$extinstaller->install();
}
示例7: __invoke
public function __invoke($params)
{
// recreate languages
$modelCreator = new \tao_install_utils_ModelCreator(LOCAL_NAMESPACE);
$models = $modelCreator->getLanguageModels();
foreach ($models as $ns => $modelFiles) {
foreach ($modelFiles as $file) {
$modelCreator->insertLocalModel($file);
}
}
OntologyUpdater::syncModels();
// reapply access rights
$exts = \common_ext_ExtensionsManager::singleton()->getInstalledExtensions();
foreach ($exts as $ext) {
$installer = new \tao_install_ExtensionInstaller($ext);
$installer->installManagementRole();
$installer->applyAccessRules();
}
// recreate admin
if (count($params) >= 2) {
$login = array_shift($params);
$password = array_shift($params);
$sysAdmin = $this->getResource(INSTANCE_ROLE_SYSADMIN);
$userClass = $this->getClass(CLASS_TAO_USER);
\core_kernel_users_Service::singleton()->addUser($login, $password, $sysAdmin, $userClass);
}
// empty cache
\common_cache_FileCache::singleton()->purge();
return \common_report_Report::createSuccess('All done');
}
示例8: setUp
/**
* tests initialization
*/
public function setUp()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoTestTaker');
TaoPhpUnitTestRunner::initTest();
$this->subjectsService = TestTakerService::singleton();
$this->testCenterService = TestCenterService::singleton();
}
示例9: login
/**
* Login process
* Check if url successCallback is set
* If login form is post valid, setcookie & redirect to successCallback
* Else create LoginForm with ?errorMessage
*/
public function login()
{
try {
if (!$this->hasRequestParameter('successCallback')) {
throw new \common_exception_MissingParameter('Internal error, please retry in few moment');
}
if ($this->isRequestPost()) {
$authorizationService = $this->getServiceManager()->get(Authorization::SERVICE_ID);
if (!$authorizationService instanceof RequireUsername) {
throw new InvalidCallException('Authenticator need to be call by requireusername');
}
if ($authorizationService->validateLogin($this->getRequestParameter('login'))) {
$baseUrl = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoClientDiagnostic')->getConstant('BASE_URL');
$elements = parse_url($baseUrl);
$this->setCookie('login', $this->getRequestParameter('login'), null, $elements['path']);
$this->redirect($this->getRequestParameter('successCallback'));
}
}
} catch (InvalidLoginException $e) {
$this->setData('errorMessage', $e->getUserMessage());
}
$this->setData('successCallback', $this->getRequestParameter('successCallback'));
$this->setData('client-config-url', $this->getClientConfigUrl());
$this->setData('content-controller', 'taoClientDiagnostic/controller/Authenticator/login');
$this->setData('content-template', 'Authenticator' . DIRECTORY_SEPARATOR . 'login.tpl');
$this->setView('index.tpl');
}
示例10: setUp
public function setUp()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
TaoPhpUnitTestRunner::initTest();
$this->service = ServiceManager::getServiceManager()->get(DeliveryMonitoringService::CONFIG_ID);
$this->persistence = \common_persistence_Manager::getPersistence('default');
}
示例11: update
/**
* @param string $initialVersion
* @return string string
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('ltiTestConsumer');
$this->setVersion($currentVersion);
$this->skip('0.8', '0.9.0');
}
示例12: run
public function run()
{
$this->out('Bypassing model restriction');
$oldUpdatableModels = core_kernel_persistence_smoothsql_SmoothModel::getUpdatableModelIds();
core_kernel_persistence_smoothsql_SmoothModel::forceUpdatableModelIds(core_kernel_persistence_smoothsql_SmoothModel::getReadableModelIds());
$this->out('Loading extensions');
$diffPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ontologyData26' . DIRECTORY_SEPARATOR;
// remove All
foreach (common_ext_ExtensionsManager::singleton()->getInstalledExtensions() as $extension) {
$diffFile = $diffPath . 'diff' . ucfirst($extension->getId()) . '.php';
if (file_exists($diffFile)) {
$this->out('Updating model of ' . $extension->getId());
$data = (include $diffFile);
foreach ($data['toRemove'] as $tripple) {
$this->remove($tripple);
}
}
}
// add All
foreach (common_ext_ExtensionsManager::singleton()->getInstalledExtensions() as $extension) {
$diffFile = $diffPath . 'diff' . ucfirst($extension->getId()) . '.php';
if (file_exists($diffFile)) {
$this->out('Updating model of ' . $extension->getId());
$data = (include $diffFile);
foreach ($data['toAdd'] as $tripple) {
$this->add($tripple);
}
}
}
$this->out('Restoring model restriction');
core_kernel_persistence_smoothsql_SmoothModel::forceUpdatableModelIds($oldUpdatableModels);
}
示例13: testImport
public function testImport()
{
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems');
$url = $this->host . 'taoQtiItem/RestQtiItem/import';
$post_data = ['content' => new \CURLFile(__DIR__ . '/../samples/package/QTI/package.zip', 'application/zip')];
$return = $this->curl($url, CURLOPT_POST, 'data', array(CURLOPT_POSTFIELDS => $post_data));
$data = json_decode($return, true);
$this->assertInternalType('array', $data);
$this->assertTrue(isset($data['success']));
$this->assertTrue($data['success']);
$this->assertTrue(isset($data['data']['items']));
$items = $data['data']['items'];
$this->assertInternalType('array', $items);
$this->assertEquals(1, count($items));
$itemUri = reset($items);
$this->assertInternalType('string', $itemUri);
$item = $this->getResource($itemUri);
$this->assertTrue($item->exists());
$itemService = \taoItems_models_classes_ItemsService::singleton();
$model = $itemService->getItemModel($item);
$this->assertNotNull($model);
$this->assertEquals(ItemModel::MODEL_URI, $itemService->getItemModel($item)->getUri());
$this->assertTrue($itemService->deleteResource($item));
$this->assertFalse($item->exists());
}
示例14: __construct
/**
* call the (empty) parent constructor
* initialise the campaign class
*
* @access protected
* @author Joel Bout, <joel@taotesting.com>
* @return mixed
*/
protected function __construct()
{
parent::__construct();
// ensure the taoCampaign extension is loaded, since it can be called from taoDelivery
common_ext_ExtensionsManager::singleton()->getExtensionById('taoCampaign')->load();
$this->campaignClass = new core_kernel_classes_Class(TAO_DELIVERY_CAMPAIGN_CLASS);
}
示例15: getUriProvider
/**
* Get the UriProvider in force.
*
* @return common_uri_UriProvider
*/
public function getUriProvider()
{
if (is_null($this->uriProvider)) {
$this->uriProvider = common_ext_ExtensionsManager::singleton()->getExtensionById('generis')->getConfig(self::CONFIG_KEY);
}
return $this->uriProvider;
}