diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-16 12:35:43 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-16 12:35:43 +0000 |
commit | cc76d0a9ecb840d071bfbba1cd66f503f9dc2142 (patch) | |
tree | e8387ea436b715da34a0de50f3ab9a70e5744933 | |
parent | afe892810e6736739df91e6618399160690b606b (diff) | |
download | elgg-cc76d0a9ecb840d071bfbba1cd66f503f9dc2142.tar.gz elgg-cc76d0a9ecb840d071bfbba1cd66f503f9dc2142.tar.bz2 |
Closes #442: Requires schema upgrade. Side effect - friends activity rivers will be blanked.
git-svn-id: https://code.elgg.org/elgg/trunk@2267 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/river.php | 10 | ||||
-rw-r--r-- | engine/lib/system_log.php | 11 | ||||
-rw-r--r-- | engine/schema/mysql.sql | 3 | ||||
-rw-r--r-- | engine/schema/upgrades/2008101601.sql | 11 | ||||
-rw-r--r-- | version.php | 4 |
5 files changed, 33 insertions, 6 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php index 0952ad965..4db00d18c 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -158,7 +158,7 @@ function __get_river_from_log($by_user = "", $relationship = "", $limit = 10, $offset = 0) { global $CONFIG; - + // Get all potential river events from available view $river_events = array(); $river_views = elgg_view_tree('river'); @@ -200,7 +200,11 @@ if (($details['type']) && ($details['event'])) { if ($n>0) $obj_query .= " or "; - $obj_query .= "( sl.object_type='{$details['type']}' and sl.object_subtype='{$details['subtype']}' and sl.event='{$details['event']}' )"; + $access = ""; + if ($details['type']!='relationship') + $access = " and " . get_access_sql_suffix('sl'); + + $obj_query .= "( sl.object_type='{$details['type']}' and sl.object_subtype='{$details['subtype']}' and sl.event='{$details['event']}' $access )"; $n++; } @@ -220,7 +224,7 @@ } $query = "SELECT sl.* from {$CONFIG->dbprefix}system_log sl $relationship_join where $user and $relationship_query ($obj_query) order by sl.time_created desc limit $offset, $limit"; - +echo $query; // fetch data from system log (needs optimisation) return get_data($query); } diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index d315d453f..1bbde9231 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -204,9 +204,18 @@ $time = time(); $performed_by = (int)$_SESSION['guid']; + if (isset($object->access_id)) + $access_id = $object->access_id; + else + $access_id = 2; + if (isset($object->enabled)) + $enabled = $object->enabled; + else + $enabled = 'yes'; + // Create log if we haven't already created it
if (!isset($logcache[$time][$object_id][$event])) { - if (insert_data("INSERT DELAYED into {$CONFIG->dbprefix}system_log (object_id, object_class, object_type, object_subtype, event, performed_by_guid, time_created) VALUES ('$object_id','$object_class','$object_type', '$object_subtype', '$event',$performed_by, '$time')")) {
+ if (insert_data("INSERT DELAYED into {$CONFIG->dbprefix}system_log (object_id, object_class, object_type, object_subtype, event, performed_by_guid, access_id, enabled, time_created) VALUES ('$object_id','$object_class','$object_type', '$object_subtype', '$event',$performed_by, $access_id, '$enabled', '$time')")) {
$logcache[$time][$object_id][$event] = true;
return true;
}
diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql index 0ef2c8b8c..35c079004 100644 --- a/engine/schema/mysql.sql +++ b/engine/schema/mysql.sql @@ -289,6 +289,8 @@ CREATE TABLE `prefix_system_log` ( `event` varchar(50) NOT NULL,
`performed_by_guid` int(11) NOT NULL,
+
+ `access_id` int(11) NOT NULL,
`time_created` int(11) NOT NULL,
@@ -299,6 +301,7 @@ CREATE TABLE `prefix_system_log` ( KEY `object_subtype` (`object_subtype`),
KEY `event` (`event`),
KEY `performed_by_guid` (`performed_by_guid`),
+ KEY `access_id` (`access_id`),
KEY `time_created` (`time_created`),
KEY `river_key` (`object_type`, `object_subtype`, `event`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/engine/schema/upgrades/2008101601.sql b/engine/schema/upgrades/2008101601.sql new file mode 100644 index 000000000..cd10eb024 --- /dev/null +++ b/engine/schema/upgrades/2008101601.sql @@ -0,0 +1,11 @@ +ALTER TABLE `prefix_system_log` ADD COLUMN `access_id` int(11) NOT NULL AFTER `performed_by_guid`; +ALTER TABLE `prefix_system_log` ADD COLUMN `enabled` enum ('yes', 'no') NOT NULL default 'yes' AFTER `access_id`; + +ALTER TABLE `prefix_system_log` DROP KEY `access_id`; +ALTER TABLE `prefix_system_log` ADD KEY `access_id` (`access_id`); + +ALTER TABLE `prefix_system_log` DROP KEY `enabled`; +ALTER TABLE `prefix_system_log` ADD KEY `enabled` (`enabled`); + +ALTER TABLE `prefix_system_log` DROP KEY `river_key`; +ALTER TABLE `prefix_system_log` ADD KEY `river_key` (`object_type`, `object_subtype`, `event`, `access_id`, `enabled`);
\ No newline at end of file diff --git a/version.php b/version.php index 60195c047..38e5d01a7 100644 --- a/version.php +++ b/version.php @@ -13,9 +13,9 @@ * @link http://elgg.org/
*/
- $version = 2008101303; // YYYYMMDD = Elgg Date
+ $version = 2008101601; // YYYYMMDD = Elgg Date
// XX = Interim incrementer
- $release = '1.08'; // Human-friendly version name
+ $release = '1.09'; // Human-friendly version name
?>
\ No newline at end of file |