PHP Class eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand

Inheritance: extends Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
Show file Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$actionSet
$bulkCount integer
$connection Doctrine\DBAL\Connection
$contentService eZ\Publish\API\Repository\ContentService
$nameSchemaResolver eZ\Publish\Core\Repository\Helper\NameSchemaService
$output Symfony\Component\Console\Output\OutputInterface
$urlAliasGateway eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway
$urlAliasHandler eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler

Protected Methods

Method Description
backupCustomLocationAliases ( ) Backups custom Location URL aliases the custom URL alias backup table.
backupGlobalAliases ( ) Backups global URL aliases the custom URL alias backup table.
checkStorage ( ) Checks that configured storage engine is Legacy Storage Engine.
combinePaths ( array $pathData ) : string[] Combines path data to an array of URL alias paths.
configure ( )
createCustomLocationUrlAliasBackupTable ( ) Creates database table for custom Location URL alias backup.
createGlobalUrlAliasBackupTable ( ) Creates database table for custom URL alias backup.
doBackupCustomLocationAliases ( ) Internal method for backing up custom Location URL aliases.
doBackupGlobalAliases ( ) Internal method for backing up global URL aliases.
doGenerateLocationAliases ( ) Internal method for generating URL aliases.
doRestoreCustomLocationAliases ( ) Restores custom Location URL aliases from the backup table.
doRestoreGlobalAliases ( ) Restores global URL aliases from the backup table.
execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
extractPathElements ( array $levelData ) : string[] Returns all path element strings found for the given path $levelData.
generateLocationAliases ( ) Generates URL aliases from the Location and Content data to the migration table.
getProgressBar ( integer $maxSteps ) : ProgressBar Returns configured progress bar helper.
getTotalBackupCount ( string $table ) : integer Return the number of rows in the given $table (on ID column).
getTotalLocationContentCount ( ) Returns total number of Content objects having a Location in the database.
getTotalLocationCount ( ) Returns total number of Locations in the database.
initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
isTableEmpty ( string $name ) : boolean Checks if database table $name is empty.
loadLocationData ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer $pass ) : array Loads Location data for the given $pass.
loadPassData ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer $pass ) : array Loads Location data for the given $pass.
publishAliases ( integer | string $locationId, integer | string $parentLocationId, integer | string $contentId ) : integer Publishes URL aliases in all languages for the given parameters.
restoreCustomLocationAliases ( ) Restores custom Location URL aliases from the backup table.
restoreGlobalAliases ( ) Restores global URL aliases from the backup table.
setDefaultTable ( ) Sets storage gateway to the default table.
setMigrationTable ( ) Sets storage gateway to the migration table.
storeCustomAliasPath ( integer $locationId, string $path, string $languageCode, boolean $alwaysAvailable, boolean $forwarding ) Stores custom URL alias data for $path to the backup table.
storeCustomAliases ( array $aliases ) : integer Stores given custom $aliases to the custom alias backup table.
storeGlobalAlias ( eZ\Publish\SPI\Persistence\Content\UrlAlias $alias ) : integer Stores given global URL $alias to the global URL alias backup table.
storeGlobalAliasPath ( string $resource, string $path, string $languageCode, boolean $alwaysAvailable, boolean $forwarding ) Stores global URL alias data for $path to the backup table.
tableExists ( string $name ) : boolean Checks if database table $name exists.

Method Details

backupCustomLocationAliases() protected method

Backups custom Location URL aliases the custom URL alias backup table.

backupGlobalAliases() protected method

Backups global URL aliases the custom URL alias backup table.
protected backupGlobalAliases ( )

checkStorage() protected method

Checks that configured storage engine is Legacy Storage Engine.
protected checkStorage ( )

combinePaths() protected method

Explanation: Custom Location and global URL aliases can generate NOP entries, which can be taken over by the autogenerated aliases. When multiple languages exists for the Location that took over, multiple entries with the same link will exist on the same level. In that case it will not be possible to reliably reconstruct what was the path for the original custom alias. For that reason we combine path data to get all possible path combinations. Note: it could happen that original NOP entry was historized after being taken over by the autogenerated alias. So to be complete this would have to take into account history entries as well, but at the moment we lack API to do that. Proper solution of this problem would be introducing separate database table to store custom/global URL alias data.
See also: https://jira.ez.no/browse/EZP-20777
protected combinePaths ( array $pathData ) : string[]
$pathData array
return string[]

configure() protected method

protected configure ( )

createCustomLocationUrlAliasBackupTable() protected method

Creates database table for custom Location URL alias backup.

createGlobalUrlAliasBackupTable() protected method

Creates database table for custom URL alias backup.

doBackupCustomLocationAliases() protected method

Internal method for backing up custom Location URL aliases.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::backupCustomLocationAliases()

doBackupGlobalAliases() protected method

Internal method for backing up global URL aliases.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::backupGlobalAliases()
protected doBackupGlobalAliases ( )

doGenerateLocationAliases() protected method

