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
4a727a57
Commit
4a727a57
authored
7 years ago
by
Robin Appelman
Committed by
Morris Jobke
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use a generator instead of fetching all rows at once
Signed-off-by:
Robin Appelman
<
robin@icewind.nl
>
parent
598835b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/Repair/NC13/RepairInvalidPaths.php
+9
-2
9 additions, 2 deletions
lib/private/Repair/NC13/RepairInvalidPaths.php
with
9 additions
and
2 deletions
lib/private/Repair/NC13/RepairInvalidPaths.php
+
9
−
2
View file @
4a727a57
...
...
@@ -60,7 +60,10 @@ class RepairInvalidPaths implements IRepairStep {
))
->
where
(
$builder
->
expr
()
->
neq
(
'f.path'
,
$computedPath
));
return
$query
->
execute
()
->
fetchAll
();
$result
=
$query
->
execute
();
while
(
$row
=
$result
->
fetch
())
{
yield
$row
;
}
}
private
function
getId
(
$storage
,
$path
)
{
...
...
@@ -103,8 +106,11 @@ class RepairInvalidPaths implements IRepairStep {
}
private
function
repair
()
{
$this
->
connection
->
beginTransaction
();
$entries
=
$this
->
getInvalidEntries
();
$count
=
0
;
foreach
(
$entries
as
$entry
)
{
$count
++
;
$calculatedPath
=
$entry
[
'parent_path'
]
.
'/'
.
$entry
[
'name'
];
if
(
$newId
=
$this
->
getId
(
$entry
[
'storage'
],
$calculatedPath
))
{
// a new entry with the correct path has already been created, reuse that one and delete the incorrect entry
...
...
@@ -114,7 +120,8 @@ class RepairInvalidPaths implements IRepairStep {
$this
->
update
(
$entry
[
'fileid'
],
$calculatedPath
);
}
}
return
count
(
$entries
);
$this
->
connection
->
commit
();
return
$count
;
}
public
function
run
(
IOutput
$output
)
{
...
...
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