protected function verifyAuthorization()
 {
     $user = common_session_SessionManager::getSession()->getUser();
     if (!AclProxy::hasAccess($user, $this->getControllerClass(), $this->getAction(), $this->getParameters())) {
         $func = new FuncProxy();
         $data = new DataAccessControl();
         //now go into details to see which kind of permissions are not correct
         if ($func->hasAccess($user, $this->getControllerClass(), $this->getAction(), $this->getParameters()) && !$data->hasAccess($user, $this->getControllerClass(), $this->getAction(), $this->getParameters())) {
             throw new PermissionException($user->getIdentifier(), $this->getAction(), $this->getControllerClass(), $this->getExtensionId());
         }
         throw new tao_models_classes_AccessDeniedException($user->getIdentifier(), $this->getAction(), $this->getControllerClass(), $this->getExtensionId());
     }
 }
 /**
  *
  * @param string $initialVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     //migrate from 1.0 to 1.0.1
     if ($currentVersion == '1.0') {
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemAuthor', array('controller' => 'oat\\taoRevision\\controller\\History')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#TestAuthor', array('controller' => 'oat\\taoRevision\\controller\\History')));
         $currentVersion = '1.0.1';
     }
     $this->setVersion($currentVersion);
     $this->skip('1.0.1', '1.0.4');
     if ($this->isVersion('1.0.4')) {
         $impl = $this->getServiceManager()->get(Repository::SERVICE_ID);
         if ($impl instanceof \oat\taoRevision\model\rds\Repository) {
             $storage = new Storage($impl->getOptions());
             $this->getServiceManager()->register('taoRevision/storage', $storage);
             $service = new RepositoryService(array(RepositoryService::OPTION_STORAGE => 'taoRevision/storage'));
             $this->getServiceManager()->register(Repository::SERVICE_ID, $service);
         }
         $this->setVersion('2.0.0');
     }
     $this->skip('2.0.0', '2.1.2');
     if ($this->isVersion('2.1.2')) {
         $fsm = $this->getServiceManager()->get(FileSystemService::SERVICE_ID);
         $fsm->createFileSystem('revisions', 'tao/revisions');
         $this->getServiceManager()->register(FileSystemService::SERVICE_ID, $fsm);
         $repositoryService = $this->getServiceManager()->get(Repository::SERVICE_ID);
         $repositoryService->setOption(RepositoryService::OPTION_FS, 'revisions');
         $this->getServiceManager()->register(Repository::SERVICE_ID, $repositoryService);
         $this->setVersion('2.2.0');
     }
 }
 /**
  * Uninstall all access rules
  *
  * @access public
  * @author Jerome Bogaerts <*****@*****.**>
  * @return void
  * @since 2.4
  */
 public function extendedUninstall()
 {
     foreach ($this->extension->getManifest()->getAclTable() as $tableEntry) {
         $rule = new AccessRule($tableEntry[0], $tableEntry[1], $tableEntry[2]);
         AclProxy::revokeRule($rule);
     }
 }
 /**
  * 
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     //migrate from 1.0 to 1.0.1
     if ($currentVersion == '1.0') {
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemAuthor', array('controller' => 'oat\\taoRevision\\controller\\History')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#TestAuthor', array('controller' => 'oat\\taoRevision\\controller\\History')));
         $currentVersion = '1.0.1';
     }
     if ($this->isVersion('1.0.1') || $this->isVersion('1.0.2') || $this->isVersion('1.0.3')) {
         $this->setVersion('1.0.4');
     }
     return null;
 }
 /**
  *
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     //migrate ACL
     if ($currentVersion == '0.1') {
         $MngrRole = new \core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAODelivery.rdf#DeliveryManagerRole');
         $accessService = \funcAcl_models_classes_AccessService::singleton();
         $accessService->grantModuleAccess($MngrRole, 'taoDeliveryRdf', 'DeliveryMgmt');
         $currentVersion = '0.2';
         $this->setVersion($currentVersion);
     }
     if ($this->isVersion('0.2')) {
         OntologyUpdater::syncModels();
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/generis.rdf#AnonymousRole', array('controller' => 'oat\\taoDeliveryRdf\\controller\\Guest')));
         $currentService = $this->safeLoadService(AssignmentService::CONFIG_ID);
         if (class_exists('taoDelivery_models_classes_AssignmentService', false) && $currentService instanceof \taoDelivery_models_classes_AssignmentService) {
             $assignmentService = new GroupAssignment();
             $this->getServiceManager()->register(AssignmentService::CONFIG_ID, $assignmentService);
         }
         $this->setVersion('1.0.0');
     }
     if ($this->isVersion('1.0.0')) {
         $this->setVersion('1.0.1');
     }
     if ($this->isVersion('1.0.1')) {
         OntologyUpdater::syncModels();
         $this->setVersion('1.1.0');
     }
     $this->skip('1.1.0', '1.4.0');
     if ($this->isVersion('1.4.0')) {
         AclProxy::applyRule(new AccessRule(AccessRule::GRANT, 'http://www.tao.lu/Ontologies/generis.rdf#taoDeliveryRdfManager', array('ext' => 'taoDeliveryRdf')));
         $this->setVersion('1.5.0');
     }
     $this->skip('1.5.0', '1.6.3');
     if ($this->isVersion('1.6.3')) {
         OntologyUpdater::syncModels();
         $registerService = new RegisterDeliveryContainerService();
         $registerService([]);
         $this->setVersion('1.7.0');
     }
     $this->skip('1.7.0', '1.8.1');
     if ($this->isVersion('1.8.1')) {
         OntologyUpdater::syncModels();
         $registerEvents = new RegisterEvents();
         $registerEvents->setServiceLocator($this->getServiceManager());
         $registerEvents([]);
         $this->setVersion('1.9.0');
     }
 }
 /**
  * Main method: run the import
  */
 public function import()
 {
     $this->log();
     foreach ($this->getSasFiles() as $extension => $sasFile) {
         $this->parseSasFile($extension, $sasFile);
     }
     //insert process vars
     $processVarNum = count($this->processVars);
     $processVarInserted = 0;
     foreach ($this->processVars as $processVar) {
         if ($this->addProcessVariable($processVar)) {
             $processVarInserted++;
             if (!$this->outputModeWeb) {
                 echo "\r{$processVarInserted} / {$processVarNum}  process variable inserted";
             }
         }
     }
     if ($this->outputModeWeb) {
         $this->log("{$processVarInserted} / {$processVarNum}  process variable inserted");
     } else {
         echo "\n";
     }
     //insert formal params
     $formaParamNum = count($this->formalParams);
     $formaParamInserted = 0;
     foreach ($this->formalParams as $formalParam) {
         if ($this->addFormalParameter($formalParam)) {
             $formaParamInserted++;
             if (!$this->outputModeWeb) {
                 echo "\r{$formaParamInserted} / {$formaParamNum}  formal parameters inserted";
             }
         }
     }
     if ($this->outputModeWeb) {
         $this->log("{$formaParamInserted} / {$formaParamNum}  formal parameters inserted");
     } else {
         echo "\n";
     }
     //insert service definitions
     $serviceNum = count($this->services);
     $serviceInserted = 0;
     foreach ($this->services as $extensionName => $services) {
         $extensionServiceClass = $this->serviceDefClass->createSubClass($extensionName, "{$extensionName} related services");
         foreach ($services as $service) {
             if ($this->addService($extensionServiceClass, $service['name'], $service['url'], $service['description'], $service['params'])) {
                 $serviceInserted++;
                 if (!$this->outputModeWeb) {
                     echo "\r{$serviceInserted} / {$serviceNum}  services definition inserted";
                 }
             }
         }
     }
     if ($this->outputModeWeb) {
         $this->log("{$serviceInserted} / {$serviceNum}  services definition inserted");
     } else {
         echo "\n";
     }
     // @todo remove temporary solution and improve the way AccessControl and workflows interact
     $missingRights = array(array('ext' => 'taoItems', 'mod' => 'SaSItems'), array('ext' => 'taoTestTaker', 'mod' => 'SasTestTaker'), array('ext' => 'taoTestTaker', 'mod' => 'SasImport'), array('ext' => 'taoTests', 'mod' => 'SaSTests'), array('ext' => 'taoGroups', 'mod' => 'SaSGroups'), array('ext' => 'taoDelivery', 'mod' => 'SaSResultServer'), array('ext' => 'taoDelivery', 'mod' => 'SaSDelivery'), array('ext' => 'tao', 'mod' => 'WebService'), array('ext' => 'taoResults', 'mod' => 'SaSResults'), array('ext' => 'tao', 'mod' => 'SaSUsers'), array('ext' => 'tao', 'mod' => 'File'));
     foreach ($missingRights as $filter) {
         $rule = new AccessRule(AccessRule::GRANT, INSTANCE_ROLE_WORKFLOW, $filter);
         AclProxy::applyRule($rule);
     }
     $this->log("import finished");
 }
