Made GroupSubsites respect disable_subsite_filter, and added an accessor method for 3rd parties to use this functionality.

This commit is contained in:
Sam Minnee 2008-08-21 05:50:38 +00:00
parent 62ec1d1a6f
commit 46edecfca2
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,8 @@ class GroupSubsites extends DataObjectDecorator {
* Update any requests to limit the results to the current site
*/
function augmentSQL(SQLQuery &$query) {
if(Subsite::$disable_subsite_filter) return;
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
if(!$query->where || (strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false)) {

View File

@ -356,6 +356,13 @@ SQL;
self::$disable_subsite_filter = false;
return $result;
}
/**
* Disable the sub-site filtering; queries will select from all subsites
*/
static function disable_subsite_filter($disabled = true) {
self::$disable_subsite_filter = $disabled;
}
}
/**