Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| common_ext_GenerisInstaller | |
0.00% |
0 / 17 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
| install | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 | |||
| setupSchema | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| getPersistenceManager | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung |
| 19 | * (under the project TAO-TRANSFER); |
| 20 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 21 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 22 | * 2013-2020 (update and modification) Open Assessment Technologies SA; |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | use oat\generis\persistence\PersistenceManager; |
| 27 | use oat\generis\model\data\Ontology; |
| 28 | use oat\generis\persistence\sql\SchemaProviderInterface; |
| 29 | use oat\oatbox\extension\exception\ManifestNotFoundException; |
| 30 | use oat\oatbox\cache\SimpleCache; |
| 31 | |
| 32 | /** |
| 33 | * Custom extension installer for generis |
| 34 | * |
| 35 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 36 | * @package generis |
| 37 | * |
| 38 | */ |
| 39 | class common_ext_GenerisInstaller extends common_ext_ExtensionInstaller |
| 40 | { |
| 41 | /** |
| 42 | * Setup the ontology configuration |
| 43 | * |
| 44 | * @throws common_Exception |
| 45 | * @throws common_ext_ExtensionException |
| 46 | * @throws common_ext_InstallationException |
| 47 | * @throws ManifestNotFoundException |
| 48 | */ |
| 49 | public function install() |
| 50 | { |
| 51 | if ($this->extension->getId() != 'generis') { |
| 52 | throw new common_ext_ExtensionException( |
| 53 | 'Tried to install "' . $this->extension->getId() . '" extension using the GenerisInstaller' |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | $this->installLoadDefaultConfig(); |
| 58 | $this->setupSchema(); |
| 59 | $this->installOntology(); |
| 60 | $this->installRegisterExt(); |
| 61 | |
| 62 | $this->getServiceManager()->get(SimpleCache::SERVICE_ID)->clear(); |
| 63 | |
| 64 | $this->log('d', 'Installing custom script for extension ' . $this->extension->getId()); |
| 65 | $this->installCustomScript(); |
| 66 | } |
| 67 | |
| 68 | public function setupSchema() |
| 69 | { |
| 70 | $schemaCollection = $this->getPersistenceManager()->getSqlSchemas(); |
| 71 | $ontology = $this->getServiceManager()->get(Ontology::SERVICE_ID); |
| 72 | if ($ontology instanceof SchemaProviderInterface) { |
| 73 | $ontology->provideSchema($schemaCollection); |
| 74 | } |
| 75 | $this->getPersistenceManager()->applySchemas($schemaCollection); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @return PersistenceManager |
| 80 | */ |
| 81 | protected function getPersistenceManager() |
| 82 | { |
| 83 | return $this->getServiceManager()->get(PersistenceManager::SERVICE_ID); |
| 84 | } |
| 85 | } |