当前位置: 首页>>代码示例>>PHP>>正文


PHP QueueManager::get方法代码示例

本文整理汇总了PHP中QueueManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP QueueManager::get方法的具体用法?PHP QueueManager::get怎么用?PHP QueueManager::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueueManager的用法示例。


在下文中一共展示了QueueManager::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handlePost

 /**
  * Handler for POST content updates from the hub
  */
 function handlePost()
 {
     $feedid = $this->arg('feed');
     common_log(LOG_INFO, "POST for feed id {$feedid}");
     if (!$feedid) {
         // TRANS: Server exception thrown when referring to a non-existing or empty feed.
         throw new ServerException(_m('Empty or invalid feed id.'), 400);
     }
     $feedsub = FeedSub::getKV('id', $feedid);
     if (!$feedsub instanceof FeedSub) {
         // TRANS: Server exception. %s is a feed ID.
         throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'), $feedid), 400);
     }
     $hmac = '';
     if (isset($_SERVER['HTTP_X_HUB_SIGNATURE'])) {
         $hmac = $_SERVER['HTTP_X_HUB_SIGNATURE'];
     }
     $post = file_get_contents('php://input');
     // Queue this to a background process; we should return
     // as quickly as possible from a distribution POST.
     // If queues are disabled this'll process immediately.
     $data = array('feedsub_id' => $feedsub->id, 'post' => $post, 'hmac' => $hmac);
     $qm = QueueManager::get();
     $qm->enqueue($data, 'pushin');
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:28,代码来源:pushcallback.php

示例2: queueBackup

 function queueBackup()
 {
     $cur = common_current_user();
     $qm = QueueManager::get();
     $qm->enqueue($cur->id, 'backoff');
     $this->showPage();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:offlinebackup.php

示例3: initManagers

 /**
  * Initialize IoManagers for the currently configured site
  * which are appropriate to this instance.
  */
 function initManagers()
 {
     if (common_config('xmpp', 'enabled')) {
         $qm = QueueManager::get();
         $qm->setActiveGroup('xmpp');
         $this->instantiate($qm);
         $this->instantiate(XmppManager::get());
         $this->instantiate($this->processManager);
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:14,代码来源:xmppdaemon.php

示例4: doSendControl

function doSendControl($message, $event, $param = '')
{
    print $message;
    $qm = QueueManager::get();
    if ($qm->sendControlSignal($event, $param)) {
        print " sent.\n";
    } else {
        print " FAILED.\n";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:10,代码来源:queuectl.php

示例5: initManagers

 /**
  * Initialize IoManagers for the currently configured site
  * which are appropriate to this instance.
  */
 function initManagers()
 {
     $classes = array();
     if (Event::handle('StartImDaemonIoManagers', array(&$classes))) {
         $qm = QueueManager::get();
         $qm->setActiveGroup('im');
         $classes[] = $qm;
         $classes[] = $this->processManager;
     }
     Event::handle('EndImDaemonIoManagers', array(&$classes));
     foreach ($classes as $class) {
         $this->instantiate($class);
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:18,代码来源:imdaemon.php

示例6: handle

 public function handle($user)
 {
     if (!$user instanceof User) {
         common_log(LOG_ERR, "Got a bogus user, not deleting");
         return true;
     }
     $user = User::getKV('id', $user->id);
     if (!$user) {
         common_log(LOG_INFO, "User {$user->nickname} was deleted before we got here.");
         return true;
     }
     try {
         if (!$user->hasRole(Profile_role::DELETED)) {
             common_log(LOG_INFO, "User {$user->nickname} is not pending deletion; aborting.");
             return true;
         }
     } catch (UserNoProfileException $unp) {
         common_log(LOG_INFO, "Deleting user {$user->nickname} with no profile... probably a good idea!");
     }
     $notice = $this->getNextBatch($user);
     if ($notice->N) {
         common_log(LOG_INFO, "Deleting next {$notice->N} notices by {$user->nickname}");
         while ($notice->fetch()) {
             $del = clone $notice;
             $del->delete();
         }
         // @todo improve reliability in case we died during the above deletions
         // with a fatal error. If the job is lost, we should perform some kind
         // of garbage collection later.
         // Queue up the next batch.
         $qm = QueueManager::get();
         $qm->enqueue($user, 'deluser');
     } else {
         // Out of notices? Let's finish deleting this profile!
         try {
             $user->getProfile()->delete();
         } catch (UserNoProfileException $e) {
             // in case a profile didn't exist for some reason, just delete the User directly
             $user->delete();
         }
         common_log(LOG_INFO, "User {$user->id} {$user->nickname} deleted.");
         return true;
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:45,代码来源:deluserqueuehandler.php

示例7: handle

 /**
  * Handle the site
  *
  * @param array $remitem type of reminder to send and any special options
  * @return boolean true on success, false on failure
  */
 function handle($remitem)
 {
     list($type, $opts) = $remitem;
     $qm = QueueManager::get();
     try {
         switch ($type) {
             case UserConfirmRegReminderHandler::REGISTER_REMINDER:
                 $confirm = new Confirm_address();
                 $confirm->address_type = $type;
                 $confirm->find();
                 while ($confirm->fetch()) {
                     try {
                         $qm->enqueue(array($confirm, $opts), 'uregrem');
                     } catch (Exception $e) {
                         common_log(LOG_WARNING, $e->getMessage());
                         continue;
                     }
                 }
                 break;
             case UserInviteReminderHandler::INVITE_REMINDER:
                 $invitation = new Invitation();
                 // Only send one reminder (the latest one), regardless of how many invitations a user has
                 $sql = 'SELECT * FROM (SELECT * FROM invitation WHERE registered_user_id IS NULL ORDER BY created DESC) invitees GROUP BY invitees.address';
                 $invitation->query($sql);
                 while ($invitation->fetch()) {
                     try {
                         $qm->enqueue(array($invitation, $opts), 'uinvrem');
                     } catch (Exception $e) {
                         common_log(LOG_WARNING, $e->getMessage());
                         continue;
                     }
                 }
                 break;
             default:
                 // WTF?
                 common_log(LOG_ERR, "Received unknown confirmation address type", __FILE__);
         }
     } catch (Exception $e) {
         common_log(LOG_ERR, $e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:49,代码来源:siteconfirmreminderhandler.php

示例8: handle

 /**
  * Handle the site
  * 
  * @param mixed $object
  * @return boolean true on success, false on failure
  */
 function handle($object)
 {
     $qm = QueueManager::get();
     try {
         // Enqueue a summary for all users
         $user = new User();
         $user->find();
         while ($user->fetch()) {
             try {
                 $qm->enqueue($user->id, 'usersum');
             } catch (Exception $e) {
                 common_log(LOG_WARNING, $e->getMessage());
                 continue;
             }
         }
     } catch (Exception $e) {
         common_log(LOG_WARNING, $e->getMessage());
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:26,代码来源:siteemailsummaryhandler.php

示例9: handle

 function handle($data)
 {
     list($user, $xml, $trusted) = $data;
     try {
         $doc = DOMDocument::loadXML($xml);
         $feed = $doc->documentElement;
         if ($feed->namespaceURI != Activity::ATOM || $feed->localName != 'feed') {
             // TRANS: Client exception thrown when an imported feed is not an Atom feed.
             throw new ClientException(_("Not an Atom feed."));
         }
         $author = ActivityUtils::getFeedAuthor($feed);
         if (empty($author)) {
             // TRANS: Client exception thrown when an imported feed does not have an author.
             throw new ClientException(_("No author in the feed."));
         }
         if (empty($user)) {
             if ($trusted) {
                 $user = $this->userFromAuthor($author);
             } else {
                 // TRANS: Client exception thrown when an imported feed does not have an author that
                 // TRANS: can be associated with a user.
                 throw new ClientException(_("Cannot import without a user."));
             }
         }
         $activities = $this->getActivities($feed);
         $qm = QueueManager::get();
         foreach ($activities as $activity) {
             $qm->enqueue(array($user, $author, $activity, $trusted), 'actimp');
         }
     } catch (ClientException $ce) {
         common_log(LOG_WARNING, $ce->getMessage());
         return true;
     } catch (ServerException $se) {
         common_log(LOG_ERR, $ce->getMessage());
         return false;
     } catch (Exception $e) {
         common_log(LOG_ERR, $ce->getMessage());
         return false;
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:40,代码来源:feedimporter.php

示例10: enqueueNewFeeds

 public static function enqueueNewFeeds(array $args = array())
 {
     if (!isset($args['interval']) || !is_int($args['interval']) || $args['interval'] <= 0) {
         $args['interval'] = self::DEFAULT_INTERVAL;
     }
     $args['interval'] *= 60;
     // minutes to seconds
     $feedsub = new FeedSub();
     $feedsub->sub_state = 'nohub';
     // Find feeds that haven't been polled within the desired interval,
     // though perhaps we're abusing the "last_update" field here?
     $feedsub->whereAdd(sprintf('last_update < "%s"', common_sql_date(time() - $args['interval'])));
     $feedsub->find();
     $qm = QueueManager::get();
     while ($feedsub->fetch()) {
         $orig = clone $feedsub;
         $item = array('id' => $feedsub->id);
         $qm->enqueue($item, self::QUEUE_CHECK);
         $feedsub->last_update = common_sql_now();
         $feedsub->update($orig);
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:22,代码来源:feedpoll.php

示例11: handle

 function handle($object)
 {
     list($user, $remote, $password) = $object;
     $remote = Discovery::normalize($remote);
     $oprofile = Ostatus_profile::ensureProfileURI($remote);
     if (empty($oprofile)) {
         // TRANS: Exception thrown when an account could not be located when it should be moved.
         // TRANS: %s is the remote site.
         throw new Exception(sprintf(_("Cannot locate account %s."), $remote));
     }
     list($svcDocUrl, $username) = self::getServiceDocument($remote);
     $sink = new ActivitySink($svcDocUrl, $username, $password);
     $this->log(LOG_INFO, "Moving user {$user->nickname} " . "to {$remote}.");
     $stream = new UserActivityStream($user);
     // Reverse activities to run in correct chron order
     $acts = array_reverse($stream->activities);
     $this->log(LOG_INFO, "Got " . count($acts) . " activities " . "for {$user->nickname}.");
     $qm = QueueManager::get();
     foreach ($acts as $act) {
         $qm->enqueue(array($act, $sink, $user->uri, $remote), 'actmove');
     }
     $this->log(LOG_INFO, "Finished moving user {$user->nickname} " . "to {$remote}.");
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:23,代码来源:accountmover.php

示例12: handlePost

 /**
  * Handler for POST content updates from the hub
  */
 function handlePost()
 {
     $feedid = $this->arg('feed');
     common_log(LOG_INFO, "POST for feed id {$feedid}");
     if (!$feedid) {
         throw new ServerException('Empty or invalid feed id', 400);
     }
     $feedsub = FeedSub::staticGet('id', $feedid);
     if (!$feedsub) {
         throw new ServerException('Unknown PuSH feed id ' . $feedid, 400);
     }
     $hmac = '';
     if (isset($_SERVER['HTTP_X_HUB_SIGNATURE'])) {
         $hmac = $_SERVER['HTTP_X_HUB_SIGNATURE'];
     }
     $post = file_get_contents('php://input');
     // Queue this to a background process; we should return
     // as quickly as possible from a distribution POST.
     // If queues are disabled this'll process immediately.
     $data = array('feedsub_id' => $feedsub->id, 'post' => $post, 'hmac' => $hmac);
     $qm = QueueManager::get();
     $qm->enqueue($data, 'pushin');
 }
开发者ID:himmelex,项目名称:NTW,代码行数:26,代码来源:pushcallback.php

示例13: restoreAccount

 /**
  * Queue a file for restoration
  *
  * Uses the UserActivityStream class; may take a long time!
  *
  * @return void
  */
 function restoreAccount()
 {
     $this->checkSessionToken();
     if (!isset($_FILES['restorefile']['error'])) {
         // TRANS: Client exception displayed trying to restore an account while something went wrong uploading a file.
         throw new ClientException(_('No uploaded file.'));
     }
     switch ($_FILES['restorefile']['error']) {
         case UPLOAD_ERR_OK:
             // success, jump out
             break;
         case UPLOAD_ERR_INI_SIZE:
             // TRANS: Client exception thrown when an uploaded file is larger than set in php.ini.
             throw new ClientException(_('The uploaded file exceeds the ' . 'upload_max_filesize directive in php.ini.'));
             return;
         case UPLOAD_ERR_FORM_SIZE:
             throw new ClientException(_('The uploaded file exceeds the MAX_FILE_SIZE directive' . ' that was specified in the HTML form.'));
             return;
         case UPLOAD_ERR_PARTIAL:
             @unlink($_FILES['restorefile']['tmp_name']);
             // TRANS: Client exception.
             throw new ClientException(_('The uploaded file was only' . ' partially uploaded.'));
             return;
         case UPLOAD_ERR_NO_FILE:
             // TRANS: Client exception. No file; probably just a non-AJAX submission.
             throw new ClientException(_('No uploaded file.'));
             return;
         case UPLOAD_ERR_NO_TMP_DIR:
             // TRANS: Client exception thrown when a temporary folder is not present to store a file upload.
             throw new ClientException(_('Missing a temporary folder.'));
             return;
         case UPLOAD_ERR_CANT_WRITE:
             // TRANS: Client exception thrown when writing to disk is not possible during a file upload operation.
             throw new ClientException(_('Failed to write file to disk.'));
             return;
         case UPLOAD_ERR_EXTENSION:
             // TRANS: Client exception thrown when a file upload operation has been stopped by an extension.
             throw new ClientException(_('File upload stopped by extension.'));
             return;
         default:
             common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " . $_FILES['restorefile']['error']);
             // TRANS: Client exception thrown when a file upload operation has failed with an unknown reason.
             throw new ClientException(_('System error uploading file.'));
             return;
     }
     $filename = $_FILES['restorefile']['tmp_name'];
     try {
         if (!file_exists($filename)) {
             // TRANS: Server exception thrown when an expected file upload could not be found.
             throw new ServerException(_("No such file '{$filename}'."));
         }
         if (!is_file($filename)) {
             // TRANS: Server exception thrown when an expected file upload is not an actual file.
             throw new ServerException(_("Not a regular file: '{$filename}'."));
         }
         if (!is_readable($filename)) {
             // TRANS: Server exception thrown when an expected file upload could not be read.
             throw new ServerException(_("File '{$filename}' not readable."));
         }
         common_debug(sprintf("Getting backup from file '%s'.", $filename));
         $xml = file_get_contents($filename);
         // This check is costly but we should probably give
         // the user some info ahead of time.
         $doc = new DOMDocument();
         // Disable PHP warnings so we don't spew low-level XML errors to output...
         // would be nice if we can just get exceptions instead.
         $old_err = error_reporting();
         error_reporting($old_err & ~E_WARNING);
         $doc->loadXML($xml);
         error_reporting($old_err);
         $feed = $doc->documentElement;
         if (!$feed || $feed->namespaceURI != Activity::ATOM || $feed->localName != 'feed') {
             // TRANS: Client exception thrown when a feed is not an Atom feed.
             throw new ClientException(_("Not an Atom feed."));
         }
         // Enqueue for processing.
         $qm = QueueManager::get();
         $qm->enqueue(array(common_current_user(), $xml, false), 'feedimp');
         if ($qm instanceof UnQueueManager) {
             // No active queuing means we've actually just completed the job!
             $this->success = true;
         } else {
             // We've fed data into background queues, and it's probably still running.
             $this->inprogress = true;
         }
         $this->showPage();
     } catch (Exception $e) {
         // Delete the file and re-throw
         @unlink($_FILES['restorefile']['tmp_name']);
         throw $e;
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:99,代码来源:restoreaccount.php

示例14: common_broadcast_profile

/**
 * Broadcast profile updates to OMB and other remote subscribers.
 *
 * Since this may be slow with a lot of subscribers or bad remote sites,
 * this is run through the background queues if possible.
 */
function common_broadcast_profile(Profile $profile)
{
    $qm = QueueManager::get();
    $qm->enqueue($profile, "profile");
    return true;
}
开发者ID:himmelex,项目名称:NTW,代码行数:12,代码来源:util.php

示例15: enqueueIncomingRaw

 /**
  * Put raw message data (received, ready to be processed) into the incoming queue
  *
  * @param object $data
  */
 function enqueueIncomingRaw($data)
 {
     $qm = QueueManager::get();
     $qm->enqueue($data, $this->transport . '-in');
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:10,代码来源:implugin.php


注:本文中的QueueManager::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。