/** * @expectedException \eZ\Publish\Core\MVC\Exception\ParameterNotFoundException */ public function testGetNonExistentParameter() { $paramName = 'Foo.Bar'; $namespace = 'foo'; $this->legacyKernel->expects($this->once())->method('runCallback')->will($this->throwException(new ParameterNotFoundException($paramName, "{$namespace}.ini"))); $this->resolver->getParameter($paramName, $namespace); }
public function init() { // Ensure that persistence cache purger is disabled as legacy cache will be cleared by legacy setup wizard while // everything is not ready yet to clear SPI cache (no connection to repository yet). $this->persistenceCachePurger->setEnabled(false); // we disable injection of settings to Legacy Kernel during setup $this->kernelFactory->setBuildEventsEnabled(false); /** @var $request \Symfony\Component\HttpFoundation\ParameterBag */ $request = $this->container->get('request')->request; // inject the extra ezpublish-community folders we want permissions checked for switch ($request->get('eZSetup_current_step')) { case "Welcome": case "SystemCheck": $this->getLegacyKernel()->runCallback(function () { eZINI::injectSettings(array("setup.ini" => array("directory_permissions" => array("CheckList" => "../ezpublish/logs;../ezpublish/cache;../ezpublish/config;" . eZINI::instance('setup.ini')->variable('directory_permissions', 'CheckList'))))); }); } $response = new Response(); $response->setContent($this->getLegacyKernel()->run()->getContent()); // After the latest step, we can re-use both POST data and written INI settings // to generate a local ezpublish_<env>.yml // Clear INI cache since setup has written new files $this->getLegacyKernel()->runCallback(function () { eZINI::injectSettings(array()); eZCache::clearByTag('ini'); eZINI::resetAllInstances(); }); // Check that eZ Publish Legacy was actually installed, since one step can run several steps if ($this->legacyConfigResolver->getParameter('SiteAccessSettings.CheckValidity') == 'false') { // If using kickstart.ini, legacy wizard will artificially create entries in $_POST // and in this case Symfony Request is not aware of them. // We then add them manually to the ParameterBag. if (!$request->has('P_chosen_site_package-0')) { $request->add($_POST); } $chosenSitePackage = $request->get('P_chosen_site_package-0'); // match mode (host, url or port) switch ($request->get('P_site_extra_data_access_type-' . $chosenSitePackage)) { case "hostname": case "port": $adminSiteaccess = $chosenSitePackage . '_admin'; break; case "url": $adminSiteaccess = $request->get('P_site_extra_data_admin_access_type_value-' . $chosenSitePackage); } /** @var $configurationDumper \eZ\Bundle\EzpublishLegacyBundle\SetupWizard\ConfigurationDumper */ $configurationDumper = $this->container->get('ezpublish_legacy.setup_wizard.configuration_dumper'); $configurationDumper->addEnvironment($this->container->get('kernel')->getEnvironment()); $configurationDumper->dump($this->container->get('ezpublish_legacy.setup_wizard.configuration_converter')->fromLegacy($chosenSitePackage, $adminSiteaccess), ConfigDumperInterface::OPT_BACKUP_CONFIG); } return $response; }
/** * Returns the value of the legacy parameter $parameterName in $groupName. * If $file and $siteaccess are null, the global value is fetched with the * legacy resolver. * * @param string $groupName * @param string $parameterName * @param string|null $file * @param string|null $siteaccess * * @return array */ public function getParameter($groupName, $parameterName, $file = null, $siteaccess = null) { if ($file === null && $siteaccess === null) { // in this case we want the "global" value, no need to use the // legacy kernel, the legacy resolver is enough return $this->legacyResolver->getParameter("{$groupName}.{$parameterName}"); } return $this->legacyKernel->runCallback(function () use($file, $groupName, $parameterName, $siteaccess) { // @todo: do reset injected settings everytime // and make sure to restore the previous injected settings eZINI::injectSettings(array()); return eZSiteAccess::getIni($siteaccess, $file)->variable($groupName, $parameterName); }, false, false); }