Repository navigation
Add a repair step to clean up orphan tags and tag entries - #13344
Conversation
|
Nice one. Please add unit tests for the different cases 😄 |
There was a problem hiding this comment.
Btw the method is missing from OCP\IDBConnection should be added, or is that intentional?
There was a problem hiding this comment.
hmm - it will expose a 3rdparty interface and you all know my intention on this.
let's keep it for now and see how far we get with the querybuild in the next weeks - from my pov we even might want to write a wrapper which takes care about proper quoting for table and column names.
so 👎 for at least 8.0
Thanks for bringing this up!
There was a problem hiding this comment.
This is potentially a dangerous actions.
Now $items may not contain any user controllable input. But as soon as it does this may potentially lead to a SQL injection.
This needs either to get parameterized (not sure if possible here) or you need to verify the type.
See:
foreach ($orphanItemsBatch as $items) {
$items = [0 => "3); INSERT INTO `oc_users` VALUES ('inject', 'inject', 'inject'); #"];
$qb->delete('`' . $deleteTable . '`')
->where($qb->expr()->in('`' . $deleteId . '`', $items));
var_dump($qb->getSQL());
$qb->execute();
exit();
}There was a problem hiding this comment.
Especially considering that people are fans of copying code fragements here – I'd prefer a failsafe example that makes shooting yourself in your knee hard.
1018749 to
c7c9b6d
Compare
|
@PVince81 @LukasReschke added tests |
c7c9b6d to
a22068c
Compare
|
Refer to this link for build results (access rights to CI server needed): |
|
👍 |
|
The inspection completed: 8 new issues, 14 updated code elements |
|
Works 👍 |
…irstep Add a repair step to clean up orphan tags and tag entries
There was a problem hiding this comment.
tables and column names have to be quoted
@PVince81
Fix #13334
We could even setup a Background job for this Repairstep, so it is cleaned once in a while, before growing to big.