From a5c6bc6ee1e3bfbb29b887d8420e0828cfd7e9cf Mon Sep 17 00:00:00 2001 From: Jeremy Thomerson Date: Mon, 23 Jan 2012 14:28:55 -0500 Subject: [PATCH 1/2] Fix typo in function name There was a function named "SiteTree::prepopuplate_permission_cache" which should be "SiteTree::prepopulate_permission_cache". --- code/model/SiteTree.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 3c5f21b7..d5da65a9 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1009,7 +1009,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @param $batchCallBack The function/static method to call to calculate permissions. Defaults * to 'SiteTree::can_(permission)_multiple' */ - static function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) { + static function prepopulate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) { if(!$batchCallback) $batchCallback = "SiteTree::can_{$permission}_multiple"; //PHP 5.1 requires an array rather than a string for the call_user_func function @@ -1018,7 +1018,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(is_callable($batchCallback)) { call_user_func($batchCallback, $ids, Member::currentUserID(), false); } else { - user_error("SiteTree::prepopuplate_permission_cache can't calculate '$permission' " + user_error("SiteTree::prepopulate_permission_cache can't calculate '$permission' " . "with callback '$batchCallback'", E_USER_WARNING); } } From 82bb4ca2f587b806b71fb0f43027985c0d17a324 Mon Sep 17 00:00:00 2001 From: Jeremy Thomerson Date: Mon, 23 Jan 2012 15:23:42 -0500 Subject: [PATCH 2/2] Add a deprecation-friendly version of the prepopulate_permission_cache function Add a function with the old function name that adds a deprecation warning for users but forwards the call to the renamed function for backwards-compatibility. --- code/model/SiteTree.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index d5da65a9..775fe36a 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -999,6 +999,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid } } + /** + * @deprecated 3.0 Use prepopulate_permission_cache() instead + */ + static function prepopuplate_permission_cache($permission = 'CanEditType', $ids, $batchCallback = null) { + Deprecation::notice("3.0", "Use prepopulate_permission_cache instead."); + self::prepopulate_permission_cache($permission, $ids, $batchCallback); + } /** * Pre-populate the cache of canEdit, canView, canDelete, canPublish permissions.