Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
218 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/Mapbender/CoreBundle/Command/DatabaseUpgradeCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace Mapbender\CoreBundle\Command; | ||
|
||
use Doctrine\ORM\EntityManager; | ||
use Mapbender\CoreBundle\Entity\Element; | ||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Helper\ProgressBar; | ||
|
||
/** | ||
* Class DatabaseUpgradeCommand | ||
* | ||
*/ | ||
class DatabaseUpgradeCommand extends ContainerAwareCommand { | ||
|
||
protected function configure() { | ||
$this | ||
->setHelp('The <info>mapbender:database:upgrade</info> command updates the Datesbase to the new schema of mapbender version 3.0.6') | ||
->setName('mapbender:database:upgrade') | ||
->setDescription('Updates database scheme'); | ||
} | ||
|
||
|
||
/** | ||
* Execute command | ||
* @Todo Add logic to execute different action depended on the used MB3 Version | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* @return int|null|void | ||
*/ | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) { | ||
$this->changeMapsImagePath($input, $output); | ||
} | ||
|
||
/** | ||
* Change imagesPath configuration value from all MB3 map elements in the database | ||
* from "bundles/mapbendercore/mapquery/lib/openlayers/img" | ||
* to "components/mapquery/lib/openlayers/img" | ||
*/ | ||
protected function changeMapsImagePath(InputInterface $input, OutputInterface $output){ | ||
|
||
/** | ||
* @var EntityManager $em | ||
* @var Element $map | ||
*/ | ||
$doctrine=$this->getContainer()->get('doctrine'); | ||
$em = $doctrine->getManager(); | ||
$maps = $em->getRepository('MapbenderCoreBundle:Element')->findBy(array('class'=>'Mapbender\CoreBundle\Element\Map')); | ||
$output->writeln('Updating map elements image path values'); | ||
$output->writeln('Found ' . count($maps) . ' map elements'); | ||
$progressBar = new ProgressBar($output, count($maps) ); | ||
foreach ($maps as $map) { | ||
$config = $map->getConfiguration(); | ||
$progressBar->advance(); | ||
if ($config['imgPath'] == 'bundles/mapbendercore/mapquery/lib/openlayers/img') { | ||
$progressBar->setMessage('Found old image path'); | ||
$config['imgPath']= 'components/mapquery/lib/openlayers/img'; | ||
$map->setConfiguration($config); | ||
$em->persist($map); | ||
$progressBar->setMessage('Old image path successfully changed'); | ||
} else { | ||
$progressBar->setMessage('Map element already up-to-date'); | ||
} | ||
} | ||
$em->flush(); | ||
$progressBar->finish(); | ||
$output->writeln(''); | ||
$output->writeln('All image path values are now up-to-date'); | ||
$output->writeln('Exiting now'); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mb: | |
popup: | ||
btn: | ||
ok: Schließen | ||
print: Drucken | ||
class: | ||
title: Information | ||
description: Information | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mb: | |
popup: | ||
btn: | ||
ok: Close | ||
print: Print | ||
class: | ||
title: FeatureInfo | ||
description: FeatureInfo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mb: | |
popup: | ||
btn: | ||
ok: Cerrar | ||
print: Imprimir | ||
class: | ||
title: FeatureInfo | ||
description: FeatureInfo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mb: | |
popup: | ||
btn: | ||
ok: Fechar | ||
print: Imprimir | ||
class: | ||
title: Informação | ||
description: Informação | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ mb: | |
popup: | ||
btn: | ||
ok: Закрыть | ||
print: Печать | ||
class: | ||
title: Инфосвойства | ||
description: Инфосвойства | ||
|
1 change: 1 addition & 0 deletions
1
src/Mapbender/CoreBundle/Resources/views/Element/featureinfo.json.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"mb.core.metadata.popup.title": "{{ "mb.core.metadata.popup.title" | trans }}", | ||
"mb.core.featureinfo.popup.btn.ok": "{{ "mb.core.featureinfo.popup.btn.ok" | trans }}", | ||
"mb.core.featureinfo.popup.btn.print": "{{ "mb.core.featureinfo.popup.btn.print" | trans }}", | ||
"mb.core.featureinfo.error.nolayer": "{{"mb.core.featureinfo.error.nolayer" | trans}}", | ||
"mb.core.featureinfo.error.noresult": "{{"mb.core.featureinfo.error.noresult" | trans}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.