aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt1
-rw-r--r--engine/lib/access.php4
-rw-r--r--engine/lib/annotations.php3
-rw-r--r--engine/lib/elgglib.php53
-rw-r--r--engine/lib/entities.php9
-rw-r--r--engine/lib/group.php8
-rw-r--r--engine/lib/metadata.php4
-rw-r--r--engine/lib/objects.php6
-rw-r--r--engine/lib/relationships.php6
-rw-r--r--engine/lib/sites.php4
-rw-r--r--engine/lib/users.php8
-rw-r--r--views/default/group/search/finishblurb.php2
-rw-r--r--views/default/group/search/startblurb.php2
-rw-r--r--views/default/user/search/finishblurb.php2
-rw-r--r--views/default/user/search/startblurb.php2
15 files changed, 81 insertions, 33 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c47d2ff3..2e8e658a2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -38,6 +38,7 @@ http://code.elgg.org/elgg/.....
* can_write_to_container() can be overridden with the container_permissions_check hook. #1164 (part 2).
* Deprecated search_for_*().
* Deprecated search_list*().
+ * Added elgg_deprecated_notice().
Services API:
* Separated user and api authenticate processing
diff --git a/engine/lib/access.php b/engine/lib/access.php
index b508f1fc0..4c448721f 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -671,7 +671,7 @@ function elgg_view_access_collections($owner_guid) {
*/
function get_entities_from_access_id($collection_id, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) {
// log deprecated warning
- elgg_log('get_entities_from_access_id() was deprecated in 1.7 by elgg_get_entities()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_access_id() was deprecated by elgg_get_entities()!', 1.7);
if (!$collection_id) {
return FALSE;
@@ -875,4 +875,4 @@ register_elgg_event_handler('init', 'system', 'access_init', 9999);
// For overrided permissions
register_plugin_hook('permissions_check', 'all', 'elgg_override_permissions_hook');
-register_plugin_hook('container_permissions_check', 'all', 'elgg_override_permissions_hook'); \ No newline at end of file
+register_plugin_hook('container_permissions_check', 'all', 'elgg_override_permissions_hook');
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 6d5c0b46a..105282c8c 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -695,8 +695,7 @@ function elgg_get_entity_annotation_where_sql($table, $names = NULL, $values = N
function get_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", $value = "",
$owner_guid = 0, $group_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $count = false,
$timelower = 0, $timeupper = 0) {
-
- elgg_log('get_entities_from_annotations() was deprecated in 1.7 by elgg_get_entities_from_annotations()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_annotations() was deprecated by elgg_get_entities_from_annotations().', 1.3);
$options = array();
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 698a34b93..cd426309d 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -561,7 +561,7 @@ function elgg_get_views($dir, $base) {
* @param $base
*/
function get_views($dir, $base) {
- elgg_log('get_views() was deprecated in 1.7 by elgg_get_views()!', 'WARNING');
+ elgg_deprecated_notice('get_views() was deprecated by elgg_get_views()!', 1.7);
elgg_get_views($dir, $base);
}
@@ -1112,7 +1112,7 @@ function elgg_extend_view($view, $view_name, $priority = 501, $viewtype = '') {
* @param $viewtype
*/
function extend_view($view, $view_name, $priority = 501, $viewtype = '') {
- elgg_log('extend_view() was deprecated in 1.7 by elgg_extend_view()!', 'WARNING');
+ elgg_deprecated_notice('extend_view() was deprecated by elgg_extend_view()!', 1.7);
elgg_extend_view($view, $view_name, $priority, $viewtype);
}
@@ -2076,6 +2076,55 @@ function run_function_once($functionname, $timelastupdatedcheck = 0) {
}
}
+/**
+ * Sends a notice about deprecated use of a function, view, etc.
+ * Note: This will ALWAYS at least log a warning. Don't use to pre-deprecate things.
+ * This assume we are releasing in order and deprecating according to policy.
+ *
+ * @param str $msg Message to log / display.
+ * @param str $version human-readable *release* version the function was deprecated. No bloody A, B, (R)C, or D.
+ *
+ * @return bool
+ */
+function elgg_deprecated_notice($msg, $dep_version) {
+ // if it's a major release behind, visual and logged
+ // if it's a 2 minor releases behind, visual and logged
+ // if it's 1 minor release behind, logged.
+ // bugfixes don't matter because you're not deprecating between the, RIGHT?
+
+ if (!$dep_version) {
+ return FALSE;
+ }
+
+ $elgg_version = get_version(TRUE);
+ $elgg_version_arr = explode('.', $elgg_version);
+ $elgg_major_version = $elgg_version_arr[0];
+ $elgg_minor_version = $elgg_version_arr[1];
+
+ $dep_version_arr = explode('.', $dep_version);
+ $dep_major_version = $dep_version_arr[0];
+ $dep_minor_version = $dep_version_arr[1];
+
+ $last_working_version = $dep_minor_version - 1;
+
+ $visual = FALSE;
+
+ // use version_compare to account for 1.7a < 1.7
+ if (($dep_major_version < $elgg_major_version)
+ || (($elgg_minor_version - $last_working_version) > 1)) {
+ $visual = TRUE;
+ }
+
+ $msg = "Deprecated in $dep_version: $msg";
+
+ elgg_log($msg, 'WARNING');
+
+ if ($visual) {
+ register_error($msg);
+ }
+
+ return TRUE;
+}
/**
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 2519400d6..485a45cf1 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1841,8 +1841,7 @@ function elgg_get_entities(array $options = array()) {
*/
function get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0,
$count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupper = 0) {
-
- elgg_log('get_entities() was deprecated in 1.7 by elgg_get_entities()!', 'WARNING');
+ elgg_deprecated_notice('get_entities() was deprecated by elgg_get_entities().', 1.7);
// rewrite owner_guid to container_guid to emulate old functionality
$container_guid = $owner_guid;
$owner_guid = NULL;
@@ -2215,7 +2214,7 @@ function elgg_list_entities($options) {
* @return unknown_type
*/
function list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) {
- elgg_log('list_entities() was deprecated in 1.7. Use elgg_list_entities()!', 'WARNING');
+ elgg_deprecated_notice('list_entities() was deprecated by elgg_list_entities()!', 1.7);
$options = array();
@@ -2529,7 +2528,7 @@ function delete_entity($guid, $recursive = true) {
* @param int $owner_guid The GUID of the owning user
*/
function delete_entities($type = "", $subtype = "", $owner_guid = 0) {
- elgg_log('delete_entities() was deprecated in 1.7 because no one should use it.');
+ elgg_deprecated_notice('delete_entities() was deprecated because no one should use it.', 1.7);
return false;
}
@@ -3051,7 +3050,7 @@ function entities_page_handler($page) {
* @return unknown_type
*/
function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $allowedtypes = true) {
- elgg_log('list_registered_entities() was deprecated in 1.7 by elgg_list_registered_entities().', 'WARNING');
+ elgg_deprecated_notice('list_registered_entities() was deprecated by elgg_list_registered_entities().', 1.7);
$options = array();
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 3a6f3adf1..ab6a7d3be 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -48,7 +48,7 @@ class ElggGroup extends ElggEntity
}
// Is $guid is an ElggGroup? Use a copy constructor
else if ($guid instanceof ElggGroup) {
- elgg_log('This type of usage of the ElggGroup constructor was deprecated in 1.7. Please use the clone method.', 'WARNING');
+ elgg_deprecated_notice('This type of usage of the ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
@@ -870,7 +870,7 @@ function add_group_tool_option($name,$label,$default_on=true) {
* @deprecated 1.7
*/
function search_for_group($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) {
- elgg_log('search_for_group() was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_for_group() was deprecated by new search plugin.', 1.7);
global $CONFIG;
$criteria = sanitise_string($criteria);
@@ -910,7 +910,7 @@ function search_for_group($criteria, $limit = 10, $offset = 0, $order_by = "", $
* @deprecated 1.7
*/
function search_list_groups_by_name($hook, $user, $returnvalue, $tag) {
- elgg_log('search_list_groups_by_name() was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_list_groups_by_name() was deprecated by new search plugin', 1.7);
// Change this to set the number of groups that display on the search page
$threshold = 4;
@@ -941,7 +941,7 @@ function search_list_groups_by_name($hook, $user, $returnvalue, $tag) {
* @deprecated 1.7
*/
function list_group_search($tag, $limit = 10) {
- elgg_log('list_group_search() was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('list_group_search() was deprecated by new search plugin.', 1.7);
$offset = (int) get_input('offset');
$limit = (int) $limit;
$count = (int) search_for_group($tag, 10, 0, '', true);
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index ea86616a8..17835e07e 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -785,7 +785,7 @@ function get_entities_from_metadata($meta_name, $meta_value = "", $entity_type =
$owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
$count = FALSE, $case_sensitive = TRUE) {
- elgg_log('get_entities_from_metadata() was deprecated in 1.7 by elgg_get_entities_from_metadata()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_metadata() was deprecated by elgg_get_entities_from_metadata()!', 1.7);
$options = array();
@@ -875,7 +875,7 @@ function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type
function get_entities_from_metadata_multi($meta_array, $entity_type = "", $entity_subtype = "",
$owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0,
$count = false, $meta_array_operator = 'and') {
- elgg_log('get_entities_from_metadata_multi() was deprecated in 1.7 by elgg_get_entities_from_metadata()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_metadata_multi() was deprecated by elgg_get_entities_from_metadata()!', 1.7);
if (!is_array($meta_array) || sizeof($meta_array) == 0) {
return false;
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index 8f49ea1fa..331578ed6 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -54,7 +54,7 @@ class ElggObject extends ElggEntity {
// Is $guid is an ElggObject? Use a copy constructor
else if ($guid instanceof ElggObject) {
- elgg_log('This type of usage of the ElggObject constructor was deprecated in 1.7. Please use the clone method.', 'WARNING');
+ elgg_deprecated_notice('This type of usage of the ElggObject constructor was deprecated. Please use the clone method.', 1.7);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
@@ -296,7 +296,7 @@ function delete_object_entity($guid) {
* @deprecated 1.7
*/
function search_for_object($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) {
- elgg_log('search_for_object was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_for_object() was deprecated by new search plugin.', 1.7);
global $CONFIG;
$criteria = sanitise_string($criteria);
@@ -361,7 +361,7 @@ function objects_test($hook, $type, $value, $params) {
*
*/
function search_list_objects_by_name($hook, $user, $returnvalue, $tag) {
- elgg_log('search_list_objects_by_name was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_list_objects_by_name was deprecated by new search plugin.', 1.7);
// Change this to set the number of users that display on the search page
$threshold = 4;
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index c1f54472a..979d3ea67 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -598,7 +598,7 @@ function get_entities_from_relationship($relationship, $relationship_guid, $inve
$type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0,
$count = false, $site_guid = 0) {
- elgg_log('get_entities_from_relationship() was deprecated in 1.7 by elgg_get_entities_from_relationship()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_relationship() was deprecated by elgg_get_entities_from_relationship()!', 1.7);
$options = array();
@@ -801,7 +801,7 @@ function list_entities_by_relationship_count($relationship, $inverse_relationshi
* @return array|int|false An array of entities, or the number of entities, or false on failure
*/
function get_entities_from_relationships_and_meta($relationship, $relationship_guid, $inverse_relationship = false, $meta_name = "", $meta_value = "", $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $count = false, $site_guid = 0) {
- elgg_log('get_entities_from_relationship_and_meta() was deprecated in 1.7 by elgg_get_entities_from_relationship()!', 'WARNING');
+ elgg_deprecated_notice('get_entities_from_relationship_and_meta() was deprecated by elgg_get_entities_from_relationship()!', 1.7);
$options = array();
@@ -1052,4 +1052,4 @@ register_plugin_hook("import", "all", "import_relationship_plugin_hook", 3);
register_plugin_hook("export", "all", "export_relationship_plugin_hook", 3);
/** Register event to listen to some events **/
-register_elgg_event_handler('create','friend','relationship_notification_hook'); \ No newline at end of file
+register_elgg_event_handler('create','friend','relationship_notification_hook');
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index c69032bd2..e9da4bdab 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -54,7 +54,7 @@ class ElggSite extends ElggEntity {
// Is $guid is an ElggSite? Use a copy constructor
else if ($guid instanceof ElggSite) {
- elgg_log('This type of usage of the ElggSite constructor was deprecated in 1.7. Please use the clone method.', 'WARNING');
+ elgg_deprecated_notice('This type of usage of the ElggSite constructor was deprecated. Please use the clone method.', 1.7);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
@@ -504,7 +504,7 @@ function get_site_by_url($url) {
* @deprecated 1.7
*/
function search_for_site($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) {
- elgg_log('search_for_site() was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_for_site() was deprecated by new search plugin.', 1.7);
global $CONFIG;
$criteria = sanitise_string($criteria);
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 5e5486133..3f866754f 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -75,7 +75,7 @@ class ElggUser extends ElggEntity
// Is $guid is an ElggUser? Use a copy constructor
else if ($guid instanceof ElggUser) {
- elgg_log('This type of usage of the ElggUser constructor was deprecated in 1.7. Please use the clone method.', 'WARNING');
+ elgg_deprecated_notice('This type of usage of the ElggUser constructor was deprecated. Please use the clone method.', 1.7);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
@@ -872,7 +872,7 @@ function get_user_by_email($email) {
* @deprecated 1.7
*/
function search_for_user($criteria, $limit = 10, $offset = 0, $order_by = "", $count = false) {
- elgg_log('search_for_user() was deprecated in 1.7.', 'WARNING');
+ elgg_deprecated_notice('search_for_user() was deprecated by new search.', 1.7);
global $CONFIG;
$criteria = sanitise_string($criteria);
@@ -918,7 +918,7 @@ function search_for_user($criteria, $limit = 10, $offset = 0, $order_by = "", $c
* @deprecated 1.7
*/
function list_user_search($tag, $limit = 10) {
- elgg_log('list_user_search() deprecated in 1.7', 'WARNING');
+ elgg_deprecated_notice('list_user_search() deprecated by new search', 1.7);
$offset = (int) get_input('offset');
$limit = (int) $limit;
$count = (int) search_for_user($tag, 10, 0, '', true);
@@ -1547,7 +1547,7 @@ function users_init() {
* @deprecated 1.7
*/
function search_list_users_by_name($hook, $user, $returnvalue, $tag) {
- elgg_log('search_list_users_by_name() was deprecated in 1.7', 'WARNING');
+ elgg_deprecated_notice('search_list_users_by_name() was deprecated by new search', 1.7);
// Change this to set the number of users that display on the search page
$threshold = 4;
diff --git a/views/default/group/search/finishblurb.php b/views/default/group/search/finishblurb.php
index a030fbac5..9d3759cb3 100644
--- a/views/default/group/search/finishblurb.php
+++ b/views/default/group/search/finishblurb.php
@@ -6,7 +6,7 @@
* @link http://elgg.org/
* @deprecated 1.7
*/
-elgg_log('view groups/search/finishblurb was deprecated in 1.7', 'WARNING');
+elgg_deprecated_notice('view groups/search/finishblurb was deprecated.', 1.7);
if ($vars['count'] > $vars['threshold']) {
diff --git a/views/default/group/search/startblurb.php b/views/default/group/search/startblurb.php
index 64425af69..f3acfaf5a 100644
--- a/views/default/group/search/startblurb.php
+++ b/views/default/group/search/startblurb.php
@@ -6,7 +6,7 @@
* @link http://elgg.org/
* @deprecated 1.7
*/
-elgg_log('view groups/search/startblurb was deprecated in 1.7', 'WARNING');
+elgg_deprecated_notice('view groups/search/startblurb was deprecated.', 1.7);
?>
<div class="contentWrapper">
diff --git a/views/default/user/search/finishblurb.php b/views/default/user/search/finishblurb.php
index 87ab0b60d..a8c14f357 100644
--- a/views/default/user/search/finishblurb.php
+++ b/views/default/user/search/finishblurb.php
@@ -7,7 +7,7 @@
* @deprecated 1.7
*/
-elgg_log('view user/search/finishblurb was deprecated in 1.7', 'WARNING');
+elgg_deprecated_notice('view user/search/finishblurb was deprecated.', 1.7);
if ($vars['count'] > $vars['threshold']) {
diff --git a/views/default/user/search/startblurb.php b/views/default/user/search/startblurb.php
index 2866ba9ad..e069ec460 100644
--- a/views/default/user/search/startblurb.php
+++ b/views/default/user/search/startblurb.php
@@ -7,7 +7,7 @@
* @link http://elgg.org/
*/
-elgg_log('view user/search/startblurb was deprecated in 1.7', 'WARNING');
+elgg_deprecated_notice('view user/search/startblurb was deprecated.', 1.7);
?>
<div class="contentWrapper">