@@ -89,17 +89,41 @@ protected function execute(InputInterface $input, OutputInterface $output): int
89
89
}
90
90
if ($ userId === null ) {
91
91
$ this ->userManager ->callForSeenUsers (function (IUser $ user ) use ($ inBackground ) {
92
- $ this ->scanUserPhotos ($ user ->getUID (), $ pathToScan , $ inBackground );
92
+ if ($ pathToScan === null ) {
93
+ $ this ->rescanUserPhotos ($ user ->getUID (), $ inBackground );
94
+ } else {
95
+ $ this ->scanUserPhotos ($ user ->getUID (), $ pathToScan , $ inBackground );
96
+ }
93
97
});
94
98
} else {
95
99
$ user = $ this ->userManager ->get ($ userId );
96
100
if ($ user !== null ) {
97
- $ this ->scanUserPhotos ($ userId , $ pathToScan , $ inBackground );
101
+ if ($ pathToScan === null ) {
102
+ $ this ->rescanUserPhotos ($ userId , $ inBackground );
103
+ } else {
104
+ $ this ->scanUserPhotos ($ userId , $ pathToScan , $ inBackground );
105
+ }
98
106
}
99
107
}
100
108
return 0 ;
101
109
}
102
110
111
+ /**
112
+ * @param string $userId
113
+ * @param bool $inBackground
114
+ * @return void
115
+ * @throws \OCP\PreConditionNotMetException
116
+ */
117
+ private function rescanUserPhotos (string $ userId , bool $ inBackground =true ) {
118
+ echo '======== User ' .$ userId .' ======== ' ."\n" ;
119
+ $ c = 1 ;
120
+ foreach ($ this ->photofilesService ->rescan ($ userId , $ inBackground ) as $ path ) {
121
+ echo '[ ' .$ c .'] Photo " ' .$ path .'" added ' ."\n" ;
122
+ $ c ++;
123
+ }
124
+ $ this ->config ->setUserValue ($ userId , 'maps ' , 'installScanDone ' , 'yes ' );
125
+ }
126
+
103
127
/**
104
128
* @param string $userId
105
129
* @param string $pathToScan
0 commit comments