-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update occ files:repair-tree command to also handle cases where the parent is -1 when it shouldn't be #39231
Conversation
…arent is -1 when it shouldn't be Signed-off-by: Robin Appelman <robin@icewind.nl>
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested
return 0; | ||
} | ||
|
||
private function repairParent(bool $fix, OutputInterface $output) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private function repairParent(bool $fix, OutputInterface $output) { | |
private function repairParent(bool $fix, OutputInterface $output): void { |
'fileid' => $row['fileid'], | ||
'parent' => $row['parent_id'], | ||
]); | ||
$query->execute(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$query->execute(); | |
$query->executeStatement(); |
} | ||
|
||
$query = $this->connection->getQueryBuilder(); | ||
$query->update('filecache') | ||
->set('parent', $query->createParameter('parent')) | ||
->where($query->expr()->eq('fileid', $query->createParameter('fileid'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
$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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return $query->execute()->fetchAll(); | |
return $query->executeQuery()->fetchAll(); |
$query->expr()->eq('f.storage', 'p.storage') | ||
)) | ||
->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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return $query->execute()->fetchAll(); | |
return $query->executeQuery()->fetchAll(); |
items should only have a parent of
-1
when the path is''
. This adds some logic to determine the proper parent id to repair the invalid items.