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
0aa83511
Commit
0aa83511
authored
9 years ago
by
Robin Appelman
Committed by
Roeland Jago Douma
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
remove old share propagation entries from appconfig
parent
d4a8d5d2
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/repair.php
+2
-0
2 additions, 0 deletions
lib/private/repair.php
lib/private/repair/sharepropagation.php
+52
-0
52 additions, 0 deletions
lib/private/repair/sharepropagation.php
tests/lib/repair/repairsharepropagation.php
+51
-0
51 additions, 0 deletions
tests/lib/repair/repairsharepropagation.php
with
105 additions
and
0 deletions
lib/private/repair.php
+
2
−
0
View file @
0aa83511
...
@@ -36,6 +36,7 @@ use OC\Repair\Collation;
...
@@ -36,6 +36,7 @@ use OC\Repair\Collation;
use
OC\Repair\DropOldJobs
;
use
OC\Repair\DropOldJobs
;
use
OC\Repair\OldGroupMembershipShares
;
use
OC\Repair\OldGroupMembershipShares
;
use
OC\Repair\RemoveGetETagEntries
;
use
OC\Repair\RemoveGetETagEntries
;
use
OC\Repair\SharePropagation
;
use
OC\Repair\SqliteAutoincrement
;
use
OC\Repair\SqliteAutoincrement
;
use
OC\Repair\DropOldTables
;
use
OC\Repair\DropOldTables
;
use
OC\Repair\FillETags
;
use
OC\Repair\FillETags
;
...
@@ -114,6 +115,7 @@ class Repair extends BasicEmitter {
...
@@ -114,6 +115,7 @@ class Repair extends BasicEmitter {
new
RemoveGetETagEntries
(
\OC
::
$server
->
getDatabaseConnection
()),
new
RemoveGetETagEntries
(
\OC
::
$server
->
getDatabaseConnection
()),
new
UpdateOutdatedOcsIds
(
\OC
::
$server
->
getConfig
()),
new
UpdateOutdatedOcsIds
(
\OC
::
$server
->
getConfig
()),
new
RepairInvalidShares
(
\OC
::
$server
->
getConfig
(),
\OC
::
$server
->
getDatabaseConnection
()),
new
RepairInvalidShares
(
\OC
::
$server
->
getConfig
(),
\OC
::
$server
->
getDatabaseConnection
()),
new
SharePropagation
(
\OC
::
$server
->
getConfig
()),
];
];
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/private/repair/sharepropagation.php
0 → 100644
+
52
−
0
View file @
0aa83511
<?php
/**
* @author Georg Ehrke <georg@owncloud.com>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace
OC\Repair
;
use
OC\Hooks\BasicEmitter
;
use
OCP\IConfig
;
class
SharePropagation
extends
BasicEmitter
implements
\OC\RepairStep
{
/** @var IConfig */
private
$config
;
/**
* SharePropagation constructor.
*
* @param IConfig $config
*/
public
function
__construct
(
IConfig
$config
)
{
$this
->
config
=
$config
;
}
public
function
getName
()
{
return
'Remove old share propagation app entries'
;
}
public
function
run
()
{
$keys
=
$this
->
config
->
getAppKeys
(
'files_sharing'
);
foreach
(
$keys
as
$key
)
{
if
(
is_numeric
(
$key
))
{
$this
->
config
->
deleteAppValue
(
'files_sharing'
,
$key
);
}
}
}
}
This diff is collapsed.
Click to expand it.
tests/lib/repair/repairsharepropagation.php
0 → 100644
+
51
−
0
View file @
0aa83511
<?php
/**
* Copyright (c) 2016 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
Test\Repair
;
use
OC\Repair\SharePropagation
;
class
RepairSharePropagation
extends
\Test\TestCase
{
public
function
keyProvider
()
{
return
[
[[
'1'
,
'2'
],
[
'1'
,
'2'
]],
[[
'1'
,
'2'
,
'foo'
],
[
'1'
,
'2'
]],
[[
'foo'
],
[]],
];
}
/**
* @dataProvider keyProvider
* @param array $startKeys
* @param array $expectedRemovedKeys
*/
public
function
testRemovePropagationEntries
(
array
$startKeys
,
array
$expectedRemovedKeys
)
{
/** @var \PHPUnit_Framework_MockObject_MockObject|\OCP\IConfig $config */
$config
=
$this
->
getMock
(
'\OCP\IConfig'
);
$config
->
expects
(
$this
->
once
())
->
method
(
'getAppKeys'
)
->
with
(
'files_sharing'
)
->
will
(
$this
->
returnValue
(
$startKeys
));
$removedKeys
=
[];
$config
->
expects
(
$this
->
any
())
->
method
(
'deleteAppValue'
)
->
will
(
$this
->
returnCallback
(
function
(
$app
,
$key
)
use
(
&
$removedKeys
)
{
$removedKeys
[]
=
$key
;
}));
$step
=
new
SharePropagation
(
$config
);
$step
->
run
();
sort
(
$expectedRemovedKeys
);
sort
(
$removedKeys
);
$this
->
assertEquals
(
$expectedRemovedKeys
,
$removedKeys
);
}
}
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