Internal method for generating URL aliases.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::generateLocationAliases()

doRestoreCustomLocationAliases() protected method

Restores custom Location URL aliases from the backup table.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::restoreCustomLocationAliases()

doRestoreGlobalAliases() protected method

Restores global URL aliases from the backup table.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::restoreGlobalAliases()
protected doRestoreGlobalAliases ( )

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

extractPathElements() protected method

Returns all path element strings found for the given path $levelData.
protected extractPathElements ( array $levelData ) : string[]
$levelData array
return string[]

generateLocationAliases() protected method

Generates URL aliases from the Location and Content data to the migration table.
protected generateLocationAliases ( )

getProgressBar() protected method

Returns configured progress bar helper.
protected getProgressBar ( integer $maxSteps ) : ProgressBar
$maxSteps integer
return Symfony\Component\Console\Helper\ProgressBar

getTotalBackupCount() protected method

Return the number of rows in the given $table (on ID column).
protected getTotalBackupCount ( string $table ) : integer
$table string
return integer

getTotalLocationContentCount() protected method

The number excludes absolute root Location, which does not have an URL alias.

getTotalLocationCount() protected method

The number excludes absolute root Location, which does not have an URL alias.
protected getTotalLocationCount ( )

initialize() protected method

protected initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

isTableEmpty() protected method

Checks if database table $name is empty.
protected isTableEmpty ( string $name ) : boolean
$name string
return boolean

loadLocationData() protected method

Loads Location data for the given $pass.
protected loadLocationData ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer $pass ) : array
$queryBuilder Doctrine\DBAL\Query\QueryBuilder
$pass integer
return array

loadPassData() protected method

Loads Location data for the given $pass.
protected loadPassData ( Doctrine\DBAL\Query\QueryBuilder $queryBuilder, integer $pass ) : array
$queryBuilder Doctrine\DBAL\Query\QueryBuilder
$pass integer
return array

publishAliases() protected method

Publishes URL aliases in all languages for the given parameters.
protected publishAliases ( integer | string $locationId, integer | string $parentLocationId, integer | string $contentId ) : integer
$locationId integer | string
$parentLocationId integer | string
$contentId integer | string
return integer

restoreCustomLocationAliases() protected method

Restores custom Location URL aliases from the backup table.

restoreGlobalAliases() protected method

Restores global URL aliases from the backup table.
protected restoreGlobalAliases ( )

setDefaultTable() protected method

Sets storage gateway to the default table.
See also: eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway::TABLE
protected setDefaultTable ( )

setMigrationTable() protected method

Sets storage gateway to the migration table.
See also: eZ\Bundle\EzPublishMigrationBundle\Command\LegacyStorage\RegenerateUrlAliasesCommand::MIGRATION_TABLE
protected setMigrationTable ( )

storeCustomAliasPath() protected method

Stores custom URL alias data for $path to the backup table.
protected storeCustomAliasPath ( integer $locationId, string $path, string $languageCode, boolean $alwaysAvailable, boolean $forwarding )
$locationId integer
$path string
$languageCode string
$alwaysAvailable boolean
$forwarding boolean

storeCustomAliases() protected method

Stores given custom $aliases to the custom alias backup table.
protected storeCustomAliases ( array $aliases ) : integer
$aliases array
return integer

storeGlobalAlias() protected method

Stores given global URL $alias to the global URL alias backup table.
protected storeGlobalAlias ( eZ\Publish\SPI\Persistence\Content\UrlAlias $alias ) : integer
$alias eZ\Publish\SPI\Persistence\Content\UrlAlias
return integer

storeGlobalAliasPath() protected method

Stores global URL alias data for $path to the backup table.
protected storeGlobalAliasPath ( string $resource, string $path, string $languageCode, boolean $alwaysAvailable, boolean $forwarding )
$resource string
$path string
$languageCode string
$alwaysAvailable boolean
$forwarding boolean

tableExists() protected method

Checks if database table $name exists.
protected tableExists ( string $name ) : boolean
$name string
return boolean

Property Details

$actionSet protected property

protected $actionSet

$bulkCount protected property

protected int $bulkCount
return integer

$connection protected property

protected Connection,Doctrine\DBAL $connection
return Doctrine\DBAL\Connection

$contentService protected property

protected ContentService,eZ\Publish\API\Repository $contentService
return eZ\Publish\API\Repository\ContentService

$nameSchemaResolver protected property

protected NameSchemaService,eZ\Publish\Core\Repository\Helper $nameSchemaResolver
return eZ\Publish\Core\Repository\Helper\NameSchemaService

$output protected property

protected OutputInterface,Symfony\Component\Console\Output $output
return Symfony\Component\Console\Output\OutputInterface

$urlAliasGateway protected property

protected Gateway,eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias $urlAliasGateway
return eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway

$urlAliasHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content\UrlAlias $urlAliasHandler
return eZ\Publish\SPI\Persistence\Content\UrlAlias\Handler