本文整理汇总了PHP中Queue::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::get方法的具体用法?PHP Queue::get怎么用?PHP Queue::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit_all
public function submit_all()
{
if ($this->validateAction()) {
if ($this->permissions->canDeleteBlock() && $this->page->isMasterCollection()) {
$name = sprintf('delete_block_%s', $this->block->getBlockID());
$queue = \Queue::get($name);
if ($_POST['process']) {
$obj = new \stdClass();
$messages = $queue->receive(20);
foreach ($messages as $key => $p) {
$block = unserialize($p->body);
$page = \Page::getByID($block['cID'], $block['cvID']);
$b = \Block::getByID($block['bID'], $page, $block['arHandle']);
if (is_object($b) && !$b->isError()) {
$b->deleteBlock();
}
$queue->deleteMessage($p);
}
$obj->totalItems = $queue->count();
if ($queue->count() == 0) {
$queue->deleteQueue($name);
}
$obj->bID = $this->block->getBlockID();
$obj->aID = $this->area->getAreaID();
$obj->message = t('All child blocks deleted successfully.');
echo json_encode($obj);
$this->app->shutdown();
} else {
$queue = $this->block->queueForDefaultsUpdate($_POST, $queue);
}
$totalItems = $queue->count();
\View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d block", "%d blocks", $totalItems)));
$this->app->shutdown();
}
}
}
示例2: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Core\Multilingual\Page\Section\Section;
$dh = Loader::helper('concrete/dashboard/sitemap');
if (!$dh->canRead()) {
die(t("Access Denied."));
}
// we have to do this otherwise permissions pointers aren't correct
// (cInheritPermissionsFromCID on parent nodes)
Core::make('cache/request')->disable();
$q = Queue::get('copy_page');
$includeParent = true;
if ($_REQUEST['copyChildrenOnly']) {
$includeParent = false;
}
$db = Loader::db();
if ($_POST['process']) {
$obj = new stdClass();
$js = Loader::helper('json');
$messages = $q->receive(Config::get('concrete.limits.copy_pages'));
foreach ($messages as $key => $p) {
// delete the page here
$page = unserialize($p->body);
$oc = Page::getByID($page['cID']);
// this is the page we're going to copy.
// now we check to see if the parent ID of the current record has already been duplicated somewhere.
$newCID = $db->GetOne('select cID from QueuePageDuplicationRelations where originalCID = ? and queue_name = ?', array($page['cParentID'], 'copy_page'));
if ($newCID > 0) {
$dc = Page::getByID($newCID);
} else {
示例3: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');
$dh = Core::make('helper/date');
/* @var $dh \Concrete\Core\Localization\Service\Date */
$sh = Loader::helper('concrete/dashboard/sitemap');
if (!$sh->canRead()) {
die(t('Access Denied'));
}
$u = new User();
if ($_POST['task'] == 'delete_pages') {
$q = Queue::get('delete_page_request');
if ($_POST['process']) {
$obj = new stdClass();
$js = Loader::helper('json');
$messages = $q->receive(Config::get('concrete.limits.delete_pages'));
foreach ($messages as $key => $p) {
// delete the page here
$page = unserialize($p->body);
$c = Page::getByID($page['cID']);
if ($c->getCollectionID() > 1) {
$pkr = new \Concrete\Core\Workflow\Request\DeletePageRequest();
$pkr->setRequestedPage($c);
$pkr->setRequesterUserID($u->getUserID());
$u->unloadCollectionEdit($c);
$pkr->trigger();
}
$q->deleteMessage($p);
}
示例4: queueForDuplication
public function queueForDuplication($destination, $includeParent = true)
{
$pages = array();
$pages = $this->populateRecursivePages($pages, array('cID' => $this->getCollectionID()), $this->getCollectionParentID(), 0, $includeParent);
// now, since this is deletion, we want to order the pages by level, which
// should get us no funny business if the queue dies.
usort($pages, array('Page', 'queueForDuplicationSort'));
$q = Queue::get('copy_page');
foreach ($pages as $page) {
$page['destination'] = $destination->getCollectionID();
$q->send(serialize($page));
}
}
示例5: Memcache
//实例化Memcache
$mc = new Memcache();
$mc->connect('127.0.0.1', 11211);
//实例化消息队列
$queue = new Queue($mc);
$name = "Memcache";
//写入消息队列
$queue->put($name, "Memcache消息队列测试--" . rand(0, 100));
//出消息队列
$temp = $queue->get($name);
var_dump($temp);
$temp = $queue->status($name);
var_dump($temp);
echo "<hr/>";
/*******Tokyotrant*******/
echo "Tokyotrant队列测试:<br />";
//实例化Tokyotran
$tt = new Memcache();
$tt->connect('127.0.0.1', 1978);
//实例化消息队列
$queue = new Queue($tt);
$name = "Tokyotrant";
//写入消息队列
$queue->put($name, "Tokyotrant消息队列测试--" . rand(0, 100));
//出消息队列
$temp = $queue->get($name);
var_dump($temp);
$temp = $queue->status($name);
var_dump($temp);
echo "<hr/>";
/*******Redis*******/
示例6: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$dh = Loader::helper('concrete/dashboard/sitemap');
if (!$dh->canRead()) {
die(t("Access Denied."));
}
$q = Queue::get('delete_page');
$isEmptyTrash = false;
if ($_POST['process']) {
$obj = new stdClass();
$js = Loader::helper('json');
$messages = $q->receive(Config::get('concrete.limits.sitemap_pages'));
foreach ($messages as $key => $p) {
// delete the page here
$page = unserialize($p->body);
$c = Page::getByID($page['cID']);
$c->delete();
$q->deleteMessage($p);
}
$obj->totalItems = $q->count();
if ($q->count() == 0) {
$q->deleteQueue('delete_page');
}
print $js->encode($obj);
exit;
} else {
if ($q->count() == 0) {
$c = Page::getByID($_REQUEST['cID']);
if ($c->getCollectionPath() == Config::get('concrete.paths.trash')) {
$isEmptyTrash = true;
示例7: getQueueObject
public function getQueueObject()
{
return Queue::get('job_' . $this->getJobHandle(), array('timeout' => 1));
}
示例8: flush
public function flush()
{
$this->assertLoggedIn();
$this->set('area', 'queues');
try {
//how do we find them?
$queue = new Queue($this->args('id'));
//did we really get someone?
if (!$queue->isHydrated()) {
throw new Exception("Could not find that queue.");
}
if ($queue->get('user_id') != User::$me->id) {
throw new Exception("You do not own this queue.");
}
$this->set('queue', $queue);
$this->setTitle('Empty Queue - ' . $queue->getName());
if ($this->args('submit')) {
Activity::log("emptied the queue <strong>" . $queue->getName() . "</strong>.");
$queue->flush();
$this->forwardToUrl($queue->getUrl());
}
} catch (Exception $e) {
$this->setTitle('Empty Queue - Error');
$this->set('megaerror', $e->getMessage());
}
}
示例9: submit
public function submit()
{
if ($this->validateAction() && $this->canAccess()) {
$a = \Area::get($this->page, $_GET['arHandle']);
$c = $this->page;
if (is_object($a)) {
$b = \Block::getByID($_GET['bID'], $c, $a);
$p = new \Permissions($b);
if ($p->canAdminBlock() && $c->isMasterCollection()) {
$name = sprintf('update_defaults_%s', $b->getBlockID());
$queue = \Queue::get($name);
if ($_POST['process']) {
$obj = new \stdClass();
$messages = $queue->receive(20);
foreach ($messages as $key => $p) {
$record = unserialize($p->body);
$page = \Page::getByID($record['cID'], $record['cvID']);
if ($record['action'] == 'add_alias') {
$this->block->alias($page);
} else {
if ($record['action'] == 'update_forked_alias') {
$forked = \Block::getByID($record['bID'], $page, $record['arHandle']);
if (is_object($forked) && !$forked->isError()) {
// take the current block that is in defaults, and replace the block on the page
// with that block.
$existingDisplayOrder = $forked->getBlockDisplayOrder();
$bt = $b->getBlockTypeObject();
// Now we delete the existing forked block.
$forked->deleteBlock();
if ($bt->isCopiedWhenPropagated()) {
$b = $this->block->duplicate($page, true);
} else {
$this->block->alias($page);
$b = \Block::getByID($this->block->getBlockID(), $page, $record['arHandle']);
}
$b->setAbsoluteBlockDisplayOrder($existingDisplayOrder);
$page->rescanDisplayOrder($record['arHandle']);
}
}
}
$queue->deleteMessage($p);
}
$obj->totalItems = $queue->count();
if ($queue->count() == 0) {
$queue->deleteQueue($name);
}
$obj->bID = $b->getBlockID();
$obj->aID = $a->getAreaID();
$obj->message = t('All child blocks updated successfully.');
echo json_encode($obj);
$this->app->shutdown();
} else {
$queue = $this->block->queueForDefaultsAliasing($_POST['addBlock'], $queue);
}
$totalItems = $queue->count();
\View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d pages", "%d pages", $totalItems)));
}
}
}
$this->app->shutdown();
}