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
f313105d
Commit
f313105d
authored
8 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
add "unscanned" option to files:scan to triger a background scan
parent
6ace14b6
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
apps/files/lib/Command/Scan.php
+12
-3
12 additions, 3 deletions
apps/files/lib/Command/Scan.php
with
12 additions
and
3 deletions
apps/files/lib/Command/Scan.php
+
12
−
3
View file @
f313105d
...
...
@@ -86,6 +86,11 @@ class Scan extends Base {
null
,
InputOption
::
VALUE_NONE
,
'will rescan all files of all known users'
)
->
addOption
(
'unscanned'
,
null
,
InputOption
::
VALUE_NONE
,
'only scan files which are marked as not fully scanned'
);
}
...
...
@@ -98,7 +103,7 @@ class Scan extends Base {
}
}
protected
function
scanFiles
(
$user
,
$path
,
$verbose
,
OutputInterface
$output
)
{
protected
function
scanFiles
(
$user
,
$path
,
$verbose
,
OutputInterface
$output
,
$backgroundScan
=
false
)
{
$scanner
=
new
\OC\Files\Utils\Scanner
(
$user
,
\OC
::
$server
->
getDatabaseConnection
(),
\OC
::
$server
->
getLogger
());
# check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception
# printout and count
...
...
@@ -143,7 +148,11 @@ class Scan extends Base {
});
try
{
$scanner
->
scan
(
$path
);
if
(
$backgroundScan
)
{
$scanner
->
backgroundScan
(
$path
);
}
else
{
$scanner
->
scan
(
$path
);
}
}
catch
(
ForbiddenException
$e
)
{
$output
->
writeln
(
"<error>Home storage for user
$user
not writable</error>"
);
$output
->
writeln
(
"Make sure you're running the scan command only as the user the web server runs as"
);
...
...
@@ -210,7 +219,7 @@ class Scan extends Base {
if
(
$verbose
)
{
$output
->
writeln
(
""
);
}
$output
->
writeln
(
"Starting scan for user
$user_count
out of
$users_total
(
$user
)"
);
# full: printout data if $verbose was set
$this
->
scanFiles
(
$user
,
$path
,
$verbose
,
$output
);
$this
->
scanFiles
(
$user
,
$path
,
$verbose
,
$output
,
$input
->
getOption
(
'unscanned'
)
);
}
else
{
$output
->
writeln
(
"<error>Unknown user
$user_count
$user
</error>"
);
}
...
...
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