@@ -175,13 +175,16 @@ public function runTask($taskId, $status = null, &$currentlyRunning = -1, $force
175
175
$ queued = false ;
176
176
}
177
177
if ( ( $ res >= $ lastExec && $ res < $ now && !$ alreadyRunning ) || $ queued || $ forceStart ) {
178
- if ($ data ["user_id " ] == "* " ) {
179
- $ data ["user_id " ] = implode (", " , array_keys (AuthService::listUsers ()));
180
- } else if ($ data ["user_id " ] == "*/* " ) {
178
+ if ($ data ["user_id " ] == "*/* " || $ data ["user_id " ] == "* " ) {
181
179
// Recurse all groups and put them into a queue file
182
180
$ allUsers = array ();
183
- $ this ->gatherUsers ($ allUsers , "/ " );
181
+ if ($ data ["user_id " ] == "* " ){
182
+ $ allUsers = $ this ->listUsersIds ();
183
+ }else {
184
+ $ this ->gatherUsers ($ allUsers , "/ " );
185
+ }
184
186
$ tmpQueue = AJXP_CACHE_DIR ."/cmd_outputs/queue_ " .$ taskId ."" ;
187
+ echo "Queuing " .count ($ allUsers )." users in file " .$ tmpQueue ."\n" ;
185
188
file_put_contents ($ tmpQueue , implode (", " , $ allUsers ));
186
189
$ data ["user_id " ] = "queue: " .$ tmpQueue ;
187
190
}
@@ -205,10 +208,16 @@ public function runTask($taskId, $status = null, &$currentlyRunning = -1, $force
205
208
return false ;
206
209
}
207
210
211
+ protected function listUsersIds ($ baseGroup = "/ " ){
212
+ $ authDriver = ConfService::getAuthDriverImpl ();
213
+ $ pairs = $ authDriver ->listUsers ($ baseGroup );
214
+ return array_keys ($ pairs );
215
+ }
216
+
208
217
protected function gatherUsers (&$ users , $ startGroup ="/ " )
209
218
{
210
- $ u = AuthService:: listUsers ($ startGroup );
211
- $ users = array_merge ($ users , array_keys ( $ u ) );
219
+ $ u = $ this -> listUsersIds ($ startGroup );
220
+ $ users = array_merge ($ users , $ u );
212
221
$ g = AuthService::listChildrenGroups ($ startGroup );
213
222
if (count ($ g )) {
214
223
foreach ($ g as $ gName => $ gLabel ) {
@@ -505,9 +514,9 @@ public function handleTasks($action, $httpVars, $fileVars)
505
514
public function fakeLongTask ($ action , $ httpVars , $ fileVars )
506
515
{
507
516
$ minutes = (isSet ($ httpVars ["time_length " ])?intval ($ httpVars ["time_length " ]):2 );
508
- $ this ->logDebug ( "Running Fake task on " .AuthService::getLoggedUser ()->getId ());
517
+ $ this ->logInfo ( __FUNCTION__ , "Running Fake task on " .AuthService::getLoggedUser ()->getId ());
509
518
print ('STARTING FAKE TASK ' );
510
- sleep ($ minutes * 60 );
519
+ sleep ($ minutes * 30 );
511
520
print ('ENDIND FAKE TASK ' );
512
521
}
513
522
0 commit comments