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


PHP common_ext_ExtensionsManager类代码示例

本文整理汇总了PHP中common_ext_ExtensionsManager的典型用法代码示例。如果您正苦于以下问题:PHP common_ext_ExtensionsManager类的具体用法?PHP common_ext_ExtensionsManager怎么用?PHP common_ext_ExtensionsManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了common_ext_ExtensionsManager类的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;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:38,代码来源:Updater.php

示例2: __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();
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:12,代码来源:MediaSource.php

示例3: __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;
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:37,代码来源:RefreshMonitoringData.php

示例4: __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);
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.Bootstrap.php

示例5: run

 public function run()
 {
     // load the constants
     common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
     $this->migrateCompiledDeliveryToAssembly();
     $this->removeAssemblyFromGroup();
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:7,代码来源:class.UpdateDeliveryAssembly.php

示例6: scriptRunner

 public function scriptRunner($script, $extension)
 {
     $error = false;
     $errorStack = array();
     if (isset($extension) && $extension != null) {
         $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($extension);
     }
     if ($script != null) {
         $parameters = array();
         $options = array('argv' => array(0 => 'Script ' . $script), 'output_mode' => 'log_only');
         try {
             $scriptName = $script;
             if (!class_exists($scriptName)) {
                 throw new taoUpdate_models_classes_UpdateException('Could not find scriptName class ' . $script);
             }
             new $scriptName(array('parameters' => $parameters), $options);
             $error = false;
         } catch (Exception $e) {
             common_Logger::e('Error occurs during update ' . $e->getMessage());
             $error = true;
             $errorStack[] = 'Error in script ' . $script . ' ' . $e->getMessage();
         }
         if ($error) {
             echo json_encode(array('success' => 0, 'failed' => $errorStack));
         } else {
             echo json_encode(array('success' => 1, 'failed' => array()));
         }
     } else {
         echo json_encode(array('success' => 0, 'failed' => array('not scriptname provided')));
     }
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:31,代码来源:class.Data.php

示例7: run

 public function run()
 {
     $extmanger = common_ext_ExtensionsManager::singleton();
     $ext = $extmanger->getExtensionById('taoCe');
     $extinstaller = new tao_install_ExtensionInstaller($ext);
     $extinstaller->install();
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:7,代码来源:class.InstallNewExtension.php

示例8: __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');
 }
开发者ID:oat-sa,项目名称:extension-tao-devtools,代码行数:30,代码来源:RestoreModelOne.php

示例9: __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);
 }
开发者ID:nagyist,项目名称:extension-tao-campaign,代码行数:15,代码来源:class.CampaignService.php

示例10: getFinishedSniplet

 public static function getFinishedSniplet()
 {
     $taoExt = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
     $tpl = $taoExt->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'snippet' . DIRECTORY_SEPARATOR . 'finishService.tpl';
     $renderer = new Renderer($tpl);
     return $renderer->render();
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.ServiceJavascripts.php

示例11: 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());
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:25,代码来源:RestQtiItemTest.php

示例12: __invoke

 /**
  * @param array $params
  * @return Report
  */
 public function __invoke($params)
 {
     $this->params = $params;
     $this->report = new Report(Report::TYPE_INFO, 'Termination expired paused executions...');
     common_Logger::d('Termination expired paused execution started at ' . date(DATE_RFC3339));
     \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDeliveryRdf');
     \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
     $deliveryExecutionService = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
     $count = 0;
     $testSessionService = ServiceManager::getServiceManager()->get(TestSessionService::SERVICE_ID);
     /** @var DeliveryMonitoringService $deliveryMonitoringService */
     $deliveryMonitoringService = ServiceManager::getServiceManager()->get(DeliveryMonitoringService::CONFIG_ID);
     $deliveryExecutionsData = $deliveryMonitoringService->find([DeliveryMonitoringService::STATUS => [DeliveryExecution::STATE_ACTIVE, DeliveryExecution::STATE_PAUSED]]);
     foreach ($deliveryExecutionsData as $deliveryExecutionData) {
         $data = $deliveryExecutionData->get();
         $deliveryExecution = $deliveryExecutionService->getDeliveryExecution($data[DeliveryMonitoringService::DELIVERY_EXECUTION_ID]);
         if ($testSessionService->isExpired($deliveryExecution)) {
             try {
                 $this->terminateExecution($deliveryExecution);
                 $count++;
             } catch (\Exception $e) {
                 $this->addReport(Report::TYPE_ERROR, $e->getMessage());
             }
         }
     }
     $msg = $count > 0 ? "{$count} executions has been terminated." : "Expired executions not found.";
     $this->addReport(Report::TYPE_INFO, $msg);
     common_Logger::d('Termination expired paused execution finished at ' . date(DATE_RFC3339));
     return $this->report;
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:34,代码来源:TerminatePausedAssessment.php

示例13: __construct

 /**
  * Constructor performs initializations actions
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->userService = tao_models_classes_UserService::singleton();
     $this->defaultData();
     $extManager = common_ext_ExtensionsManager::singleton();
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:11,代码来源:class.Users.php

示例14: 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);
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:32,代码来源:class.UpdateOntologyModel.php

示例15: 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');
 }
开发者ID:oat-sa,项目名称:extension-tao-testlti,代码行数:11,代码来源:Updater.php


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