本文整理汇总了PHP中modResource::removeLock方法的典型用法代码示例。如果您正苦于以下问题:PHP modResource::removeLock方法的具体用法?PHP modResource::removeLock怎么用?PHP modResource::removeLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modResource
的用法示例。
在下文中一共展示了modResource::removeLock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
if (!$this->addLock()) {
return $this->failure($this->modx->lexicon('resource_locked_by', array('id' => $this->resource->get('id'), 'user' => $this->lockedUser->get('username'))));
}
if ($this->isSiteStart()) {
return $this->failure($this->modx->lexicon('resource_err_unpublish_sitestart'));
}
$this->resource->set('published', false);
$this->resource->set('pub_date', false);
$this->resource->set('unpub_date', false);
$this->resource->set('editedby', $this->modx->user->get('id'));
$this->resource->set('editedon', time(), 'integer');
$this->resource->set('publishedby', false);
$this->resource->set('publishedon', false);
if ($this->resource->save() == false) {
$this->resource->removeLock();
return $this->failure($this->modx->lexicon('resource_err_unpublish'));
}
$this->fireAfterUnPublishEvent();
$this->logManagerAction();
$skipClearCache = $this->getProperty('skipClearCache', false);
if ($skipClearCache == false) {
$this->clearCache();
}
return $this->success('', $this->resource->get(array('id')));
}
示例2: process
public function process()
{
if (!$this->addLock()) {
return $this->failure($this->modx->lexicon('resource_locked_by', array('id' => $this->resource->get('id'), 'user' => $this->lockedUser->get('username'))));
}
$duplicateAlias = $this->checkForDuplicateAlias();
if ($duplicateAlias !== false) {
return $this->failure($duplicateAlias);
}
/* publish resource */
$this->resource->set('published', true);
$this->resource->set('pub_date', false);
$this->resource->set('unpub_date', false);
$this->resource->set('editedby', $this->modx->user->get('id'));
$this->resource->set('editedon', time(), 'integer');
$this->resource->set('publishedby', $this->modx->user->get('id'));
$this->resource->set('publishedon', time());
$saved = $this->resource->save();
$this->resource->removeLock();
if (!$saved) {
return $this->failure($this->modx->lexicon('resource_err_publish'));
}
$this->fireAfterPublish();
$this->logManagerAction();
$this->clearCache();
return $this->success('', $this->resource->get(array('id', 'pub_date', 'unpub_date', 'editedby', 'editedon', 'publishedby', 'publishedon')));
}
示例3: cleanup
/**
* Cleanup the processor and return the resulting object
*
* @return array
*/
public function cleanup()
{
$this->object->removeLock();
$this->clearCache();
$returnArray = $this->object->get(array_diff(array_keys($this->object->_fields), array('content', 'ta', 'introtext', 'description', 'link_attributes', 'pagetitle', 'longtitle', 'menutitle', 'properties')));
foreach ($returnArray as $k => $v) {
if (strpos($k, 'tv') === 0) {
unset($returnArray[$k]);
}
}
$returnArray['class_key'] = $this->object->get('class_key');
$this->workingContext->prepare(true);
$returnArray['preview_url'] = $this->modx->makeUrl($this->object->get('id'), $this->object->get('context_key'), '', 'full');
return $this->success('', $returnArray);
}
示例4: deleteChildren
/**
* Delete all children of this resource
* @return array
*/
public function deleteChildren()
{
if (count($this->children) > 0) {
/** @var modResource $child */
foreach ($this->children as $child) {
$locked = $child->addLock();
if ($locked !== true) {
/** @var modUser $user */
$user = $this->modx->getObject('modUser', $locked);
if ($user) {
$this->modx->log(modX::LOG_LEVEL_ERROR, $this->modx->lexicon('resource_locked_by', array('id' => $child->get('id'), 'user' => $user->get('username'))));
}
}
$child->set('deleted', true);
$child->set('deletedby', $this->modx->user->get('id'));
$child->set('deletedon', $this->deletedTime);
if ($child->save() == false) {
$child->removeLock();
$this->resource->removeLock();
}
}
}
return $this->children;
}
示例5: cleanup
/**
* {@inheritDoc}
* @return mixed
*/
public function cleanup()
{
$this->object->removeLock();
$this->clearCache();
return $this->success('', array('id' => $this->object->get('id')));
}
示例6: removeLock
/**
* Remove the lock from the Resource
* @return boolean
*/
public function removeLock()
{
return $this->resource->removeLock();
}