Improvements to better allow for CLI-based testing

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60577 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-08-13 01:43:09 +00:00
parent 222a1a139f
commit 48b60fa710

View File

@ -128,6 +128,9 @@ class Member extends DataObject {
* quirky problems (such as using the Windmill 0.3.6 proxy). * quirky problems (such as using the Windmill 0.3.6 proxy).
*/ */
static function session_regenerate_id() { static function session_regenerate_id() {
// This can be called via CLI during testing.
if(Director::is_cli()) return;
$file = ""; $line = ""; $file = ""; $line = "";
if (!headers_sent($file, $line)) session_regenerate_id(true); if (!headers_sent($file, $line)) session_regenerate_id(true);
else user_error("Content already sent at line $line in $file, can't call session_regenerate_id", E_USER_WARNING); else user_error("Content already sent at line $line in $file, can't call session_regenerate_id", E_USER_WARNING);
@ -716,8 +719,7 @@ class Member extends DataObject {
$groupIDs = $groups->column(); $groupIDs = $groups->column();
$collatedGroups = array(); $collatedGroups = array();
foreach($groups as $group) { foreach($groups as $group) {
$collatedGroups = array_merge((array)$collatedGroups, $collatedGroups = array_merge((array)$collatedGroups, $group->collateAncestorIDs());
$group->collateAncestorIDs());
} }
$table = "Group_Members"; $table = "Group_Members";
@ -729,8 +731,9 @@ class Member extends DataObject {
$result = new ComponentSet(); $result = new ComponentSet();
// Only include groups where allowedIPAddress() returns true // Only include groups where allowedIPAddress() returns true
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
foreach($unfilteredGroups as $group) { foreach($unfilteredGroups as $group) {
if($group->allowedIPAddress($_SERVER['REMOTE_ADDR'])) $result->push($group); if($group->allowedIPAddress($ip)) $result->push($group);
} }
} else { } else {
$result = new Member_GroupSet(); $result = new Member_GroupSet();