Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
15bbe021
Unverified
Commit
15bbe021
authored
8 years ago
by
Joas Schilling
Committed by
Morris Jobke
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ignore failures of collation change in the pre update step
Signed-off-by:
Joas Schilling
<
coding@schilljs.com
>
parent
d0a3d179
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/Repair.php
+2
-1
2 additions, 1 deletion
lib/private/Repair.php
lib/private/Repair/Collation.php
+28
-10
28 additions, 10 deletions
lib/private/Repair/Collation.php
with
30 additions
and
11 deletions
lib/private/Repair.php
+
2
−
1
View file @
15bbe021
...
...
@@ -129,6 +129,7 @@ class Repair implements IOutput{
*/
public
static
function
getRepairSteps
()
{
return
[
new
Collation
(
\OC
::
$server
->
getConfig
(),
\OC
::
$server
->
getLogger
(),
\OC
::
$server
->
getDatabaseConnection
(),
false
),
new
RepairMimeTypes
(
\OC
::
$server
->
getConfig
()),
new
RepairLegacyStorages
(
\OC
::
$server
->
getConfig
(),
\OC
::
$server
->
getDatabaseConnection
()),
new
AssetCache
(),
...
...
@@ -179,7 +180,7 @@ class Repair implements IOutput{
$connection
=
\OC
::
$server
->
getDatabaseConnection
();
$steps
=
[
new
InnoDB
(),
new
Collation
(
\OC
::
$server
->
getConfig
(),
$connection
),
new
Collation
(
\OC
::
$server
->
getConfig
(),
\OC
::
$server
->
getLogger
(),
$connection
,
true
),
new
SqliteAutoincrement
(
$connection
),
new
SearchLuceneTables
(),
];
...
...
This diff is collapsed.
Click to expand it.
lib/private/Repair/Collation.php
+
28
−
10
View file @
15bbe021
...
...
@@ -24,28 +24,38 @@
namespace
OC\Repair
;
use
Doctrine\DBAL\Exception\DriverException
;
use
Doctrine\DBAL\Platforms\MySqlPlatform
;
use
OCP\IConfig
;
use
OCP\IDBConnection
;
use
OCP\ILogger
;
use
OCP\Migration\IOutput
;
use
OCP\Migration\IRepairStep
;
class
Collation
implements
IRepairStep
{
/**
* @var \OCP\IConfig
*/
/** @var IConfig */
protected
$config
;
/**
* @var \OC\DB\Connection
*/
/** @var ILogger */
protected
$logger
;
/** @var IDBConnection */
protected
$connection
;
/** @var bool */
protected
$ignoreFailures
;
/**
* @param \OCP\IConfig $config
* @param \OC\DB\Connection $connection
* @param IConfig $config
* @param ILogger $logger
* @param IDBConnection $connection
* @param bool $ignoreFailures
*/
public
function
__construct
(
$config
,
$connection
)
{
public
function
__construct
(
IConfig
$config
,
ILogger
$logger
,
IDBConnection
$connection
,
$ignoreFailures
)
{
$this
->
connection
=
$connection
;
$this
->
config
=
$config
;
$this
->
logger
=
$logger
;
$this
->
ignoreFailures
=
$ignoreFailures
;
}
public
function
getName
()
{
...
...
@@ -67,7 +77,15 @@ class Collation implements IRepairStep {
foreach
(
$tables
as
$table
)
{
$output
->
info
(
"Change collation for
$table
..."
);
$query
=
$this
->
connection
->
prepare
(
'ALTER TABLE `'
.
$table
.
'` CONVERT TO CHARACTER SET '
.
$characterSet
.
' COLLATE '
.
$characterSet
.
'_bin;'
);
$query
->
execute
();
try
{
$query
->
execute
();
}
catch
(
DriverException
$e
)
{
// Just log this
$this
->
logger
->
logException
(
$e
);
if
(
!
$this
->
ignoreFailures
)
{
throw
$e
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment