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


PHP State::handle_updates方法代码示例

本文整理汇总了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);
}
开发者ID:Elgg,项目名称:probation,代码行数:29,代码来源:events.php

示例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);
}
开发者ID:Elgg,项目名称:probation,代码行数:18,代码来源:functions.php


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