/** * * @param string $initialVersion * @return void */ public function update($initialVersion) { if ($this->isBetween('0', '0.2')) { $this->setVersion('0.2'); } if ($this->isVersion('0.2')) { $oldRepository = $this->getServiceManager()->get(Repository::SERVICE_ID); $this->getServiceManager()->register('taoWorkspace/innerRevision', $oldRepository); $newService = new RevisionWrapper(array(RevisionWrapper::OPTION_INNER_IMPLEMENTATION => 'taoWorkspace/innerRevision')); $this->getServiceManager()->register(Repository::SERVICE_ID, $newService); $this->setVersion('0.3.0'); } $this->skip('0.3.0', '0.4.1'); if ($this->isVersion('0.4.1')) { $service = $this->getServiceManager()->get(Repository::SERVICE_ID); $service->setOption(RepositoryService::OPTION_FS, 'revisions'); $this->getServiceManager()->register(Repository::SERVICE_ID, $service); $this->setVersion('0.5.0'); } $this->skip('0.5.0', '0.6.0'); if ($this->isVersion('0.6.0')) { /* @var $modelWrapper WrapperModel */ $modelWrapper = ModelManager::getModel(); $inner = $modelWrapper->getInnerModel(); $inner->setOption(core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); $workspace = $modelWrapper->getWorkspaceModel(); $workspace->setOption(core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); $wrapedModel = WrapperModel::wrap($inner, $workspace); $wrapedModel->setServiceLocator($this->getServiceManager()); ModelManager::setModel($wrapedModel); $this->setVersion('0.6.1'); } }
/** * Return the used model * @return Model */ function getModel() { if (is_null($this->model)) { return ModelManager::getModel(); } return $this->model; }
public function __invoke($params) { $lock = $this->getServiceManager()->get(LockSystemInterface::SERVICE_ID); if (!$lock instanceof LockSystem) { throw new \common_exception_InconsistentData('Expected Workspace Lock not found, found ' . get_class($lock)); } $model = ModelManager::getModel(); if (!$model instanceof WrapperModel) { throw new \common_exception_InconsistentData('Expected Ontology Wrapper not found, found ' . get_class($model)); } $repositoryStore = $this->getServiceManager()->get(Repository::SERVICE_ID); if (!$repositoryStore instanceof RevisionWrapper) { throw new \common_exception_InconsistentData('Expected Revision Wrapper not found, found ' . get_class($repositoryStore)); } $this->releaseAll($lock); $innerModel = $model->getInnerModel(); ModelManager::setModel($innerModel); $innerKey = $repositoryStore->getOption(RevisionWrapper::OPTION_INNER_IMPLEMENTATION); $innerStore = $this->getServiceManager()->get($innerKey); $this->registerService(Repository::SERVICE_ID, $innerStore); $this->getServiceManager()->unregister($innerKey); $storageSql = $lock->getStorage()->getPersistence(); $this->registerService(LockSystemInterface::SERVICE_ID, new NoLock()); $storageSql->exec('DROP TABLE workspace'); return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Successfully removed workspace wrappers')); }
/** * * @param string $currentVersion * @return string $versionUpdatedTo */ public function update($initialVersion) { $currentVersion = $initialVersion; if ($currentVersion == '2.7') { $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.1.rdf'; $api = core_kernel_impl_ApiModelOO::singleton(); $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file); if ($success) { $currentVersion = '2.7.1'; } else { common_Logger::w('Import failed for ' . $file); } } if ($currentVersion == '2.7.1') { $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.2.rdf'; $api = core_kernel_impl_ApiModelOO::singleton(); $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file); if ($success) { $currentVersion = '2.7.2'; } else { common_Logger::w('Import failed for ' . $file); } } if ($currentVersion == '2.7.2') { $implClass = common_ext_ExtensionsManager::singleton()->getExtensionById('generis')->getConfig(PermissionManager::CONFIG_KEY); if (is_string($implClass)) { if (class_exists($implClass)) { $impl = new $implClass(); PermissionManager::setPermissionModel($impl); $currentVersion = '2.7.3'; } else { common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass)); } } else { common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass)); } } if ($currentVersion == '2.7.3') { ModelManager::setModel(new \core_kernel_persistence_smoothsql_SmoothModel(array(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', \core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => $this->getReadableModelIds(), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array('1'), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => '1'))); $currentVersion = '2.7.4'; } if ($currentVersion == '2.7.4' && defined('GENERIS_URI_PROVIDER')) { if (in_array(GENERIS_URI_PROVIDER, array('DatabaseSerialUriProvider', 'AdvKeyValueUriProvider'))) { $uriProviderClassName = '\\core_kernel_uri_' . GENERIS_URI_PROVIDER; $options = array(\core_kernel_uri_DatabaseSerialUriProvider::OPTION_PERSISTENCE => 'default', \core_kernel_uri_DatabaseSerialUriProvider::OPTION_NAMESPACE => LOCAL_NAMESPACE . '#'); $provider = new $uriProviderClassName($options); } else { $uriProviderClassName = '\\common_uri_' . GENERIS_URI_PROVIDER; $provider = new $uriProviderClassName(); } \core_kernel_uri_UriService::singleton()->setUriProvider($provider); $currentVersion = '2.7.5'; } // service manager support if ($currentVersion == '2.7.5' || $currentVersion == '2.7.6' || $currentVersion == '2.7.7' || $currentVersion == '2.8.0') { $currentVersion = '2.9.0'; } return $currentVersion; }
public static function deepDeleteTriples($triples) { $rdf = ModelManager::getModel()->getRdfInterface(); foreach ($triples as $triple) { self::deleteDependencies($triple); $rdf->remove($triple); } }
public static function correctModelId($rdfFile) { $modelFile = new FileModel(array('file' => $rdfFile)); $modelRdf = ModelManager::getModel()->getRdfInterface(); foreach ($modelFile->getRdfInterface() as $triple) { $modelRdf->remove($triple); $modelRdf->add($triple); } }
protected function addLanguages($extension) { $langService = tao_models_classes_LanguageService::singleton(); $dataUsage = new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_DATA); $dataOptions = array(); $model = ModelManager::getModel(); foreach ($langService->getAvailableLanguagesByUsage($dataUsage) as $lang) { $langCode = $langService->getCode($lang); $pack = new RdfPack($langCode, $extension); $this->append($pack->getIterator()); } }
public function __invoke($params) { SqlStorage::createTable(); $code = 666; $workspaceModel = new core_kernel_persistence_smoothsql_SmoothModel(array(core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => array($code), core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array($code), core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => $code, core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE => ComplexSearchService::SERVICE_ID)); $model = ModelManager::getModel(); $model->setOption(core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); $wrapedModel = WrapperModel::wrap($model, $workspaceModel); $wrapedModel->setServiceLocator($this->getServiceLocator()); ModelManager::setModel($wrapedModel); LockManager::setImplementation(new LockSystem()); $oldRepository = $this->getServiceManager()->get(Repository::SERVICE_ID); $this->registerService('taoWorkspace/innerRevision', $oldRepository); $newService = new RevisionWrapper(array(RevisionWrapper::OPTION_INNER_IMPLEMENTATION => 'taoWorkspace/innerRevision', RepositoryService::OPTION_FS => 'revisions')); $this->registerService(Repository::SERVICE_ID, $newService); }
/** * Short description of method install * * @access public * @author Joel Bout, <*****@*****.**> * @return mixed */ public function install() { if ($this->extension->getId() != 'generis') { throw new common_ext_ExtensionException('Tried to install "' . $this->extension->getId() . '" extension using the GenerisInstaller'); } //$this->installCustomScript(); $this->installLoadDefaultConfig(); ModelManager::setModel(new \core_kernel_persistence_smoothsql_SmoothModel(array(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', \core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => array('1'), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array('1'), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => '1'))); $this->installOntology(); //$this->installLocalData(); //$this->installModuleModel(); $this->installRegisterExt(); common_cache_FileCache::singleton()->purge(); common_Logger::d('Installing custom script for extension ' . $this->extension->getId()); $this->installCustomScript(); }
/** * * @param string $initialVersion * @return string $versionUpdatedTo */ public function update($initialVersion) { // move ResultsManagerRole to model 1 if ($this->isVersion('2.6')) { $rdf = ModelManager::getModel()->getRdfInterface(); $toChange = array(); foreach ($rdf as $triple) { if ($triple->subject == 'http://www.tao.lu/Ontologies/TAOResult.rdf#ResultsManagerRole') { $toChange[] = $triple; } } foreach ($toChange as $triple) { $rdf->remove($triple); $triple->modelid = 1; $rdf->add($triple); } ${$this}->setVersion('2.6.1'); } $this->skip('2.6.1', '3.2.2'); }
/** * * @param string $currentVersion * @return string $versionUpdatedTo */ public function update($initialVersion) { $currentVersion = $initialVersion; // move ResultsManagerRole to model 1 if ($currentVersion == '2.6') { $rdf = ModelManager::getModel()->getRdfInterface(); $toChange = array(); foreach ($rdf as $triple) { if ($triple->subject == 'http://www.tao.lu/Ontologies/TAOResult.rdf#ResultsManagerRole') { $toChange[] = $triple; } } foreach ($toChange as $triple) { $rdf->remove($triple); $triple->modelid = 1; $rdf->add($triple); } $currentVersion = '2.6.1'; } return $currentVersion; }
public function __invoke($params) { if (count($params) < 1) { return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Usage: ImportRdf RDF_FILE [MODEL_ID]')); } $filename = array_shift($params); if (!file_exists($filename) || !is_readable($filename)) { return new \common_report_Report(\common_report_Report::TYPE_ERROR, __('Unable to open file %s', $filename)); } if (empty($params)) { $iterator = new FileIterator($filename); } else { $modelId = array_shift($params); $iterator = new FileIterator($filename, $modelId); } $rdf = ModelManager::getModel()->getRdfInterface(); $triples = 0; foreach ($iterator as $triple) { $triples++; $rdf->add($triple); } return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Successfully imported %s tripples', $triples)); }
public function addReadableModel($modelId) { common_Logger::i('Adding model ' . $modelId . ' via wrapper'); $this->getInnerModel()->addReadableModel($modelId); // update in persistence ModelManager::setModel($this); }
/** * 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) 2015 (original work) Open Assessment Technologies SA; * * */ use oat\taoWorkspace\model\lockStrategy\LockSystem; use oat\generis\model\data\ModelManager; use oat\tao\model\lock\LockManager; use oat\taoWorkspace\model\generis\WrapperModel; use oat\taoWorkspace\model\lockStrategy\SqlStorage; SqlStorage::createTable(); $code = 666; $workspaceModel = new \core_kernel_persistence_smoothsql_SmoothModel(array(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', \core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => array($code), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array($code), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => $code)); $wrapedModel = WrapperModel::wrap(ModelManager::getModel(), $workspaceModel); ModelManager::setModel($wrapedModel); LockManager::setImplementation(new LockSystem());
/** * inserts the datamodels * specified in the Manifest * * @access protected * @author Jerome Bogaerts, <*****@*****.**> * @return void */ protected function installOntology() { helpers_TimeOutHelper::setTimeOutLimit(helpers_TimeOutHelper::MEDIUM); $rdf = ModelManager::getModel()->getRdfInterface(); foreach ($this->getExtensionModel() as $triple) { $rdf->add($triple); } helpers_TimeOutHelper::reset(); }
/** * @param string $initialVersion * @return string $versionUpdatedTo */ public function update($initialVersion) { $currentVersion = $initialVersion; if ($currentVersion == '2.7') { $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.1.rdf'; $api = core_kernel_impl_ApiModelOO::singleton(); $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file); if ($success) { $currentVersion = '2.7.1'; } else { common_Logger::w('Import failed for ' . $file); } } if ($currentVersion == '2.7.1') { $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.2.rdf'; $api = core_kernel_impl_ApiModelOO::singleton(); $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file); if ($success) { $currentVersion = '2.7.2'; } else { common_Logger::w('Import failed for ' . $file); } } if ($currentVersion == '2.7.2') { $implClass = common_ext_ExtensionsManager::singleton()->getExtensionById('generis')->getConfig(PermissionManager::CONFIG_KEY); if (is_string($implClass)) { if (class_exists($implClass)) { $impl = new $implClass(); PermissionManager::setPermissionModel($impl); $currentVersion = '2.7.3'; } else { common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass)); } } else { common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass)); } } if ($currentVersion == '2.7.3') { ModelManager::setModel(new core_kernel_persistence_smoothsql_SmoothModel(array(core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => $this->getReadableModelIds(), core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array('1'), core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => '1'))); $currentVersion = '2.7.4'; } if ($currentVersion == '2.7.4' && defined('GENERIS_URI_PROVIDER')) { if (in_array(GENERIS_URI_PROVIDER, array('DatabaseSerialUriProvider', 'AdvKeyValueUriProvider'))) { $uriProviderClassName = '\\core_kernel_uri_' . GENERIS_URI_PROVIDER; $options = array(core_kernel_uri_DatabaseSerialUriProvider::OPTION_PERSISTENCE => 'default', core_kernel_uri_DatabaseSerialUriProvider::OPTION_NAMESPACE => LOCAL_NAMESPACE . '#'); $provider = new $uriProviderClassName($options); } else { $uriProviderClassName = '\\common_uri_' . GENERIS_URI_PROVIDER; $provider = new $uriProviderClassName(); } core_kernel_uri_UriService::singleton()->setUriProvider($provider); $currentVersion = '2.7.5'; } // service manager support if ($currentVersion == '2.7.5' || $currentVersion == '2.7.6' || $currentVersion == '2.7.7' || $currentVersion == '2.8.0') { $currentVersion = '2.9.0'; } if ($currentVersion == '2.9.0') { // skip, unused //try { // $this->getServiceManager()->get('generis/FsManager'); //} catch (ServiceNotFoundException $e) { // $FsManager = new \common_persistence_fileSystem_Manager(array( // \common_persistence_fileSystem_Manager::OPTION_FILE_PATH => FILES_PATH // )); // // $this->getServiceManager()->register('generis/FsManager', $FsManager); //} // update persistences $persistenceConfig = $this->getServiceManager()->get('generis/persistences'); if (is_array($persistenceConfig)) { $service = new common_persistence_Manager(array(common_persistence_Manager::OPTION_PERSISTENCES => $persistenceConfig)); $this->getServiceManager()->register('generis/persistences', $service); } // update cache try { $this->getServiceManager()->get('generis/cache'); } catch (ServiceNotFoundException $e) { $cache = new common_cache_KeyValueCache(array(common_cache_KeyValueCache::OPTION_PERSISTENCE => 'cache')); $cache->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register('generis/cache', $cache); } $currentVersion = '2.10.0'; } if ($currentVersion == '2.10.0') { $eventManager = new EventManager(); $eventManager->attach('oat\\generis\\model\\data\\event\\ResourceCreated', array('oat\\generis\\model\\data\\permission\\PermissionManager', 'catchEvent')); $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager); $currentVersion = '2.11.0'; } $this->setVersion($currentVersion); if ($this->isVersion('2.11.0')) { $FsManager = new FileSystemService(array(FileSystemService::OPTION_FILE_PATH => FILES_PATH, FileSystemService::OPTION_ADAPTERS => array())); $class = new core_kernel_classes_Class(GENERIS_NS . '#VersionedRepository'); foreach ($class->getInstances(true) as $resource) { $oldFs = new core_kernel_versioning_Repository($resource); $path = core_kernel_fileSystem_Cache::getFileSystemPath($oldFs); $FsManager->registerLocalFileSystem($resource->getUri(), $path); } $this->getServiceManager()->register(FileSystemService::SERVICE_ID, $FsManager); $this->setVersion('2.12.0'); } $this->skip('2.12.0', '2.18.0'); if ($this->isVersion('2.18.0')) { $this->getServiceManager()->register(ActionService::SERVICE_ID, new ActionService()); $this->setVersion('2.19.0'); } if ($this->isVersion('2.19.0')) { try { $this->getServiceManager()->get(Queue::CONFIG_ID); } catch (ServiceNotFoundException $e) { $service = new SyncQueue([]); $service->setServiceManager($this->getServiceManager()); $this->getServiceManager()->register(Queue::CONFIG_ID, $service); } $this->setVersion('2.20.0'); } $this->skip('2.20.0', '2.29.1'); if ($this->isVersion('2.29.1')) { $this->getServiceManager()->register(FileReferenceSerializer::SERVICE_ID, new ResourceFileSerializer()); $this->setVersion('2.30.0'); } $this->skip('2.30.0', '2.31.6'); if ($this->isVersion('2.31.6')) { $complexSearch = new ComplexSearchService(array('shared' => array('search.query.query' => false, 'search.query.builder' => false, 'search.query.criterion' => false, 'search.tao.serialyser' => false, 'search.tao.result' => false), 'invokables' => array('search.query.query' => '\\oat\\search\\Query', 'search.query.builder' => '\\oat\\search\\QueryBuilder', 'search.query.criterion' => '\\oat\\search\\QueryCriterion', 'search.driver.postgres' => '\\oat\\search\\DbSql\\Driver\\PostgreSQL', 'search.driver.mysql' => '\\oat\\search\\DbSql\\Driver\\MySQL', 'search.driver.tao' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\driver\\TaoSearchDriver', 'search.tao.serialyser' => '\\oat\\search\\DbSql\\TaoRdf\\UnionQuerySerialyser', 'search.factory.query' => '\\oat\\search\\factory\\QueryFactory', 'search.factory.builder' => '\\oat\\search\\factory\\QueryBuilderFactory', 'search.factory.criterion' => '\\oat\\search\\factory\\QueryCriterionFactory', 'search.tao.gateway' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\GateWay', 'search.tao.result' => '\\oat\\generis\\model\\kernel\\persistence\\smoothsql\\search\\TaoResultSet'), 'abstract_factories' => array('\\oat\\search\\Command\\OperatorAbstractfactory'), 'services' => array('search.options' => array('table' => 'statements', 'driver' => 'taoRdf')))); $this->getServiceManager()->register(ComplexSearchService::SERVICE_ID, $complexSearch); $this->setVersion('3.0.0'); } $this->skip('3.0.0', '3.6.1'); if ($this->isVersion('3.6.1')) { $model = ModelManager::getModel(); if ($model instanceof \core_kernel_persistence_smoothsql_SmoothModel) { $model->setOption(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); ModelManager::setModel($model); } $this->setVersion('3.7.0'); } if ($this->isBetween('3.7.0', '3.8.3')) { /* @var $modelWrapper WrapperModel */ $modelWrapper = ModelManager::getModel(); if ($modelWrapper instanceof WrapperModel) { $inner = $modelWrapper->getInnerModel(); $inner->setOption(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); $workspace = $modelWrapper->getWorkspaceModel(); $workspace->setOption(core_kernel_persistence_smoothsql_SmoothModel::OPTION_SEARCH_SERVICE, ComplexSearchService::SERVICE_ID); $wrapedModel = WrapperModel::wrap($inner, $workspace); $wrapedModel->setServiceLocator($this->getServiceManager()); ModelManager::setModel($wrapedModel); } $this->setVersion('3.8.4'); } $this->skip('3.8.4', '3.8.5'); }
public function addTranslationsForLanguage(core_kernel_classes_Resource $language) { $langCode = $this->getCode($language); $rdf = ModelManager::getModel()->getRdfInterface(); $extensions = common_ext_ExtensionsManager::singleton()->getInstalledExtensions(); foreach ($extensions as $extension) { $pack = new RdfPack($langCode, $extension); foreach ($pack as $triple) { $rdf->add($triple); } } }
/** * * @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; }
* 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) 2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); * * */ use oat\taoOutcomeRds\model\RdsResultStorage; use oat\tao\scripts\update\OntologyUpdater; use oat\generis\model\kernel\persistence\file\FileModel; use oat\generis\model\data\ModelManager; use oat\tao\model\extension\ExtensionModel; $persistence = common_persistence_Manager::getPersistence('default'); $schema = $persistence->getDriver()->getSchemaManager()->createSchema(); $fromSchema = clone $schema; /** * @throws PDOException */ $tableResultsKv = $schema->dropTable(RdsResultStorage::RESULT_KEY_VALUE_TABLE_NAME); $tableVariables = $schema->dropTable(RdsResultStorage::VARIABLES_TABLENAME); $tableResults = $schema->dropTable(RdsResultStorage::RESULTS_TABLENAME); $queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema); foreach ($queries as $query) { $persistence->exec($query); } // remove statement entries for this extension $model = new ExtensionModel(common_ext_ExtensionsManager::singleton()->getExtensionById('taoOutcomeRds')); $modelRdf = ModelManager::getModel()->getRdfInterface(); foreach ($model as $triple) { $modelRdf->remove($triple); }
/** * (non-PHPdoc) * @see \oat\taoRevision\model\Repository::restore() */ public function restore(Revision $revision) { $resourceId = $revision->getResourceId(); $data = $this->getStorage()->getData($revision); $resource = new \core_kernel_classes_Resource($resourceId); $originFilesystemMap = CloneHelper::getPropertyStorageMap($resource->getRdfTriples()); DeleteHelper::deepDelete($resource); foreach (CloneHelper::deepCloneTriples($data, $originFilesystemMap) as $triple) { ModelManager::getModel()->getRdfInterface()->add($triple); } return true; }
/** * inserts the datamodels * specified in the Manifest * * @access protected * @author Jerome Bogaerts, <*****@*****.**> * @return void */ protected function installOntology() { $rdf = ModelManager::getModel()->getRdfInterface(); foreach ($this->getExtensionModel() as $triple) { $rdf->add($triple); } }
/** * Returns the submodel ids that are updatable * * @deprecated * @return array() */ public static function getUpdatableModelIds() { $model = ModelManager::getModel(); if (!$model instanceof self) { throw new common_exception_Error(__FUNCTION__ . ' called on ' . get_class($model) . ' model implementation'); } return $model->getWritableModels(); }
/** * @return \core_kernel_persistence_smoothsql_SmoothModel */ private function getModel() { return ModelManager::getModel(); }
/** * * @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'); }
/** * @return core_kernel_persistence_PropertyInterface */ private function getImplementation() { return ModelManager::getModel()->getRdfsInterface()->getPropertyImplementation(); }
public function run() { ModelManager::setModel(new \core_kernel_persistence_smoothsql_SmoothModel(array('persistence' => 'default'))); }
<?php /** * 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) 2014 (original work) Open Assessment Technologies SA; * * */ use oat\generisHard\models\HardModel; use oat\generis\model\data\ModelManager; ModelManager::setModel(new HardModel(array('persistence' => 'default')));
/** * * @throws \common_exception_InconsistentData * @return \core_kernel_persistence_smoothsql_SmoothModel */ private function getWorkspaceModel() { $model = ModelManager::getModel(); if (!$model instanceof WrapperModel) { throw new \common_exception_InconsistentData('Unexpected ontology model ' . get_class($model)); } $wsModel = $model->getWorkspaceModel(); if (!$wsModel instanceof \core_kernel_persistence_smoothsql_SmoothModel) { throw new \common_exception_InconsistentData('Unexpected workspace model' . get_class($wsModel)); } return $wsModel; }