Merge branch '3.1' into 3.2

Conflicts:
	admin/code/LeftAndMain.php
	composer.json
This commit is contained in:
Daniel Hensby 2015-08-17 11:43:28 +01:00
commit a8ab5a468d
10 changed files with 37 additions and 17 deletions

View File

@ -25,7 +25,6 @@ env:
matrix:
allow_failures:
- php: hhvm
- php: 7.0
- php: nightly
include:
@ -39,8 +38,6 @@ matrix:
env: DB=MYSQL BEHAT_TEST=1
- php: 5.3
env: DB=MYSQL
- php: 7.0
env: DB=MYSQL
- php: nightly
env: DB=MYSQL
- php: hhvm

View File

@ -247,14 +247,20 @@ class LeftAndMain extends Controller implements PermissionProvider {
// if no alternate menu items have matched, return a permission error
$messageSet = array(
'default' => _t('LeftAndMain.PERMDEFAULT',
"Please choose an authentication method and enter your credentials to access the CMS."),
'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY',
'default' => _t(
'LeftAndMain.PERMDEFAULT',
"You must be logged in to access the administration area; please enter your credentials below."
),
'alreadyLoggedIn' => _t(
'LeftAndMain.PERMALREADY',
"I'm sorry, but you can't access that part of the CMS. If you want to log in as someone else, do"
. " so below"),
'logInAgain' => _t('LeftAndMain.PERMAGAIN',
. " so below."
),
'logInAgain' => _t(
'LeftAndMain.PERMAGAIN',
"You have been logged out of the CMS. If you would like to log in again, enter a username and"
. " password below."),
. " password below."
),
);
return Security::permissionFailure($this, $messageSet);

View File

@ -354,6 +354,7 @@ abstract class ModelAdmin extends LeftAndMain {
$specRelations->push(new ArrayData(array('Name' => $name, 'Description' => $desc)));
}
$specHTML = $this->customise(array(
'ClassName' => str_replace('\\', '_', $className),
'ModelName' => Convert::raw2att($modelName),
'Fields' => $specFields,
'Relations' => $specRelations,

View File

@ -1,6 +1,6 @@
<div class="importSpec" id="SpecFor{$ModelName}">
<a href="#SpecDetailsFor{$ModelName}" class="detailsLink"><% sprintf(_t('ModelAdmin_ImportSpec_ss.IMPORTSPECLINK', 'Show Specification for %s'),$ModelName) %></a>
<div class="details" id="SpecDetailsFor{$ModelName}">
<div class="importSpec" id="SpecFor{$ClassName}">
<a href="#SpecDetailsFor{$ClassName}" class="detailsLink"><% sprintf(_t('ModelAdmin_ImportSpec_ss.IMPORTSPECLINK', 'Show Specification for %s'),$ModelName) %></a>
<div class="details" id="SpecDetailsFor{$ClassName}">
<h4><% sprintf(_t('ModelAdmin_ImportSpec_ss.IMPORTSPECTITLE', 'Specification for %s'),$ModelName) %></h4>
<h5><% _t('ModelAdmin_ImportSpec_ss.IMPORTSPECFIELDS', 'Database columns') %></h5>
<% loop $Fields %>

View File

@ -16,13 +16,13 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.3.3,<7",
"composer/installers": "~1.0"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7"
},
"autoload": {
"classmap": ["tests/behat/features/bootstrap"]
"classmap": ["tests/behat/features/bootstrap"]
}
}

View File

@ -166,6 +166,13 @@ class ClassInfo {
public static function class_name($nameOrObject) {
if (is_object($nameOrObject)) {
return get_class($nameOrObject);
} elseif (!self::exists($nameOrObject)) {
Deprecation::notice(
'4.0',
"ClassInfo::class_name() passed a class that doesn't exist. Support for this will be removed in 4.0",
Deprecation::SCOPE_GLOBAL
);
return $nameOrObject;
}
$reflection = new ReflectionClass($nameOrObject);

View File

@ -1,5 +1,5 @@
title: Caching
summary: Reduce rending time with cached templates and understand the limitations of the ViewableData object caching.
summary: Reduce rendering time with cached templates and understand the limitations of the ViewableData object caching.
# Caching

View File

@ -31,7 +31,7 @@ The benefit of constructing objects through this syntax is `ClassName` can be sw
MyClassName:
class: MyBetterClassName
Repeated calls to `create()` create a new class each time.
Repeated calls to `create()` create a new object each time.
:::php
$object = Injector::inst()->create('MyClassName');

View File

@ -111,7 +111,7 @@ class GridFieldSortableHeader implements GridField_HTMLProvider, GridField_DataM
if($tmpItem instanceof SS_List) {
// It's impossible to sort on a HasManyList/ManyManyList
break;
} elseif($tmpItem->hasMethod($methodName)) {
} elseif(method_exists($tmpItem, 'hasMethod') && $tmpItem->hasMethod($methodName)) {
// The part is a relation name, so get the object/list from it
$tmpItem = $tmpItem->$methodName();
} elseif($tmpItem instanceof DataObject && $tmpItem->hasField($methodName)) {

View File

@ -50,6 +50,15 @@ class ClassInfoTest extends SapphireTest {
);
}
public function testClassName() {
$this->assertEquals('ClassInfoTest', ClassInfo::class_name($this));
$this->assertEquals('ClassInfoTest', ClassInfo::class_name('ClassInfoTest'));
$this->assertEquals('ClassInfoTest', ClassInfo::class_name('CLaSsInfOTEsT'));
// This is for backwards compatiblity and will be removed in 4.0
$this->assertEquals('IAmAClassThatDoesNotExist', ClassInfo::class_name('IAmAClassThatDoesNotExist'));
}
public function testClassesForFolder() {
//$baseFolder = Director::baseFolder() . '/' . FRAMEWORK_DIR . '/tests/_ClassInfoTest';
//$manifestInfo = ManifestBuilder::get_manifest_info($baseFolder);