Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion common/ext/class.ExtensionInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ public function install()

}
common_Logger::d('Extended install for extension ' . $this->extension->getId());


/**
*
*/
$this->installRoutes();
// Method to be overriden by subclasses
// to extend the installation mechanism.
$this->extendedInstall();
Expand All @@ -109,6 +113,57 @@ public function install()

}

public function installRoutes() {
$extRoute = $this->extension->getManifest()->getRoutes();
$tao = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
if($tao->hasConfig('application')) {
$app = $tao->getConfig('application');
$routes = $app->getOption('routes');
foreach ($extRoute as $routeId => $routeData) {

$route = [
'ext' => $this->extension->getId(),
'className' => '',
'preProcess' => [],
'process' => [],
'postProcess' => [],
'errorHandler' => '',
'options' => [],

];

if (is_string($routeData)) {

$route['className'] = \oat\tao\model\routing\NamespaceRoute::class;
$route['options'] = [\oat\tao\model\routing\NamespaceRoute::OPTION_NAMESPACE => $routeData];

} else {
if (!isset($routeData['class']) || !is_subclass_of($routeData['class'], 'oat\tao\model\routing\Route')) {
throw new \common_exception_InconsistentData('Invalid route '.$routeId);
}
$route['className'] = $routeData['class'];
$route['options'] = array_key_exists( 'options' , $routeData )? $routeData['options']: [];
}
$routes[] = $route;
}
if (empty($extRoute)) {
$routes[] = [
'ext' => $this->extension->getId(),
'className' => \oat\tao\model\routing\LegacyRoute::class,
'preProcess' => [],
'process' => [],
'postProcess' => [],
'errorHandler' => '',
'options' => [],

];
}
$app->setOption('routes' , $routes);
$tao->setConfig('application', $app);

}
}

/**
* writes the config based on the config.sample
*
Expand Down
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'label' => 'Core',
'description' => 'Core extension, provide the low level framework and an API to manage ontologies',
'license' => 'GPL-2.0',
'version' => '3.29.1',
'version' => '3.30.0',
'author' => 'Open Assessment Technologies, CRP Henri Tudor',
'requires' => array(),
'models' => array(
Expand Down
2 changes: 1 addition & 1 deletion scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function update($initialVersion) {
}
$this->setVersion('3.28.0');
}
$this->skip('3.28.0', '3.29.1');
$this->skip('3.28.0', '3.30.0');
}

private function getReadableModelIds() {
Expand Down