Exemple #7
0
 /**
  * Get the sections of the current extension's structure
  *
  * @param string $shownExtension
  * @param string $shownStructure
  * @return array the sections
  */
 private function getSections($shownExtension, $shownStructure)
 {
     $sections = array();
     $user = common_Session_SessionManager::getSession()->getUser();
     $structure = MenuService::getPerspective($shownExtension, $shownStructure);
     if (!is_null($structure)) {
         foreach ($structure->getChildren() as $section) {
             $resolver = new ActionResolver($section->getUrl());
             if (FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {
                 foreach ($section->getActions() as $action) {
                     $resolver = new ActionResolver($action->getUrl());
                     if (!FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {
                         $section->removeAction($action);
                     }
                 }
                 $sections[] = $section;
             }
         }
     }
     return $sections;
 }
 /**
  * 
  * @param string $initialVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     // add testrunner config
     if ($currentVersion == '2.6') {
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', array('progress-indicator' => 'percentage', 'timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => 300, 'testPart' => null)));
         $currentVersion = '2.6.1';
     }
     if ($currentVersion == '2.6.1') {
         $config = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->getConfig('testRunner');
         $config['exitButton'] = false;
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest')->setConfig('testRunner', $config);
         $currentVersion = '2.6.2';
     }
     // add testrunner review screen config
     if ($currentVersion == '2.6.2') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $extension->setConfig('testRunner', array_merge($config, array('test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true)));
         $currentVersion = '2.6.3';
     }
     // adjust testrunner config
     if ($currentVersion == '2.6.3') {
         $defaultConfig = array('timerWarning' => array('assessmentItemRef' => null, 'assessmentSection' => null, 'testPart' => null), 'progress-indicator' => 'percentage', 'progress-indicator-scope' => 'testSection', 'test-taker-review' => false, 'test-taker-review-region' => 'left', 'test-taker-review-section-only' => false, 'test-taker-review-prevents-unseen' => true, 'exitButton' => false);
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         foreach ($defaultConfig as $key => $value) {
             if (!isset($config[$key])) {
                 $config[$key] = $value;
             }
         }
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.6.4';
     }
     if ($currentVersion == '2.6.4') {
         $currentVersion = '2.7.0';
     }
     // add markForReview button
     if ($currentVersion === '2.7.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('markForReview', array('label' => 'Mark for review', 'icon' => 'anchor', 'hook' => 'taoQtiTest/testRunner/actionBar/markForReview'));
         $currentVersion = '2.8.0';
     }
     // adjust testrunner config: set the review scope
     if ($currentVersion == '2.8.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-scope'] = 'test';
         unset($config['test-taker-review-section-only']);
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.9.0';
     }
     // add show/hide button
     // adjust testrunner config: set the "can collapse" option
     if ($currentVersion == '2.9.0') {
         $registry = TestRunnerClientConfigRegistry::getRegistry();
         $registry->registerQtiTools('collapseReview', array('title' => 'Show/Hide the review screen', 'label' => 'Review', 'icon' => 'mobile-menu', 'hook' => 'taoQtiTest/testRunner/actionBar/collapseReview', 'order' => -1));
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-can-collapse'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.10.0';
     }
     // adjust testrunner config: set the item sequence number options
     if ($currentVersion == '2.10.0') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['test-taker-review-force-title'] = false;
         $config['test-taker-review-item-title'] = 'Item %d';
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.11.0';
     }
     if ($currentVersion == '2.11.0') {
         // correct access roles
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#DeliveryRole', array('act' => 'taoQtiTest', 'mod' => 'TestCommand')));
         $currentVersion = '2.11.1';
     }
     // adjust testrunner config: set the force progress indicator display
     if ($currentVersion == '2.11.1') {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiTest');
         $config = $extension->getConfig('testRunner');
         $config['progress-indicator-forced'] = false;
         $extension->setConfig('testRunner', $config);
         $currentVersion = '2.12.0';
     }
     return $currentVersion;
 }
 /**
  * Get the sections of the current extension's structure
  *
  * @param string $shownExtension
  * @param string $shownStructure
  * @return array the sections
  */
 private function getSections($shownExtension, $shownStructure)
 {
     $sections = array();
     $user = common_Session_SessionManager::getSession()->getUser();
     $structure = MenuService::getPerspective($shownExtension, $shownStructure);
     if (!is_null($structure)) {
         foreach ($structure->getChildren() as $section) {
             if (tao_models_classes_accessControl_AclProxy::hasAccess($section->getAction(), $section->getController(), $section->getExtensionId())) {
                 foreach ($section->getActions() as $action) {
                     $resolver = ActionResolver::getByControllerName($action->getController(), $action->getExtensionId());
                     if (!FuncProxy::accessPossible($user, $resolver->getController(), $action->getAction())) {
                         $section->removeAction($action);
                     }
                 }
                 $sections[] = $section;
             }
         }
     }
     return $sections;
 }
/**
 * This program 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; under version 2
 * of the License (non-upgradable).
 * 
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
 * 
 */
use oat\tao\model\accessControl\func\AclProxy;
use oat\tao\model\accessControl\func\AccessRule;
$impl = new funcAcl_models_classes_FuncAcl();
$exts = common_ext_ExtensionsManager::singleton()->getInstalledExtensions();
foreach ($exts as $extension) {
    foreach ($extension->getManifest()->getAclTable() as $tableEntry) {
        $rule = new AccessRule($tableEntry[0], $tableEntry[1], $tableEntry[2]);
        $impl->applyRule($rule);
    }
}
AclProxy::setImplementation($impl);
 /**
  *
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     //migrate from 2.6 to 2.6.1
     if ($this->isVersion('2.6')) {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_1.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             ${$this}->setVerion('2.6.1');
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($this->isVersion('2.6.1')) {
         // double check
         $index = new core_kernel_classes_Resource('http://www.tao.lu/Ontologies/TAOItem.rdf#ItemContentIndex');
         $default = $index->getPropertyValues(new core_kernel_classes_Property('http://www.tao.lu/Ontologies/TAO.rdf#IndexDefaultSearch'));
         if (count($default) == 0) {
             //no default search set, import
             $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_2.rdf';
             $adapter = new tao_helpers_data_GenerisAdapterRdf();
             if ($adapter->import($file)) {
                 $this->setVerion('2.6.2');
             } else {
                 common_Logger::w('Import failed for ' . $file);
             }
         } else {
             common_Logger::w('Defautl Search already set');
             ${$this}->setVerion('2.6.2');
         }
     }
     if ($this->isVersion('2.6.2')) {
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_1.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_6_2.rdf');
         $this->setVerion('2.6.3');
     }
     if ($this->isVersion('2.6.3')) {
         // update user roles
         $class = new core_kernel_classes_Class(CLASS_TAO_USER);
         $itemManagers = $class->searchInstances(array(PROPERTY_USER_ROLES => 'http://www.tao.lu/Ontologies/TAOItem.rdf#ItemsManagerRole'), array('recursive' => true, 'like' => false));
         foreach ($itemManagers as $user) {
             $user->setPropertyValue(new core_kernel_classes_Property(PROPERTY_USER_ROLES), ItemAuthorRole::INSTANCE_URI);
         }
         $this->setVerion('2.6.4');
     }
     if ($this->isBetween('2.6.4', '2.8')) {
         $this->setVersion('2.8');
     }
     // fix itemModelLabelProp
     if ($this->isVersion('2.8')) {
         $fakeProperty = new core_kernel_classes_Property('itemModelLabel');
         $iterator = new core_kernel_classes_ResourceIterator(array(taoItems_models_classes_ItemsService::singleton()->getRootClass()));
         foreach ($iterator as $resource) {
             $resource->removePropertyValues($fakeProperty);
         }
         $this->setVersion('2.8.1');
     }
     $this->skip('2.8.1', '2.14.0');
     if ($this->isVersion('2.14.0')) {
         OntologyUpdater::syncModels();
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', 'taoItems_actions_ItemContent'));
         $this->setVersion('2.15.0');
     }
     $this->skip('2.15.0', '2.22.3');
     if ($this->isVersion('2.22.3')) {
         OntologyUpdater::syncModels();
         $categoryService = new CategoryService();
         $categoryService->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(CategoryService::SERVICE_ID, $categoryService);
         $this->setVersion('2.23.0');
     }
     if ($this->isVersion('2.23.0')) {
         OntologyUpdater::syncModels();
         $this->setVersion('2.24.0');
     }
     $this->skip('2.24.0', '2.24.1');
 }
 /**
  * 
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     $extensionManager = common_ext_ExtensionsManager::singleton();
     //migrate from 2.6 to 2.7.0
     if ($currentVersion == '2.6') {
         //create Js config
         $ext = $extensionManager->getExtensionById('tao');
         $config = array('timeout' => 30);
         $ext->setConfig('js', $config);
         $currentVersion = '2.7.0';
     }
     //migrate from 2.7.0 to 2.7.1
     if ($currentVersion == '2.7.0') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_1.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $currentVersion = '2.7.1';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.1') {
         foreach ($extensionManager->getInstalledExtensions() as $extension) {
             $extManifestConsts = $extension->getConstants();
             if (isset($extManifestConsts['BASE_WWW'])) {
                 ClientLibRegistry::getRegistry()->register($extension->getId(), $extManifestConsts['BASE_WWW'] . 'js');
                 ClientLibRegistry::getRegistry()->register($extension->getId() . 'Css', $extManifestConsts['BASE_WWW'] . 'css');
             }
         }
         $currentVersion = '2.7.2';
     }
     if ($currentVersion == '2.7.2') {
         // zendSearch Update only
         $currentVersion = '2.7.3';
     }
     if ($currentVersion == '2.7.3') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_4.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $currentVersion = '2.7.4';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.4') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'model_2_7_5.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $currentVersion = '2.7.5';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.5') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index_type_2_7_6.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $currentVersion = '2.7.6';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.6') {
         $dir = FILES_PATH . 'updates' . DIRECTORY_SEPARATOR . 'pre_' . $currentVersion;
         if (!mkdir($dir, 0700, true)) {
             throw new \common_exception_Error('Unable to log update to ' . $dir);
         }
         FileModel::toFile($dir . DIRECTORY_SEPARATOR . 'backup.rdf', ModelManager::getModel()->getRdfInterface());
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_1.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_4.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'model_2_7_5.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index_type_2_7_6.rdf');
         // syncronise also adds translations to correct modelid
         OntologyUpdater::syncModels();
         // remove translations from model 1
         $persistence = \common_persistence_SqlPersistence::getPersistence('default');
         $result = $persistence->query("SELECT DISTINCT subject FROM statements WHERE NOT modelId = 1");
         $toCleanup = array();
         while ($row = $result->fetch()) {
             $toCleanup[] = $row['subject'];
         }
         $query = "DELETE from statements WHERE modelId = 1 AND subject = ? " . "AND predicate IN ('" . RDFS_LABEL . "','" . RDFS_COMMENT . "') ";
         foreach ($toCleanup as $subject) {
             $persistence->exec($query, array($subject));
         }
         $currentVersion = '2.7.7';
     }
     if ($currentVersion == '2.7.7') {
         $lockImpl = defined('ENABLE_LOCK') && ENABLE_LOCK ? new OntoLock() : new NoLock();
         LockManager::setImplementation($lockImpl);
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('ext' => 'tao', 'mod' => 'Lock')));
         $currentVersion = '2.7.8';
     }
     if ($currentVersion == '2.7.8') {
         if ($this->migrateFsAccess()) {
             $currentVersion = '2.7.9';
         }
     }
     if ($currentVersion == '2.7.9') {
         // update role classes
         OntologyUpdater::syncModels();
         $currentVersion = '2.7.10';
     }
     if ($currentVersion == '2.7.10') {
         // correct access roles
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lists@getListElements')));
         AclProxy::revokeRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('ext' => 'tao', 'mod' => 'Lock')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lock@release')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lock@locked')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#LockManagerRole', array('act' => 'tao_actions_Lock@forceRelease')));
         $currentVersion = '2.7.11';
     }
     if ($currentVersion == '2.7.11') {
         // move session abstraction
         if (defined("PHP_SESSION_HANDLER") && class_exists(PHP_SESSION_HANDLER)) {
             if (PHP_SESSION_HANDLER == 'common_session_php_KeyValueSessionHandler') {
                 $sessionHandler = new \common_session_php_KeyValueSessionHandler(array(\common_session_php_KeyValueSessionHandler::OPTION_PERSISTENCE => 'session'));
             } else {
                 $sessionHandler = new PHP_SESSION_HANDLER();
             }
             $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
             $ext->setConfig(\Bootstrap::CONFIG_SESSION_HANDLER, $sessionHandler);
         }
         $currentVersion = '2.7.12';
     }
     if ($currentVersion == '2.7.12') {
         // add the property manager
         OntologyUpdater::syncModels();
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#PropertyManagerRole', array('controller' => 'tao_actions_Lists')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#PropertyManagerRole', array('controller' => 'tao_actions_PropertiesAuthoring')));
         $currentVersion = '2.7.13';
     }
     return $currentVersion;
 }
 /**
  * Will make the Global Manager include the Management Role of the extension
  * to install (if it exists).
  *
  * @access public
  * @author Jerome Bogaerts <*****@*****.**>
  * @return void
  * @since 2.4
  */
 public function applyAccessRules()
 {
     foreach ($this->extension->getManifest()->getAclTable() as $tableEntry) {
         $rule = new AccessRule($tableEntry[0], $tableEntry[1], $tableEntry[2]);
         AclProxy::applyRule($rule);
     }
 }
 /**
  * Perform update from $currentVersion to $versionUpdatedTo.
  *
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     // migrate from 1.0.0 to 1.1.0
     // old taoResults extension gets uninistalled and taoOutcomeRds becomes
     // the new default result storage mechanism.
     if ($this->isVersion('1.0.0')) {
         self::migrateFrom100To110();
         $this->setVersion('1.1.0');
     }
     // migrate from 1.1.0 to 1.1.1
     // RDF based result server removal and assignment of deliveries
     // to RDS implementation.
     if ($this->isVersion('1.1.0')) {
         self::migrateFrom110to111();
         $this->setVersion('1.1.1');
     }
     if ($this->isBetween('1.1.1', '1.1.3')) {
         EntryPointService::getRegistry()->registerEntryPoint(new TaoCeEntrypoint());
         $this->setVersion('1.1.3');
     }
     if ($this->isBetween('1.1.3', '1.2.1')) {
         $this->setVersion('1.2.2');
     }
     $this->skip('1.2.2', '1.6.2');
     if ($this->isVersion('1.6.2')) {
         AclProxy::applyRule(new AccessRule('grant', INSTANCE_ROLE_ANONYMOUS, ['ext' => 'taoCe', 'mod' => 'Main', 'act' => 'rootEntry']));
         $this->setVersion('1.7.0');
     }
     $this->skip('1.7.0', '1.7.1');
     // add guest login
     if ($this->isVersion('1.7.1')) {
         $entryPointService = $this->getServiceManager()->get(EntryPointService::SERVICE_ID);
         $entryPointService->addEntryPoint(new GuestAccess(), EntryPointService::OPTION_PRELOGIN);
         $this->getServiceManager()->register(EntryPointService::SERVICE_ID, $entryPointService);
         $this->setVersion('1.8.0');
     }
     $this->skip('1.8.0', '1.9.0');
 }
 /**
  *
  * @param string $initialVersion
  * @return string
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     //add portable shared libraries:
     $libBasePath = ROOT_PATH . 'taoQtiItem/views/js/portableSharedLibraries';
     $libRootUrl = ROOT_URL . 'taoQtiItem/views/js/portableSharedLibraries';
     $installBasePath = ROOT_PATH . 'taoQtiItem/install/scripts/portableSharedLibraries';
     $sharedLibRegistry = new SharedLibrariesRegistry($libBasePath, $libRootUrl);
     //migrate from 2.6 to 2.7.0
     if ($currentVersion == '2.6') {
         $sharedLibRegistry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js');
         $sharedLibRegistry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js');
         $sharedLibRegistry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js');
         $sharedLibRegistry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js');
         $sharedLibRegistry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js');
         $sharedLibRegistry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js');
         $sharedLibRegistry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js');
         $sharedLibRegistry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js');
         $sharedLibRegistry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js');
         $sharedLibRegistry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js');
         $currentVersion = '2.7.0';
     }
     //migrate from 2.7.0 to 2.7.1
     if ($currentVersion == '2.7.0') {
         $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js');
         $sharedLibRegistry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js');
         $sharedLibRegistry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js');
         $currentVersion = '2.7.1';
     }
     //migrate from 2.7.0 to 2.7.1
     if ($currentVersion == '2.7.1') {
         $sharedLibRegistry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js');
         $currentVersion = '2.7.2';
     }
     //migrate from 2.7.2 to 2.7.3
     if ($currentVersion == '2.7.2') {
         $sharedLibRegistry->registerFromFile('IMSGlobal/jquery_2_1_1', $installBasePath . '/IMSGlobal/jquery_2_1_1.js');
         $sharedLibRegistry->registerFromFile('OAT/lodash', $installBasePath . '/OAT/lodash.js');
         $sharedLibRegistry->registerFromFile('OAT/async', $installBasePath . '/OAT/async.js');
         $sharedLibRegistry->registerFromFile('OAT/raphael', $installBasePath . '/OAT/raphael.js');
         $sharedLibRegistry->registerFromFile('OAT/scale.raphael', $installBasePath . '/OAT/scale.raphael.js');
         $sharedLibRegistry->registerFromFile('OAT/util/xml', $installBasePath . '/OAT/util/xml.js');
         $sharedLibRegistry->registerFromFile('OAT/util/math', $installBasePath . '/OAT/util/math.js');
         $sharedLibRegistry->registerFromFile('OAT/util/html', $installBasePath . '/OAT/util/html.js');
         $sharedLibRegistry->registerFromFile('OAT/util/EventMgr', $installBasePath . '/OAT/util/EventMgr.js');
         $sharedLibRegistry->registerFromFile('OAT/util/event', $installBasePath . '/OAT/util/event.js');
         $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js');
         $sharedLibRegistry->registerFromFile('OAT/interact', $installBasePath . '/OAT/interact.js');
         $sharedLibRegistry->registerFromFile('OAT/interact-rotate', $installBasePath . '/OAT/interact-rotate.js');
         $sharedLibRegistry->registerFromFile('OAT/sts/transform-helper', $installBasePath . '/OAT/sts/transform-helper.js');
         $currentVersion = '2.7.3';
     }
     //migrate from 2.7.3 to 2.7.4
     if ($currentVersion == '2.7.3') {
         $sharedLibRegistry->registerFromFile('OAT/handlebars', $installBasePath . '/OAT/handlebars.js');
         $currentVersion = '2.7.4';
     }
     if ($currentVersion == '2.7.4') {
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
         $ext->setConfig('qtiCreator', array('multi-column' => false));
         $currentVersion = '2.7.5';
     }
     if ($currentVersion == '2.7.5') {
         $sharedLibRegistry->registerFromFile('OAT/sts/stsEventManager', $installBasePath . '/OAT/sts/stsEventManager.js');
         $currentVersion = '2.7.6';
     }
     if ($currentVersion == '2.7.6') {
         $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js');
         $currentVersion = '2.7.7';
     }
     if ($currentVersion == '2.7.7') {
         $itemThemesDataPath = FILES_PATH . 'tao' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR;
         $itemThemesDataPathFs = \tao_models_classes_FileSourceService::singleton()->addLocalSource('Theme FileSource', $itemThemesDataPath);
         $websource = TokenWebSource::spawnWebsource($itemThemesDataPathFs);
         ThemeRegistry::getRegistry()->setWebSource($websource->getId());
         ThemeRegistry::getRegistry()->createTarget('items', 'taoQtiItem/views/css/qti-runner.css');
         ThemeRegistry::getRegistry()->registerTheme('tao', 'TAO', 'taoQtiItem/views/css/themes/default.css', array('items'));
         ThemeRegistry::getRegistry()->setDefaultTheme('items', 'tao');
         $currentVersion = '2.7.8';
     }
     if ($currentVersion == '2.7.8') {
         $clientLibRegistry = ClientLibRegistry::getRegistry();
         $clientLibRegistry->register('qtiCustomInteractionContext', '../../../taoQtiItem/views/js/runtime/qtiCustomInteractionContext');
         $clientLibRegistry->register('qtiInfoControlContext', '../../../taoQtiItem/views/js/runtime/qtiInfoControlContext');
         $currentVersion = '2.7.9';
     }
     if ($currentVersion == '2.7.9') {
         $currentVersion = '2.8.0';
     }
     if ($currentVersion == '2.8.0') {
         $currentVersion = '2.8.1';
         $sharedLibRegistry->registerFromFile('OAT/sts/common', $installBasePath . '/OAT/sts/common.js');
     }
     if ($currentVersion == '2.8.1') {
         $qtiItem = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
         $qtiItem->setConfig('userScripts', array());
         $currentVersion = '2.9.0';
     }
     if ($currentVersion === '2.9.0') {
         $sharedLibRegistry->registerFromFile('OAT/waitForMedia', $installBasePath . '/OAT/waitForMedia.js');
         $currentVersion = '2.9.1';
     }
     if ($currentVersion === '2.9.1') {
         $currentVersion = '2.10.0';
     }
     if ($currentVersion === '2.10.0') {
         $currentVersion = '2.11.0';
     }
     if ($currentVersion === '2.11.0') {
         $sharedLibRegistry->registerFromFile('OAT/util/asset', $installBasePath . '/OAT/util/asset.js');
         $sharedLibRegistry->registerFromFile('OAT/util/tpl', $installBasePath . '/OAT/util/tpl.js');
         $currentVersion = '2.12.0';
     }
     $this->setVersion($currentVersion);
     if ($this->isBetween('2.12.0', '2.13.0')) {
         $itemQtiExt = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
         $compilerClassConfig = 'oat\\taoQtiItem\\model\\QtiItemCompiler';
         $itemQtiExt->setConfig('compilerClass', $compilerClassConfig);
         $this->setVersion('2.13.0');
     }
     if ($this->isVersion('2.13.0')) {
         \oat\tao\model\ClientLibConfigRegistry::getRegistry()->register('taoQtiItem/qtiRunner/core/QtiRunner', array('inlineModalFeedback' => false));
         $fs = \taoItems_models_classes_ItemsService::singleton()->getDefaultFileSource();
         $itemUpdater = new ItemUpdateInlineFeedback($fs->getPath());
         $itemUpdater->update(true);
         $this->setVersion('2.14.0');
     }
     $this->skip('2.14.0', '2.15.1');
     if ($this->isVersion('2.15.1')) {
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
         $validation = array('default' => array(__DIR__ . '/../../model/qti/data/imscp_v1p1.xsd', __DIR__ . '/../../model/qti/data/apipv1p0/Core_Level/Package/apipv1p0_imscpv1p2_v1p0.xsd'));
         $ext->setConfig('manifestValidation', $validation);
         $this->setVersion('2.16.0');
     }
     if ($this->isVersion('2.16.0')) {
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
         $validation = array('http://www.imsglobal.org/xsd/imsqti_v2p0' => array(__DIR__ . '/../../model/qti/data/qtiv2p0/imsqti_v2p0.xsd'), 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1' => array(__DIR__ . '/../../model/qti/data/apipv1p0/Core_Level/Package/apipv1p0_qtiitemv2p1_v1p0.xsd'), 'default' => array(__DIR__ . '/../../model/qti/data/qtiv2p1/imsqti_v2p1.xsd'));
         $ext->setConfig('contentValidation', $validation);
         $this->setVersion('2.17.0');
     }
     if ($this->isVersion('2.17.0')) {
         $this->setVersion('2.17.1');
     }
     if ($this->isVersion('2.17.1')) {
         $service = new addValidationSettings();
         $service([]);
         $this->setVersion('2.17.2');
     }
     $this->skip('2.17.2', '2.19.0');
     if ($this->isVersion('2.19.0')) {
         if (!$this->getServiceManager()->has(SimpleExporter::SERVICE_ID)) {
             $service = new ItemExporter(array('fileSystem' => 'taoQtiItem', 'fileLocation' => 'export' . DIRECTORY_SEPARATOR . 'export.csv', 'extractors' => array('OntologyExtractor' => new OntologyExtractor(), 'QtiExtractor' => new QtiExtractor()), 'columns' => array('label' => array('extractor' => 'OntologyExtractor', 'parameters' => array('property' => RDFS_LABEL)), 'type' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getInteractionType')), 'nb choice' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getNumberOfChoices')), 'BR' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getRightAnswer', 'callbackParameters' => array('delimiter' => '|'))), 'choiceInteraction' => array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getChoices', 'valuesAsColumns' => true)))));
             $service->setServiceManager($this->getServiceManager());
             $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $service);
             $createExportDirectoryScript = new createExportDirectory();
             $createExportDirectoryScript([]);
         }
         $this->setVersion('2.20.0');
     }
     $this->skip('2.20.0', '2.22.0');
     if ($this->isVersion('2.22.0')) {
         $simpleExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
         $columns = $simpleExporter->getOption('columns');
         $responseIdentifier['responseIdentifier'] = array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getResponseIdentifier'));
         $offset = array_search('BR', array_keys($columns));
         $columns = array_slice($columns, 0, $offset, true) + $responseIdentifier + array_slice($columns, $offset, NULL, true);
         $simpleExporter->setOption('columns', $columns);
         $simpleExporter->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $simpleExporter);
         $this->setVersion('2.23.0');
     }
     if ($this->isVersion('2.23.0')) {
         $simpleExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
         $columns = $simpleExporter->getOption('columns');
         $columns['BR'] = array('extractor' => 'QtiExtractor', 'parameters' => array('callback' => 'getRightAnswer', 'callbackParameters' => array('delimiter' => '|'), 'valuesAsColumns' => true));
         $simpleExporter->setOption('columns', $columns);
         $simpleExporter->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $simpleExporter);
         $this->setVersion('2.24.0');
     }
     $this->skip('2.24.0', '2.25.0');
     if ($this->isVersion('2.25.0')) {
         QtiCreatorClientConfigRegistry::getRegistry()->registerPlugin('back', 'taoQtiItem/qtiCreator/plugins/navigation/back', 'navigation');
         $this->setVersion('2.26.0');
     }
     if ($this->isVersion('2.26.0')) {
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiPreview::class));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiCreator::class));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAOItem.rdf#AbstractItemAuthor', QtiCssAuthoring::class));
         $this->setVersion('2.27.0');
     }
     $this->skip('2.27.0', '2.28.2');
     if ($this->isVersion('2.28.2')) {
         $setDragAndDropConfig = new SetDragAndDropConfig();
         $setDragAndDropConfig([]);
         $this->setVersion('2.29.0');
     }
     $this->skip('2.29.0', '2.30.1');
     if ($this->isVersion('2.30.1')) {
         $setDragAndDropConfig = new SetDragAndDropConfig();
         $setDragAndDropConfig([]);
         $this->setVersion('2.31.0');
     }
     $this->skip('2.31.0', '5.1.2');
     if ($this->isVersion('5.1.2')) {
         $sharedLibRegistry->registerFromFile('OAT/jquery.qtip', $installBasePath . '/OAT/jquery.qtip.js');
         $this->setVersion('5.2.0');
     }
     $this->skip('5.2.0', '5.3.0');
     if ($this->isVersion('5.3.0')) {
         $sharedLibRegistry->registerFromFile('OAT/customEvent', $installBasePath . '/OAT/customEvent.js');
         $this->setVersion('5.4.0');
     }
     $this->skip('5.4.0', '5.7.0');
     if ($this->isVersion('5.7.0')) {
         $eventManager = $this->getServiceManager()->get(\oat\oatbox\event\EventManager::CONFIG_ID);
         $eventManager->attach(\oat\taoItems\model\event\ItemRdfUpdatedEvent::class, array(\oat\taoQtiItem\model\Listener\ItemUpdater::class, 'catchItemRdfUpdatedEvent'));
         $this->getServiceManager()->register(\oat\oatbox\event\EventManager::CONFIG_ID, $eventManager);
         $this->setVersion('5.7.1');
     }
     $this->skip('5.7.1', '5.7.3');
     if ($this->isVersion('5.7.3')) {
         $categoriesService = new ItemCategoriesService(array('properties' => array()));
         $categoriesService->setServiceManager($this->getServiceManager());
         $this->getServiceManager()->register(ItemCategoriesService::SERVICE_ID, $categoriesService);
         $this->setVersion('5.8.0');
     }
     $this->skip('5.8.0', '6.3.0');
 }
Exemple #16
0
 /**
  *
  * @param $initialVersion
  * @return string $initialVersion
  * @throws \common_exception_Error
  * @throws \common_exception_InconsistentData
  * @throws \common_ext_ExtensionException
  * @throws common_Exception
  */
 public function update($initialVersion)
 {
     $extensionManager = common_ext_ExtensionsManager::singleton();
     //migrate from 2.6 to 2.7.0
     if ($this->isVersion('2.6')) {
         //create Js config
         $ext = $extensionManager->getExtensionById('tao');
         $config = array('timeout' => 30);
         $ext->setConfig('js', $config);
         $this->setVersion('2.7.0');
     }
     //migrate from 2.7.0 to 2.7.1
     if ($this->isVersion('2.7.0')) {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_1.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $this->setVersion('2.7.1');
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($this->isVersion('2.7.1')) {
         SearchService::setSearchImplementation(ZendSearch::createSearch());
         $this->setVersion('2.7.2');
     }
     // upgrade is requied for asset service to continue working
     if ($this->isBetween('2.7.2', '2.13.2')) {
         if (!$this->getServiceManager()->has(AssetService::SERVICE_ID)) {
             $this->getServiceManager()->register(AssetService::SERVICE_ID, new AssetService());
         }
     }
     if ($this->isVersion('2.7.2')) {
         foreach ($extensionManager->getInstalledExtensions() as $extension) {
             $extManifestConsts = $extension->getConstants();
             if (isset($extManifestConsts['BASE_WWW'])) {
                 ClientLibRegistry::getRegistry()->register($extension->getId(), $extManifestConsts['BASE_WWW'] . 'js');
                 ClientLibRegistry::getRegistry()->register($extension->getId() . 'Css', $extManifestConsts['BASE_WWW'] . 'css');
             }
         }
         $this->setVersion('2.7.3');
     }
     if ($this->isVersion('2.7.3')) {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_4.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $this->setVersion('2.7.4');
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($this->isVersion('2.7.4')) {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'model_2_7_5.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $this->setVersion('2.7.5');
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($this->isVersion('2.7.5')) {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index_type_2_7_6.rdf';
         $adapter = new tao_helpers_data_GenerisAdapterRdf();
         if ($adapter->import($file)) {
             $this->setVersion('2.7.6');
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($this->isVersion('2.7.6')) {
         $dir = FILES_PATH . 'updates' . DIRECTORY_SEPARATOR . 'pre_2.7.6';
         if (!mkdir($dir, 0700, true)) {
             throw new \common_exception_Error('Unable to log update to ' . $dir);
         }
         FileModel::toFile($dir . DIRECTORY_SEPARATOR . 'backup.rdf', ModelManager::getModel()->getRdfInterface());
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_1.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'indexation_2_7_4.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'model_2_7_5.rdf');
         OntologyUpdater::correctModelId(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index_type_2_7_6.rdf');
         // syncronise also adds translations to correct modelid
         OntologyUpdater::syncModels();
         // remove translations from model 1
         $persistence = \common_persistence_SqlPersistence::getPersistence('default');
         $result = $persistence->query("SELECT DISTINCT subject FROM statements WHERE NOT modelId = 1");
         $toCleanup = array();
         while ($row = $result->fetch()) {
             $toCleanup[] = $row['subject'];
         }
         $query = "DELETE from statements WHERE modelId = 1 AND subject = ? " . "AND predicate IN ('" . RDFS_LABEL . "','" . RDFS_COMMENT . "') ";
         foreach ($toCleanup as $subject) {
             $persistence->exec($query, array($subject));
         }
         $this->setVersion('2.7.7');
     }
     // update FuncAccessControl early to support access changes
     if ($this->isBetween('2.7.7', '2.17.4')) {
         $implClass = common_ext_ExtensionsManager::singleton()->getExtensionById('tao')->getConfig('FuncAccessControl');
         if (is_string($implClass)) {
             $impl = new $implClass();
             $this->getServiceManager()->register(AclProxy::SERVICE_ID, $impl);
         }
     }
     if ($this->isVersion('2.7.7')) {
         $lockImpl = defined('ENABLE_LOCK') && ENABLE_LOCK ? new OntoLock() : new NoLock();
         LockManager::setImplementation($lockImpl);
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('ext' => 'tao', 'mod' => 'Lock')));
         $this->setVersion('2.7.8');
     }
     if ($this->isVersion('2.7.8')) {
         if ($this->migrateFsAccess()) {
             $this->setVersion('2.7.9');
         }
     }
     if ($this->isVersion('2.7.9')) {
         // update role classes
         OntologyUpdater::syncModels();
         $this->setVersion('2.7.10');
     }
     if ($this->isVersion('2.7.10')) {
         // correct access roles
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lists@getListElements')));
         AclProxy::revokeRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('ext' => 'tao', 'mod' => 'Lock')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lock@release')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('act' => 'tao_actions_Lock@locked')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#LockManagerRole', array('act' => 'tao_actions_Lock@forceRelease')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#BackOfficeRole', array('ext' => 'tao', 'mod' => 'Search')));
         $this->setVersion('2.7.11');
     }
     if ($this->isVersion('2.7.11')) {
         // move session abstraction
         if (defined("PHP_SESSION_HANDLER") && class_exists(PHP_SESSION_HANDLER)) {
             if (PHP_SESSION_HANDLER == 'common_session_php_KeyValueSessionHandler') {
                 $sessionHandler = new \common_session_php_KeyValueSessionHandler(array(\common_session_php_KeyValueSessionHandler::OPTION_PERSISTENCE => 'session'));
             } else {
                 $sessionHandler = new PHP_SESSION_HANDLER();
             }
             $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
             $ext->setConfig(\Bootstrap::CONFIG_SESSION_HANDLER, $sessionHandler);
         }
         $this->setVersion('2.7.12');
     }
     if ($this->isVersion('2.7.12')) {
         // add the property manager
         OntologyUpdater::syncModels();
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#PropertyManagerRole', array('controller' => 'tao_actions_Lists')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/TAO.rdf#PropertyManagerRole', array('controller' => 'tao_actions_PropertiesAuthoring')));
         $this->setVersion('2.7.13');
     }
     if ($this->isVersion('2.7.13')) {
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/generis.rdf#AnonymousRole', array('ext' => 'tao', 'mod' => 'PasswordRecovery', 'act' => 'index')));
         AclProxy::applyRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/generis.rdf#AnonymousRole', array('ext' => 'tao', 'mod' => 'PasswordRecovery', 'act' => 'resetPassword')));
         $this->setVersion('2.7.14');
     }
     if ($this->isVersion('2.7.14')) {
         // index user logins
         OntologyUpdater::syncModels();
         $this->setVersion('2.7.15');
     }
     // reset the search impl for machines that missed 2.7.1 update due to merge
     if ($this->isVersion('2.7.15') || $this->isVersion('2.7.16')) {
         try {
             SearchService::getSearchImplementation();
             // all good
         } catch (\common_exception_Error $error) {
             SearchService::setSearchImplementation(new GenerisSearch());
         }
         $this->setVersion('2.7.16');
     }
     if ($this->isVersion('2.7.16')) {
         $registry = ClientLibRegistry::getRegistry();
         $map = $registry->getLibAliasMap();
         foreach ($map as $id => $fqp) {
             $registry->remove($id);
             $registry->register($id, $fqp);
         }
         $this->setVersion('2.7.17');
     }
     // semantic versioning
     $this->skip('2.7.17', '2.8.0');
     if ($this->isBetween('2.8.0', '2.13.0')) {
         $tao = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
         $entryPoints = $tao->getConfig('entrypoint');
         if (is_array($entryPoints) || $entryPoints == false) {
             $service = new EntryPointService();
             if (is_array($entryPoints)) {
                 foreach ($entryPoints as $id => $entryPoint) {
                     $service->overrideEntryPoint($id, $entryPoint);
                     $service->activateEntryPoint($id, EntryPointService::OPTION_POSTLOGIN);
                 }
             }
             // register, don't activate
             $passwordResetEntry = new PasswordReset();
             $service->overrideEntryPoint($passwordResetEntry->getId(), $passwordResetEntry);
             $this->getServiceManager()->register(EntryPointService::SERVICE_ID, $service);
         }
     }
     if ($this->isVersion('2.8.0')) {
         $service = $this->getServiceManager()->get(EntryPointService::SERVICE_ID);
         $service->registerEntryPoint(new BackOfficeEntrypoint());
         $this->getServiceManager()->register(EntryPointService::SERVICE_ID, $service);
         $this->setVersion('2.8.1');
     }
     // semantic versioning
     $this->skip('2.8.1', '2.9');
     // remove id properties
     if ($this->isVersion('2.9')) {
         $rdf = ModelManager::getModel()->getRdfInterface();
         foreach ($rdf as $triple) {
             if ($triple->predicate == 'id') {
                 $rdf->remove($triple);
             }
         }
         $this->setVersion('2.9.1');
     }
     // tao object split
     if ($this->isVersion('2.9.1')) {
         OntologyUpdater::syncModels();
         $this->setVersion('2.10.0');
     }
     // widget definitions
     if ($this->isVersion('2.10.0')) {
         OntologyUpdater::syncModels();
         $this->setVersion('2.10.1');
     }
     // add login form config
     if ($this->isVersion('2.10.1')) {
         $loginFormSettings = array('elements' => array());
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
         $ext->setConfig('loginForm', $loginFormSettings);
         $this->setVersion('2.10.2');
     }
     if ($this->isVersion('2.10.2')) {
         $s = DIRECTORY_SEPARATOR;
         ThemeRegistry::getRegistry()->createTarget('frontOffice', array('css' => 'tao' . $s . 'views' . $s . 'css' . $s . 'tao-3.css', 'templates' => array('header-logo' => 'taoDelivery' . $s . 'views' . $s . 'templates' . $s . 'DeliveryServer' . $s . 'blocks' . $s . 'header-logo.tpl', 'footer' => 'taoDelivery' . $s . 'views' . $s . 'templates' . $s . 'DeliveryServer' . $s . 'blocks' . $s . 'footer.tpl')));
         ThemeRegistry::getRegistry()->createTarget('backOffice', array('css' => 'tao' . $s . 'views' . $s . 'css' . $s . 'tao-3.css', 'templates' => array('header-logo' => 'tao' . $s . 'views' . $s . 'templates' . $s . 'blocks' . $s . 'header-logo.tpl', 'footer' => 'tao' . $s . 'views' . $s . 'templates' . $s . 'blocks' . $s . 'footer.tpl')));
         $this->setVersion('2.11.0');
     }
     if ($this->isVersion('2.11.0')) {
         $service = new \tao_models_classes_service_StateStorage(array('persistence' => 'serviceState'));
         $this->getServiceManager()->register('tao/stateStorage', $service);
         $this->setVersion('2.12.0');
     }
     $this->skip('2.12.0', '2.13.0');
     // moved to 2.8.0
     $this->skip('2.13.0', '2.13.1');
     // moved to 2.7.2
     $this->skip('2.13.1', '2.13.2');
     if ($this->isVersion('2.13.2')) {
         //add the new customizable template "login-message" to backOffice target
         $themeService = new ThemeService();
         //test for overrides
         $ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
         $oldConfig = $ext->getConfig('themes');
         $compatibilityConfig = array();
         foreach ($oldConfig['frontOffice']['available'] as $arr) {
             if ($arr['id'] == $oldConfig['frontOffice']['default']) {
                 $compatibilityConfig[Theme::CONTEXT_FRONTOFFICE] = $arr;
             }
         }
         foreach ($oldConfig['backOffice']['available'] as $arr) {
             if ($arr['id'] == $oldConfig['backOffice']['default']) {
                 $compatibilityConfig[Theme::CONTEXT_BACKOFFICE] = $arr;
             }
         }
         if (empty($compatibilityConfig)) {
             $themeService->setTheme(new DefaultTheme());
         } else {
             $themeService->setTheme(new CompatibilityTheme($compatibilityConfig));
         }
         unset($oldConfig['backOffice']);
         unset($oldConfig['frontOffice']);
         $ext->setConfig('themes', $oldConfig);
         $this->getServiceManager()->register(ThemeService::SERVICE_ID, $themeService);
         $this->setVersion('2.14.0');
     }
     $this->skip('2.14.0', '2.15.0');
     if ($this->isVersion('2.15.0')) {
         (new SimpleAccess())->revokeRule(new AccessRule('grant', 'http://www.tao.lu/Ontologies/generis.rdf#AnonymousRole', ['ext' => 'tao', 'mod' => 'AuthApi']));
         $this->setVersion('2.15.1');
     }
     $this->skip('2.15.1', '2.15.2');
     if ($this->isVersion('2.15.2')) {
         ClientLibConfigRegistry::getRegistry()->register('util/locale', ['decimalSeparator' => '.', 'thousandsSeparator' => '']);
         $this->setVersion('2.15.3');
     }
     $this->skip('2.15.3', '2.16.0');
     if ($this->isVersion('2.16.0')) {
         try {
             $this->getServiceManager()->get(RequiredActionService::CONFIG_ID);
             // all good, already configured
         } catch (ServiceNotFoundException $error) {
             $requiredActionService = new RequiredActionService();
             $this->getServiceManager()->register(RequiredActionService::CONFIG_ID, $requiredActionService);
         }
         OntologyUpdater::syncModels();
         $this->setVersion('2.17.0');
     }
     if ($this->isBetween('2.17.0', '2.17.4')) {
         ClientLibConfigRegistry::getRegistry()->register('util/locale', ['decimalSeparator' => '.', 'thousandsSeparator' => '']);
         $this->setVersion('2.17.4');
     }
     // skiped registering of func ACL proxy as done before 2.7.7
     $this->skip('2.17.4', '2.18.2');
     if ($this->isVersion('2.18.2')) {
         $extension = \common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
         $config = $extension->getConfig('login');
         if (!is_array($config)) {
             $config = [];
         }
         if (!array_key_exists('disableAutocomplete', $config)) {
             $config['disableAutocomplete'] = false;
         }
         $extension->setConfig('login', $config);
         $this->setVersion('2.19.0');
     }
     $this->skip('2.19.0', '2.21.0');
     if ($this->isVersion('2.21.0')) {
         $config = common_ext_ExtensionsManager::singleton()->getExtensionById('tao')->getConfig('ServiceFileStorage');
         $service = new \tao_models_classes_service_FileStorage($config);
         $this->getServiceManager()->register(\tao_models_classes_service_FileStorage::SERVICE_ID, $service);
         $this->setVersion('2.22.0');
     }
     $this->skip('2.22.0', '5.5.0');
     if ($this->isVersion('5.5.0')) {
         $clientConfig = new ClientConfigService();
         $clientConfig->setClientConfig('themesAvailable', new ThemeConfig());
         $this->getServiceManager()->register(ClientConfigService::SERVICE_ID, $clientConfig);
         $this->setVersion('5.6.0');
     }
     $this->skip('5.6.0', '5.6.2');
     if ($this->isVersion('5.6.2')) {
         if (!$this->getServiceManager()->has(UpdateLogger::SERVICE_ID)) {
             // setup log fs
             $fsm = $this->getServiceManager()->get(FileSystemService::SERVICE_ID);
             $fsm->createFileSystem('log', 'tao/log');
             $this->getServiceManager()->register(FileSystemService::SERVICE_ID, $fsm);
             $this->getServiceManager()->register(UpdateLogger::SERVICE_ID, new UpdateLogger(array(UpdateLogger::OPTION_FILESYSTEM => 'log')));
         }
         $this->setVersion('5.6.3');
     }
     $this->skip('5.6.3', '5.9.1');
     if ($this->isVersion('5.9.1')) {
         /** @var EventManager $eventManager */
         $eventManager = $this->getServiceManager()->get(EventManager::CONFIG_ID);
         $eventManager->detach(RoleRemovedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $eventManager->detach(RoleCreatedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $eventManager->detach(RoleChangedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $eventManager->detach(UserCreatedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $eventManager->detach(UserUpdatedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $eventManager->detach(UserRemovedEvent::class, ['oat\\tao\\scripts\\update\\LoggerService', 'logEvent']);
         $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
         $this->setVersion('5.9.2');
     }
     $this->skip('5.9.2', '6.0.1');
     if ($this->isVersion('6.0.1')) {
         OntologyUpdater::syncModels();
         $this->setVersion('6.1.0');
     }
     $this->skip('6.1.0', '7.16.2');
     if ($this->isVersion('7.16.2')) {
         OntologyUpdater::syncModels();
         ValidationRuleRegistry::getRegistry()->set('notEmpty', new \tao_helpers_form_validators_NotEmpty());
         $this->setVersion('7.17.0');
     }
     $this->skip('7.17.0', '7.23.0');
     if ($this->isVersion('7.23.0')) {
         $service = new \oat\tao\model\mvc\DefaultUrlService(['default' => ['ext' => 'tao', 'controller' => 'Main', 'action' => 'index'], 'login' => ['ext' => 'tao', 'controller' => 'Main', 'action' => 'login']]);
         $this->getServiceManager()->register(\oat\tao\model\mvc\DefaultUrlService::SERVICE_ID, $service);
         $this->setVersion('7.24.0');
     }
     $this->skip('7.24.0', '7.27.0');
     if ($this->isVersion('7.27.0')) {
         OntologyUpdater::syncModels();
         $this->setVersion('7.28.0');
     }
     $this->skip('7.28.0', '7.30.1');
 }