update occ files:repair-tree command to also handle cases where the parent is -1 when it shouldn't be#39231
Closed
icewind1991 wants to merge 1 commit intomasterfrom
Closed
update occ files:repair-tree command to also handle cases where the parent is -1 when it shouldn't be#39231icewind1991 wants to merge 1 commit intomasterfrom
icewind1991 wants to merge 1 commit intomasterfrom
Conversation
…arent is -1 when it shouldn't be Signed-off-by: Robin Appelman <[email protected]>
| return 0; | ||
| } | ||
|
|
||
| private function repairParent(bool $fix, OutputInterface $output) { |
Check notice
Code scanning / Psalm
MissingReturnType
| 'fileid' => $row['fileid'], | ||
| 'parent' => $row['parent_id'], | ||
| ]); | ||
| $query->execute(); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| } | ||
| } | ||
|
|
||
| private function repairPaths(bool $fix, OutputInterface $output) { |
Check notice
Code scanning / Psalm
MissingReturnType
| )) | ||
| ->andWhere($query->expr()->neq('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); | ||
|
|
||
| return $query->execute()->fetchAll(); |
Check notice
Code scanning / Psalm
DeprecatedMethod
| )) | ||
| ->andWhere($query->expr()->neq('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); | ||
|
|
||
| return $query->execute()->fetchAll(); |
Check notice
Code scanning / Psalm
PossiblyInvalidMethodCall
come-nc
reviewed
Jul 17, 2023
| return 0; | ||
| } | ||
|
|
||
| private function repairParent(bool $fix, OutputInterface $output) { |
Contributor
There was a problem hiding this comment.
Suggested change
| private function repairParent(bool $fix, OutputInterface $output) { | |
| private function repairParent(bool $fix, OutputInterface $output): void { |
| 'fileid' => $row['fileid'], | ||
| 'parent' => $row['parent_id'], | ||
| ]); | ||
| $query->execute(); |
Contributor
There was a problem hiding this comment.
Suggested change
| $query->execute(); | |
| $query->executeStatement(); |
Comment on lines
+72
to
+77
| } | ||
|
|
||
| $query = $this->connection->getQueryBuilder(); | ||
| $query->update('filecache') | ||
| ->set('parent', $query->createParameter('parent')) | ||
| ->where($query->expr()->eq('fileid', $query->createParameter('fileid'))); |
Contributor
There was a problem hiding this comment.
Suggested change
| } | |
| $query = $this->connection->getQueryBuilder(); | |
| $query->update('filecache') | |
| ->set('parent', $query->createParameter('parent')) | |
| ->where($query->expr()->eq('fileid', $query->createParameter('fileid'))); | |
| $query = $this->connection->getQueryBuilder(); | |
| $query->update('filecache') | |
| ->set('parent', $query->createParameter('parent')) | |
| ->where($query->expr()->eq('fileid', $query->createParameter('fileid'))); | |
| } |
The query is only used for fixing, no?
| } | ||
| } | ||
|
|
||
| private function repairPaths(bool $fix, OutputInterface $output) { |
Contributor
There was a problem hiding this comment.
Suggested change
| private function repairPaths(bool $fix, OutputInterface $output) { | |
| private function repairPaths(bool $fix, OutputInterface $output): void { |
| )) | ||
| ->andWhere($query->expr()->neq('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); | ||
|
|
||
| return $query->execute()->fetchAll(); |
Contributor
There was a problem hiding this comment.
Suggested change
| return $query->execute()->fetchAll(); | |
| return $query->executeQuery()->fetchAll(); |
| ->where($query->expr()->neq('f.path_hash', $query->createNamedParameter(md5('')))) | ||
| ->andWhere($query->expr()->eq('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); | ||
|
|
||
| return $query->execute()->fetchAll(); |
Contributor
There was a problem hiding this comment.
Suggested change
| return $query->execute()->fetchAll(); | |
| return $query->executeQuery()->fetchAll(); |
Merged
This was referenced Mar 12, 2024
Merged
Merged
Merged
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
items should only have a parent of
-1when the path is''. This adds some logic to determine the proper parent id to repair the invalid items.