Skip to content

Commit

Permalink
Merge pull request #19 from sitegeist/feature/handleCloningFromNeos3To4
Browse files Browse the repository at this point in the history
TASK: Handle cloning from Neos 3 utf8 to Neos 4 utf8mb4 properly and apply setCharset
  • Loading branch information
mficzel authored May 8, 2018
2 parents 15c7353 + a838116 commit db8b987
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function executeLocalShellCommand($command, $arguments = [], $options
$this->outputLine($customizedCommand);
}
$customizedCommandResult = shell_exec($customizedCommand);
if (!in_array(self::HIDE_RESULT, $options)) {
if (is_string($customizedCommandResult) && !in_array(self::HIDE_RESULT, $options)) {
$this->outputLine($customizedCommandResult);
}
return $customizedCommandResult;
Expand Down
12 changes: 11 additions & 1 deletion Classes/Sitegeist/MagicWand/Command/CloneCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ public function remoteHostCommand(
$this->outputHeadLine('Clear Caches');
$this->executeLocalFlowCommand('flow:cache:flush');

##################
# Set DB charset #
##################
if ($this->databaseConfiguration['driver'] == 'pdo_mysql' && $remotePersistenceConfiguration['charset'] != 'utf8mb4') {
$this->outputHeadLine('Set DB charset');
$this->executeLocalFlowCommand('database:setcharset');
}

##############
# Migrate DB #
##############
Expand Down Expand Up @@ -358,7 +366,9 @@ protected function checkConfiguration($remotePersistenceConfiguration)
$this->outputLine(' only mysql is supported');
$this->quit(1);
}
if ($remotePersistenceConfiguration['charset'] != $this->databaseConfiguration['charset']) {
if (in_array($remotePersistenceConfiguration['charset'], ['utf8','utf8mb4']) && in_array($this->databaseConfiguration['charset'], ['utf8','utf8mb4'])) {
// we accept utf8 and utf8mb4 beeing similar enough
} else if ($remotePersistenceConfiguration['charset'] != $this->databaseConfiguration['charset']) {
$this->outputLine(' the databases have to use the same charset');
$this->quit(1);
}
Expand Down

0 comments on commit db8b987

Please sign in to comment.