]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1496: delete_access_collection() invalidates the access collection cache befor...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 8 Feb 2010 15:43:39 +0000 (15:43 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 8 Feb 2010 15:43:39 +0000 (15:43 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3922 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/access.php
engine/tests/api/entity_getter_functions.php

index 4c448721f3896f6b84e07044802d9e78635ec4bb..d9c241e7a4d04c72fca657d1b13677cdc02f9a42 100644 (file)
@@ -373,9 +373,9 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) {
                $query .= " AND (ag.owner_guid = {$user_id})";
                $query .= " AND ag.id >= 3";
 
-               $tmp_access_array = array(      ACCESS_PRIVATE => elgg_echo("PRIVATE"), 
-                                                                       ACCESS_FRIENDS => elgg_echo("access:friends:label"), 
-                                                                       ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), 
+               $tmp_access_array = array(      ACCESS_PRIVATE => elgg_echo("PRIVATE"),
+                                                                       ACCESS_FRIENDS => elgg_echo("access:friends:label"),
+                                                                       ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
                                                                        ACCESS_PUBLIC => elgg_echo("PUBLIC"));
                if ($collections = get_data($query)) {
                        foreach($collections as $collection) {
@@ -489,7 +489,7 @@ function update_access_collection($collection_id, $members) {
 function delete_access_collection($collection_id) {
 
        $collection_id = (int) $collection_id;
-       $collections = get_write_access_array();
+       $collections = get_write_access_array(null, null, TRUE);
        $params = array('collection_id' => $collection_id);
 
        if (!trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) {
index 579b3cea0226c09a07b74a6cd85e4b9123b733c8..d09f1066d1026d5a7298da89ae9473e63b81e292 100644 (file)
@@ -25,19 +25,14 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
                        'object' => array(),
                        'user' => array(),
                        'group' => array(),
-               //'site'        => array()
+                       //'site'        => array()
                );
 
                // sites are a bit wonky.  Don't use them just now.
                $this->types = array('object', 'user', 'group');
 
                // create some fun objects to play with.
-               // one with no subtype
-//             $e = new ElggObject();
-//             $e->subtype = $subtype;
-//             $e->save();
-
-               // and 5 with random subtypes
+               // 5 with random subtypes
                for ($i=0; $i<5; $i++) {
                        $subtype = "test_object_subtype_" . rand();
                        $e = new ElggObject();
@@ -74,10 +69,8 @@ class ElggCoreEntityGetterFunctionsTest extends ElggCoreUnitTest {
         */
        public function tearDown() {
                //$this->swallowErrors();
-
                foreach ($this->entities as $e) {
                        $e->delete();
-                       unset($this->entities);
                }
        }