-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add a command to poll incoming federated shares for updates #34903
Conversation
da39051
to
a3b3bd8
Compare
@PVince81 Won't you mind a quick preliminary review? |
Codecov Report
@@ Coverage Diff @@
## master #34903 +/- ##
============================================
- Coverage 65.34% 65.34% -0.01%
- Complexity 18492 18505 +13
============================================
Files 1208 1209 +1
Lines 69983 70028 +45
Branches 1280 1280
============================================
+ Hits 45732 45761 +29
- Misses 23879 23895 +16
Partials 372 372
Continue to review full report at Codecov.
|
a3b3bd8
to
3ba7264
Compare
This is documenation relevant because it is a new command ! |
486c85e
to
b13e469
Compare
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.
See comments
->from('share_external') | ||
->where($qb->expr()->eq('accepted', $qb->expr()->literal('1'))); | ||
|
||
return $qb->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.
would this cursor lock the table for any further concurrent updates ?
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.
this is just an ordinary SELECT DISTINCT
query, so I don't think so
b13e469
to
53b43c9
Compare
/** | ||
* @return \Doctrine\DBAL\Driver\Statement | ||
*/ | ||
protected function getCursor() { |
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.
Move this to the FederatedShareProvider
? It should be fine to inject the provider directly in order to use a public method that isn't in the interface.
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.
My taste tells me that it should stay here.
Could be moved to the provider but it needs to be renamed into getUniqueRecipients
and return them as an array of uids (and this array may be huuuge)
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.
If you don't want to leak DB stuff, you may return a generator instead of an array. As long as it's clear that the function returns a generator of uids I think it's fine.
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.
I think the current code is good enough
$storage = $mount->getStorage(); | ||
$this->refreshStorageRoot($storage); | ||
} catch (\Exception $e) { | ||
$output->writeln($e->getMessage()); |
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.
Problem here, is exceptions never get logged and since this command is designed probably to run in cron, will go unnoticed. Would suggest to log as well.
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.
@tomneedham at least some of them are logged by the dav app:
deo@reborn:~/public_html/oc-master> rm data/owncloud.log
deo@reborn:~/public_html/oc-master> php occ incoming-shares:poll
Sabre\HTTP\ClientHttpException: Unauthorized
deo@reborn:~/public_html/oc-master> cat data/owncloud.log
{"reqId":"0jcYYTjvA7asrGLBtk0R","level":3,"time":"2019-03-29T10:07:45+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"--","url":"--","message":"Exception: {\"Exception\":\"Sabre\\\\HTTP\\\\ClientHttpException\",\"Message\":\"Unauthorized\",\"Code\":401,\"Trace\":\"#0 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Client.php(232): Sabre\\\\HTTP\\\\Client->send(Object(Sabre\\\\HTTP\\\\Request))\\n#1 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(259): Sabre\\\\DAV\\\\Client->propFind('http:\\\/\\\/localhos...', Array)\\n#2 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(579): OC\\\\Files\\\\Storage\\\\DAV->propfind('')\\n#3 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Common.php(175): OC\\\\Files\\\\Storage\\\\DAV->stat('')\\n#4 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Common->filemtime('')\\n#5 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Availability.php(252): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#6 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability->filemtime('')\\n#7 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#8 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/apps\\\/federatedfilesharing\\\/lib\\\/Command\\\/PollIncomingShares.php(110): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#9 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/apps\\\/federatedfilesharing\\\/lib\\\/Command\\\/PollIncomingShares.php(92): OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares->refreshStorageRoot(Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#10 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(960): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(255): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(148): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Console\\\/Application.php(164): Symfony\\\\Component\\\\Console\\\\Application->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#15 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/console.php(106): OC\\\\Console\\\\Application->run()\\n#16 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/occ(11): require_once('\\\/home\\\/deo\\\/publi...')\\n#17 {main}\",\"File\":\"\\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/sabre\\\/http\\\/lib\\\/Client.php\",\"Line\":155}"}
{"reqId":"0jcYYTjvA7asrGLBtk0R","level":3,"time":"2019-03-29T10:07:45+00:00","remoteAddr":"","user":"--","app":"files_external","method":"--","url":"--","message":"Unauthorized"}
{"reqId":"0jcYYTjvA7asrGLBtk0R","level":3,"time":"2019-03-29T10:07:45+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"--","url":"--","message":"Exception: {\"Exception\":\"OCP\\\\Files\\\\StorageInvalidException\",\"Message\":\"Sabre\\\\HTTP\\\\ClientHttpException: Unauthorized\",\"Code\":0,\"Trace\":\"#0 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(830): OC\\\\Files\\\\Storage\\\\DAV->throwByStatusCode(401, Object(Sabre\\\\HTTP\\\\ClientHttpException), '')\\n#1 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(275): OC\\\\Files\\\\Storage\\\\DAV->convertException(Object(Sabre\\\\HTTP\\\\ClientHttpException), '')\\n#2 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(579): OC\\\\Files\\\\Storage\\\\DAV->propfind('')\\n#3 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Common.php(175): OC\\\\Files\\\\Storage\\\\DAV->stat('')\\n#4 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Common->filemtime('')\\n#5 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Availability.php(252): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#6 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability->filemtime('')\\n#7 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(232): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#8 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/apps\\\/federatedfilesharing\\\/lib\\\/Command\\\/PollIncomingShares.php(110): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->filemtime('')\\n#9 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/apps\\\/federatedfilesharing\\\/lib\\\/Command\\\/PollIncomingShares.php(92): OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares->refreshStorageRoot(Object(OCA\\\\Files_Trashbin\\\\Storage))\\n#10 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(960): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(255): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OCA\\\\FederatedFileSharing\\\\Command\\\\PollIncomingShares), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(148): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#14 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Console\\\/Application.php(164): Symfony\\\\Component\\\\Console\\\\Application->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#15 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/console.php(106): OC\\\\Console\\\\Application->run()\\n#16 \\\/home\\\/deo\\\/public_html\\\/oc-master\\\/occ(11): require_once('\\\/home\\\/deo\\\/publi...')\\n#17 {main}\",\"File\":\"\\\/home\\\/deo\\\/public_html\\\/oc-master\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php\",\"Line\":865}"}
{"reqId":"0jcYYTjvA7asrGLBtk0R","level":3,"time":"2019-03-29T10:07:45+00:00","remoteAddr":"","user":"--","app":"files_external","method":"--","url":"--","message":"Sabre\\HTTP\\ClientHttpException: Unauthorized"}
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.
it's likely logged on a higher level already ?
We have to check what happens if the sharing app is disabled. We might need to workaround something. |
@jvillafanez good point. Added:
|
Do we want to go a bit further and check if the sharing app is present, not just disabled? or do we assume that the sharing app will always be present? |
@jvillafanez I can't go further too much as there are estimates. |
codecov fail likely due to Application.php, skipping |
@VicDeo please backport |
stable10: #34933 |
Description
Allow manually poll federated share updates and update the storage root
to help the sync client properly detect federated share updates
Related Issue
Motivation and Context
How Has This Been Tested?
php occ incomingShares:sync
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: