src/Sulu/Bundle/PageBundle/Resources/phpcr-migrations/Version201511240844.php
private function upgradeExternalLinks($addScheme)
    {
        foreach ($this->localizationManager->getLocalizations() as $localization) {
            $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(
                sprintf(
                    'SELECT * FROM [nt:unstructured] WHERE [%s] = "%s"',
                    $this->propertyEncoder->localizedSystemName('nodeType', $localization->getLocale()),
                    RedirectType::EXTERNAL
                ),
                'JCR-SQL2'
            )->execute();

            $name = $this->propertyEncoder->localizedSystemName('external', $localization->getLocale());
            foreach ($rows->getNodes() as $node) {
                /** @var NodeInterface $node */
                $value = $node->getPropertyValue($name);

                if ($addScheme) {
                    $this->upgradeUrl($value);
                } else {
                    $this->downgradeUrl($value);
                }

                $node->setProperty($name, $value);
            }
        }
    }
private function upgradeExternalLinks($addScheme)
    {
        foreach ($this->localizationManager->getLocalizations() as $localization) {
            $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(
                sprintf(
                    'SELECT * FROM [nt:unstructured] WHERE [%s] = "%s"',
                    $this->propertyEncoder->localizedSystemName('nodeType', $localization->getLocale()),
                    RedirectType::EXTERNAL
                ),
                'JCR-SQL2'
            )->execute();

            $name = $this->propertyEncoder->localizedSystemName('external', $localization->getLocale());
            foreach ($rows->getNodes() as $node) {
                /** @var NodeInterface $node */
                $value = $node->getPropertyValue($name);

                if ($addScheme) {
                    $this->upgradeUrl($value);
                } else {
                    $this->downgradeUrl($value);
                }

                $node->setProperty($name, $value);
            }
        }
    }
private function upgradeExternalLinks ( $ addScheme ) { foreach ( $ this -> localizationManager -> getLocalizations ( ) as $ localization ) { $ rows = $ this -> session -> getWorkspace ( ) -> getQueryManager ( ) -> createQuery ( sprintf ( 'SELECT * FROM [nt:unstructured] WHERE [%s] = "%s"' , $ this -> propertyEncoder -> localizedSystemName ( 'nodeType' , $ localization -> getLocale ( ) ) , RedirectType :: EXTERNAL ) , 'JCR-SQL2' ) -> execute ( ) ; $ name = $ this -> propertyEncoder -> localizedSystemName ( 'external' , $ localization -> getLocale ( ) ) ; foreach ( $ rows -> getNodes ( ) as $ node ) { /** @var NodeInterface $node */ $ value = $ node -> getPropertyValue ( $ name ) ; if ( $ addScheme ) { $ this -> upgradeUrl ( $ value ) ; } else { $ this -> downgradeUrl ( $ value ) ; } $ node -> setProperty ( $ name , $ value ) ; } } }
External links are easily updated by fetching all nodes with the external redirect type, and add or remove the
scheme to the external property.

@param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise
External links are easily updated by fetching all nodes with the external redirect type and add or remove the scheme to the external property .