Пример #1
0
     $cache->setPrefix($userName);
     foreach ($cache->getAllFiles() as $path) {
         unlink($path);
     }
     #append media to queue
     $mediaIds = [];
     foreach (Media::getConstList() as $media) {
         foreach ($userContext->user->getMixedUserMedia($media) as $entry) {
             $mediaAge = time() - strtotime($entry->processed);
             if ($mediaAge > Config::$mediaQueueMinWait) {
                 $mediaIds[] = TextHelper::serializeMediaId($entry);
             }
         }
     }
     $mediaQueue->enqueueMultiple(array_map(function ($mediaId) {
         return new QueueItem($mediaId);
     }, $mediaIds));
     $logger->log('ok');
 });
 $mediaIds = [];
 foreach (Media::getConstList() as $media) {
     $entries = Model_Media::getOldest($media, 100);
     foreach ($entries as $entry) {
         $mediaAge = time() - strtotime($entry->processed);
         if ($mediaAge > Config::$mediaQueueMinWait) {
             $mediaIds[] = TextHelper::serializeMediaId($entry);
         }
     }
 }
 $mediaQueue->enqueueMultiple(array_map(function ($mediaId) {
     return new QueueItem($mediaId);
Пример #2
0
<?php

require_once __DIR__ . '/../src/core.php';
$userQueue = new Queue(Config::$userQueuePath);
$query = 'SELECT id, name FROM user ORDER BY id';
$users = R::getAll($query);
$usernames = [];
foreach ($users as $user) {
    $usernames[] = $user['name'];
}
$userQueue->enqueueMultiple(array_map(function ($username) {
    return new QueueItem($username);
}, $usernames));