BUGFIX Don't fail SiteTree::batch_permission_check() is no published pages exist

This commit is contained in:
Ingo Schommer 2011-09-14 08:41:15 +02:00
parent e26d249d60
commit 987eedf9ba

View File

@ -1099,8 +1099,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Start by filling the array with the pages that actually exist // Start by filling the array with the pages that actually exist
$table = ($stage=='Stage') ? "SiteTree" : "SiteTree_$stage"; $table = ($stage=='Stage') ? "SiteTree" : "SiteTree_$stage";
$result = array_fill_keys(DB::query("SELECT \"ID\" FROM \"$table\" $result = array_fill_keys(
WHERE \"ID\" IN (".implode(", ", $ids).")")->column(), false); ($ids) ? DB::query("SELECT \"ID\" FROM \"$table\" WHERE \"ID\" IN (".implode(", ", $ids).")")->column() : array(),
false
);
// Get the uninherited permissions // Get the uninherited permissions
$uninheritedPermissions = Versioned::get_by_stage("SiteTree", $stage, "(\"$typeField\" = 'LoggedInUsers' OR $uninheritedPermissions = Versioned::get_by_stage("SiteTree", $stage, "(\"$typeField\" = 'LoggedInUsers' OR