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


PHP delete_access_collection函数代码示例

本文整理汇总了PHP中delete_access_collection函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_access_collection函数的具体用法?PHP delete_access_collection怎么用?PHP delete_access_collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: weekly_cron

/**
 * @TODO - is there a way we can target them directly instead of iterating through all?
 * 
 * @param type $h
 * @param type $t
 * @param type $r
 * @param type $p
 * @return type
 */
function weekly_cron($h, $t, $r, $p)
{
    $ia = elgg_set_ignore_access(true);
    // check for abandoned acls
    $dbprefix = elgg_get_config('dbprefix');
    // try to make this as light as possible
    $options = array('type' => 'object', 'subtype' => 'granular_access', 'limit' => false);
    $batch = new ElggBatch('elgg_get_entities', $options);
    foreach ($batch as $b) {
        $sql = "SELECT COUNT(guid) as total FROM {$dbprefix}entities WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        $sql = "SELECT COUNT(id) as total FROM {$dbprefix}metadata WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        $sql = "SELECT COUNT(id) as total FROM {$dbprefix}annotations WHERE access_id = {$b->acl_id}";
        $result = get_data($sql);
        if ($result[0]->total) {
            continue;
        }
        // this appears to be orphaned
        delete_access_collection($b->acl_id);
        $b->delete();
    }
    elgg_set_ignore_access($ia);
    return $r;
}
开发者ID:beck24,项目名称:granular_access,代码行数:40,代码来源:hooks.php

示例2: delete

 public function delete()
 {
     if ($acl = $this->getACL()) {
         delete_access_collection($acl);
     }
     if ($this->icontime) {
         $this->removeIcon();
     }
     return parent::delete();
 }
开发者ID:pleio,项目名称:subsite_manager,代码行数:10,代码来源:Subsite.php

示例3: groups_delete_event_listener

/**
 * Groups deleted, so remove access lists.
 */
