tao-test/app/taoQtiItem/install/scripts/addValidationSettings.php

33 lines
1.0 KiB
PHP
Raw Normal View History

2022-08-29 20:14:13 +02:00
<?php
namespace oat\taoQtiItem\install\scripts;
use oat\oatbox\service\ServiceManager;
use oat\taoQtiItem\model\ValidationService;
class addValidationSettings extends \common_ext_action_InstallAction
{
public function __invoke($params)
{
$this->setServiceLocator(ServiceManager::getServiceManager());
$serviceManager = $this->getServiceManager();
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem');
if ($ext->hasConfig('contentValidation')) {
$ext->unsetConfig('contentValidation');
}
if ($ext->hasConfig('manifestValidation')) {
$ext->unsetConfig('manifestValidation');
}
//Set Validation service
$validationService = new ValidationService();
$validationService->setServiceManager($serviceManager);
$serviceManager->register(ValidationService::SERVICE_ID, $validationService);
return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Validation service has been successfully set up');
}
}