本文整理汇总了PHP中State::handle_updates方法的典型用法代码示例。如果您正苦于以下问题:PHP State::handle_updates方法的具体用法?PHP State::handle_updates怎么用?PHP State::handle_updates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::handle_updates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_shutdown
function event_shutdown()
{
State::$handle_updates = false;
if (State::$users_leaving_probation) {
set_time_limit(0);
}
$ia = elgg_set_ignore_access(true);
$force_private = elgg_get_plugin_setting(QUARANTINE_PRIVATE, PLUGIN_ID);
foreach (State::$entities_quarantined as $entity) {
if ($entity->{ORIGINAL_ACCESS_ID} === null || $entity->access_id != ACCESS_PRIVATE) {
$entity->{ORIGINAL_ACCESS_ID} = $entity->access_id;
}
if ($force_private) {
$entity->access_id = ACCESS_PRIVATE;
} elseif ($entity->access_id == ACCESS_PUBLIC) {
$entity->access_id = ACCESS_LOGGED_IN;
}
$entity->save();
}
foreach (State::$users_leaving_probation as $user) {
$options = ['owner_guid' => $user->guid, 'metadata_name' => QUARANTINED, 'metadata_value' => '1', 'limit' => 0];
$batch = new \ElggBatch('elgg_get_entities_from_metadata', $options, null, 25, false);
foreach ($batch as $object) {
/* @var \ElggObject $object */
approve_content($object);
}
}
elgg_set_ignore_access($ia);
}
示例2: approve_content
function approve_content(\ElggObject $object)
{
$object->deleteMetadata(QUARANTINED);
$access_id = $object->{ORIGINAL_ACCESS_ID};
// delete it so our update handler doesn't re-set it
$object->deleteMetadata(ORIGINAL_ACCESS_ID);
if ($access_id !== null) {
$object->access_id = (int) $access_id;
$handle = State::$handle_updates;
State::$handle_updates = false;
$object->save();
State::$handle_updates = $handle;
} else {
$access_id = $object->access_id;
}
// just in case plugins look at river.access_id
update_river_access_by_object($object->guid, $access_id);
}