function groups_delete_event_listener($event, $object_type, $object)
{
    delete_access_collection($object->group_acl);
    return true;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:8,代码来源:start.php

示例4: set_time_limit

namespace hypeJunction\Faker;

use ElggBatch;
set_time_limit(0);
$rels = $collections = 0;
$max = (int) get_input('max', 20);
$friends_count = rand(1, $max);
$users = new ElggBatch('elgg_get_entities_from_metadata', array('types' => 'user', 'metadata_names' => '__faker', 'limit' => 0));
$dbprefix = elgg_get_config('dbprefix');
foreach ($users as $user) {
    remove_entity_relationships($user->guid, 'friend');
    $query = "SELECT ag.id FROM {$dbprefix}access_collections ag WHERE ag.owner_guid = {$user->guid}";
    $acls = get_data($query);
    foreach ($acls as $col) {
        delete_access_collection($col->id);
    }
    $friends = elgg_get_entities_from_metadata(array('types' => 'user', 'limit' => $friends_count, 'order_by' => 'RAND()', 'wheres' => array("e.guid != {$user->guid}"), 'metadata_names' => '__faker'));
    $rand_friends = false;
    $collection_id = create_access_collection('Best Fake Friends Collection', $user->guid);
    if ($collection_id) {
        $rand_friends = array_rand($friends, rand(2, $friends_count));
        $collections++;
    }
    foreach ($friends as $friends_key => $friend) {
        if ($user->addFriend($friend->guid)) {
            $rels++;
            elgg_create_river_item(array('view' => 'river/relationship/friend/create', 'action_type' => 'friend', 'subject_guid' => $user->guid, 'object_guid' => $friend->guid));
            if ($rand_friends && array_key_exists($friends_key, $rand_friends)) {
                add_user_to_access_collection($friend->guid, $collection_id);
            }
开发者ID:royalterra,项目名称:hypeFaker,代码行数:30,代码来源:gen_friends.php

示例5: get_input

<?php

/**
 * Elgg friends: delete collection action
 *
 * @package Elgg.Core
 * @subpackage Friends.Collections
 */
$collection_id = (int) get_input('collection');
// check the ACL exists and we can edit
if (!can_edit_access_collection($collection_id)) {
    register_error(elgg_echo("friends:collectiondeletefailed"));
    forward(REFERER);
}
if (delete_access_collection($collection_id)) {
    system_message(elgg_echo("friends:collectiondeleted"));
} else {
    register_error(elgg_echo("friends:collectiondeletefailed"));
}
forward(REFERER);
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:20,代码来源:delete.php

示例6: testCanEditACLHook

 public function testCanEditACLHook()
 {
     // if only we supported closures!
     global $acl_test_info;
     $acl_id = create_access_collection('test acl');
     $acl_test_info = array('acl_id' => $acl_id, 'user' => $this->user);
     function test_acl_access_hook($hook, $type, $value, $params)
     {
         global $acl_test_info;
         if ($params['user_id'] == $acl_test_info['user']->guid) {
             $acl = get_access_collection($acl_test_info['acl_id']);
             $value[$acl->id] = $acl->name;
         }
         return $value;
     }
     elgg_register_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
     // enable security since we usually run as admin
     $ia = elgg_set_ignore_access(false);
     $result = can_edit_access_collection($acl_id, $this->user->guid);
     $this->assertTrue($result);
     $ia = elgg_set_ignore_access($ia);
     elgg_unregister_plugin_hook_handler('access:collections:write', 'all', 'test_acl_access_hook');
     delete_access_collection($acl_id);
 }
开发者ID:duanhv,项目名称:mdg-social,代码行数:24,代码来源:access_collections.php

示例7: gatekeeper

 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 */
// Make sure we're logged in (send us to the front page if not)
gatekeeper();
// Get input data
$collection_id = (int) get_input('collection');
// Check to see that the access collection exist and grab its owner
$get_collection = get_access_collection($collection_id);
if ($get_collection) {
    if ($get_collection->owner_guid == $_SESSION['user']->getGUID()) {
        $delete_collection = delete_access_collection($collection_id);
        // Success message
        if ($delete_collection) {
            system_message(elgg_echo("friends:collectiondeleted"));
        } else {
            register_error(elgg_echo("friends:collectiondeletefailed"));
        }
    } else {
        // Failure message
        register_error(elgg_echo("friends:collectiondeletefailed"));
    }
} else {
    // Failure message
    register_error(elgg_echo("friends:collectiondeletefailed"));
}
// Forward to the collections page
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:deletecollection.php

示例8: testAddMemberToACLRemoveMember

 public function testAddMemberToACLRemoveMember()
 {
     // create a new user to check against
     $user = new \ElggUser();
     $user->username = 'access_test_user';
     $user->save();
     $acl_id = create_access_collection('test acl');
     $result = add_user_to_access_collection($user->guid, $acl_id);
     $this->assertTrue($result);
     if ($result) {
         $this->assertTrue($user->delete());
         // since there are no more members this should return false
         $acl_members = get_members_of_access_collection($acl_id, true);
         $this->assertFalse($acl_members);
     }
     delete_access_collection($acl_id);
 }
开发者ID:elgg,项目名称:elgg,代码行数:17,代码来源:ElggCoreAccessCollectionsTest.php

示例9: process_group_deletion

/**
 * sort out acls when groups get deleted
 * @return boolean
 */
function process_group_deletion()
{
    $deletions = elgg_get_config('granular_access_deletions');
    if (!is_array($deletions)) {
        return true;
    }
    $guids = array_keys($deletions);
    // note these guids don't exist anymore
    $options = array('type' => 'object', 'subtype' => 'granular_access', 'metadata_name_value_pairs' => array('name' => 'access_list', 'value' => $guids), 'limit' => false);
    $batch = new ElggBatch('elgg_get_entities_from_metadata', $options);
    $ia = elgg_set_ignore_access(true);
    foreach ($batch as $granular_access) {
        if ($granular_access->single_group) {
            $granular_access->delete();
            continue;
        }
        $access_list = (array) $granular_access->access_list;
        // remove any of the guids from the access_list
        $access_list = array_diff($access_list, $guids);
        if (!$access_list) {
            // the access list is empty no need for this access
            delete_access_collection($granular_access->acl_id);
            $granular_access->delete();
            continue;
        }
        // make sure this doesn't just become a duplicate
        $token = get_token_from_guids($access_list);
        $entities = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'granular_access', 'metadata_name_value_pairs' => array('name' => 'token', 'value' => $token), 'wheres' => array("e.guid != {$granular_access->guid}")));
        if ($entities) {
            if (merge_access($granular_access, $entities[0])) {
                delete_access_collection($granular_access->acl_id);
                $granular_access->delete();
                continue;
            }
        }
        $granular_access->access_list = $access_list;
        repopulate_access_collection($granular_access);
    }
    elgg_set_config('granular_access_deletions', array());
    elgg_set_ignore_access($ia);
}
开发者ID:beck24,项目名称:granular_access,代码行数:45,代码来源:events.php

示例10: collect

 /**
  * handles the extended garbage collection
  *
  * @param string $hook        hookname
  * @param string $type        hooktype
  * @param mixed  $returnvalue current return value
  * @param mixed  $params      original parameters
  *
  * @return void
  */
 public static function collect($hook, $type, $returnvalue, $params)
 {
     if (elgg_get_plugin_setting('enable_gc', 'garbagecollector_extended') !== 'yes') {
         return;
     }
     elgg_register_plugin_hook_handler('permissions_check', 'all', '\\Elgg\\Values::getTrue');
     $dbprefix = elgg_get_config('dbprefix');
     // overrule access settigns
     $ia = elgg_get_ignore_access();
     elgg_set_ignore_access(true);
     // cleanup entities
     if ($entity_guids = garbagecollector_extended_get_orphaned_entities()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['entities']);
         foreach ($entity_guids as $guid) {
             $entity = get_entity($guid);
             if ($entity) {
                 $entity->delete();
             }
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup access collections
     if ($acl_ids = garbagecollector_extended_get_orphaned_access_collections()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['access collections']);
         foreach ($acl_ids as $id) {
             delete_access_collection($id);
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup annotations
     if ($anno_ids = garbagecollector_extended_get_orphaned_annotations()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['annotations']);
         foreach ($anno_ids as $id) {
             elgg_delete_annotation_by_id($id);
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup metadata
     if ($meta_ids = garbagecollector_extended_get_orphaned_metadata()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['metadata']);
         foreach ($meta_ids as $id) {
             // We need to manualy delete metadata as the Elgg functions don't work because this is orphaned metadata
             // also we need to delete this one by one because of potential long query strings
             $sql = 'DELETE FROM ' . $dbprefix . 'metadata';
             $sql .= ' WHERE id = ' . $id;
             delete_data($sql);
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup private settings
     if ($private_ids = garbagecollector_extended_get_orphaned_private_settings()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['private settings']);
         foreach ($private_ids as $id) {
             // We need to manualy delete private settings as Elgg doesn't have a function fot this
             // also we need to delete this one by one because of potential long query strings
             $sql = 'DELETE FROM ' . $dbprefix . 'private_settings';
             $sql .= ' WHERE id = ' . $id;
             delete_data($sql);
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup relationships
     if ($rel_ids = garbagecollector_extended_get_orphaned_relationships()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['relationships']);
         foreach ($rel_ids as $id) {
             delete_relationship($id);
         }
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // cleanup river
     if ($river_ids = garbagecollector_extended_get_orphaned_river()) {
         echo elgg_echo('garbagecollector_extended:cleanup', ['river items']);
         elgg_delete_river(['ids' => $river_ids]);
         echo elgg_echo('garbagecollector_extended:done') . '\\n';
     }
     // because we cleaned up a lot, do metastrings again
     garbagecollector_orphaned_metastrings();
     // restore access settings
     elgg_set_ignore_access($ia);
     elgg_unregister_plugin_hook_handler('permissions_check', 'all', '\\Elgg\\Values::getTrue');
 }
开发者ID:coldtrick,项目名称:garbagecollector_extended,代码行数:91,代码来源:GarbageCollector.php

示例11: testCanEditACL

 public function testCanEditACL()
 {
     $acl_id = create_access_collection('test acl', $this->user->guid);
     // should be true since it's the owner
     $result = can_edit_access_collection($acl_id, $this->user->guid);
     $this->assertTrue($result);
     // should be true since IA is on.
     $ia = elgg_set_ignore_access(true);
     $result = can_edit_access_collection($acl_id);
     $this->assertTrue($result);
     elgg_set_ignore_access($ia);
     // should be false since IA is off
     $ia = elgg_set_ignore_access(false);
     $result = can_edit_access_collection($acl_id);
     $this->assertFalse($result);
     elgg_set_ignore_access($ia);
     delete_access_collection($acl_id);
 }
开发者ID:risho,项目名称:Elgg,代码行数:18,代码来源:access_collections.php


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