Merge remote-tracking branch 'origin/1.3' into 1

This commit is contained in:
Robbie Averill 2017-08-02 14:49:52 +12:00
commit a4f647c9ed
3 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,8 @@
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
language: php
language: php
sudo: false
sudo: false
@ -8,7 +10,7 @@ php:
- 5.4
env:
- DB=MYSQL CORE_RELEASE=3.2
- DB=MYSQL CORE_RELEASE=3.5
matrix:
include:
@ -17,18 +19,20 @@ matrix:
- php: 5.6
env: DB=MYSQL CORE_RELEASE=3
- php: 5.4
env: DB=MYSQL CORE_RELEASE=3.2 BEHAT_TEST=1
env: DB=MYSQL CORE_RELEASE=3.5 BEHAT_TEST=1
- php: 7.1
env: DB=MYSQL CORE_RELEASE=3.6
before_script:
- composer self-update
- phpenv rehash
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
- "if [ \"$BEHAT_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi"
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/behat-extension; fi"
- cd ~/builds/ss
- php ~/travis-support/travis_setup_selenium.php --if-env BEHAT_TEST
- php ~/travis-support/travis_setup_php54_webserver.php --if-env BEHAT_TEST
script:
script:
- "if [ \"$BEHAT_TEST\" = \"\" ]; then vendor/bin/phpunit subsites/tests; fi"
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then vendor/bin/behat @subsites; fi"

View File

@ -198,7 +198,7 @@ class Subsite extends DataObject
}
$subsiteID = $subsiteIDs[0];
} elseif ($default = DataObject::get_one('Subsite', "\"DefaultSite\" = 1")) {
} elseif ($default = Subsite::get()->filter('DefaultSite', 1)->setQueriedColumns(array('ID'))->first()) {
// Check for a 'default' subsite
$subsiteID = $default->ID;
} else {
@ -488,7 +488,7 @@ class Subsite extends DataObject
INNER JOIN \"Group\" ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1
INNER JOIN \"Group_Members\" ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"
WHERE \"Permission\".\"Code\" IN ('$SQL_perms')
AND \"MemberID\" = {$memberID}
AND \"Group_Members\".\"MemberID\" = {$memberID}
")->value();
// Count this user's groups which have a role that can access the main site
@ -501,7 +501,7 @@ class Subsite extends DataObject
INNER JOIN \"PermissionRoleCode\" ON \"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\"
WHERE \"PermissionRoleCode\".\"Code\" IN ('$SQL_perms')
AND \"Group\".\"AccessAllSubsites\" = 1
AND \"MemberID\" = {$memberID}
AND \"Group_Members\".\"MemberID\" = {$memberID}
")->value();
// There has to be at least one that allows access.

View File

@ -17,5 +17,5 @@
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
}
}
}