mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge remote branch 'origin/master' into translation-staging
This commit is contained in:
commit
936f78a079
@ -98,7 +98,9 @@ class Cookie {
|
|||||||
* @param boolean $secure See http://php.net/set_session
|
* @param boolean $secure See http://php.net/set_session
|
||||||
* @param boolean $httpOnly See http://php.net/set_session
|
* @param boolean $httpOnly See http://php.net/set_session
|
||||||
*/
|
*/
|
||||||
protected function inst_set($name, $value, $expiry = 90, $path = null, $domain = null, $secure = false, $httpOnly = false) {
|
protected function inst_set($name, $value, $expiry = 90, $path = null,
|
||||||
|
$domain = null, $secure = false, $httpOnly = false
|
||||||
|
) {
|
||||||
if(!headers_sent($file, $line)) {
|
if(!headers_sent($file, $line)) {
|
||||||
$expiry = $expiry > 0 ? time()+(86400*$expiry) : $expiry;
|
$expiry = $expiry > 0 ? time()+(86400*$expiry) : $expiry;
|
||||||
$path = ($path) ? $path : Director::baseURL();
|
$path = ($path) ? $path : Director::baseURL();
|
||||||
|
@ -559,7 +559,10 @@ abstract class SS_Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->transAlterField($table, $field, $spec_orig);
|
$this->transAlterField($table, $field, $spec_orig);
|
||||||
$this->alterationMessage("Field $table.$field: changed to $specValue <i style=\"color: #AAA\">(from {$fieldValue})</i>","changed");
|
$this->alterationMessage(
|
||||||
|
"Field $table.$field: changed to $specValue <i style=\"color: #AAA\">(from {$fieldValue})</i>",
|
||||||
|
"changed"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +857,9 @@ class MySQLDatabase extends SS_Database {
|
|||||||
// We make the relevance search by converting a boolean mode search into a normal one
|
// We make the relevance search by converting a boolean mode search into a normal one
|
||||||
$relevanceKeywords = str_replace(array('*','+','-'),'',$keywords);
|
$relevanceKeywords = str_replace(array('*','+','-'),'',$keywords);
|
||||||
$htmlEntityRelevanceKeywords = str_replace(array('*','+','-'),'',$htmlEntityKeywords);
|
$htmlEntityRelevanceKeywords = str_replace(array('*','+','-'),'',$htmlEntityKeywords);
|
||||||
$relevance['SiteTree'] = "MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$relevanceKeywords') + MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityRelevanceKeywords')";
|
$relevance['SiteTree'] = "MATCH (Title, MenuTitle, Content, MetaDescription) "
|
||||||
|
. "AGAINST ('$relevanceKeywords') "
|
||||||
|
. "+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityRelevanceKeywords')";
|
||||||
$relevance['File'] = "MATCH (Filename, Title, Content) AGAINST ('$relevanceKeywords')";
|
$relevance['File'] = "MATCH (Filename, Title, Content) AGAINST ('$relevanceKeywords')";
|
||||||
} else {
|
} else {
|
||||||
$relevance['SiteTree'] = $relevance['File'] = 1;
|
$relevance['SiteTree'] = $relevance['File'] = 1;
|
||||||
|
@ -888,7 +888,8 @@ class SQLQuery {
|
|||||||
else $filter = "(" . implode(") AND (", $join['filter']) . ")";
|
else $filter = "(" . implode(") AND (", $join['filter']) . ")";
|
||||||
|
|
||||||
$aliasClause = ($alias != $join['table']) ? " AS \"" . Convert::raw2sql($alias) . "\"" : "";
|
$aliasClause = ($alias != $join['table']) ? " AS \"" . Convert::raw2sql($alias) . "\"" : "";
|
||||||
$this->from[$alias] = strtoupper($join['type']) . " JOIN \"" . $join['table'] . "\"$aliasClause ON $filter";
|
$this->from[$alias] = strtoupper($join['type']) . " JOIN \""
|
||||||
|
. $join['table'] . "\"$aliasClause ON $filter";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,10 +108,23 @@ class DataListTest extends SapphireTest {
|
|||||||
|
|
||||||
// Test with namespaces (with non-sensical join, but good enough for testing)
|
// Test with namespaces (with non-sensical join, but good enough for testing)
|
||||||
$list = DataObjectTest_TeamComment::get();
|
$list = DataObjectTest_TeamComment::get();
|
||||||
$list->leftJoin('DataObjectTest\NamespacedClass', '"DataObjectTest\NamespacedClass"."ID" = "DataObjectTest_TeamComment"."ID"');
|
$list->leftJoin(
|
||||||
$expected = 'SELECT DISTINCT "DataObjectTest_TeamComment"."ClassName", "DataObjectTest_TeamComment"."Created", "DataObjectTest_TeamComment"."LastEdited", "DataObjectTest_TeamComment"."Name", "DataObjectTest_TeamComment"."Comment", "DataObjectTest_TeamComment"."TeamID", "DataObjectTest_TeamComment"."ID", CASE WHEN "DataObjectTest_TeamComment"."ClassName" IS NOT NULL THEN "DataObjectTest_TeamComment"."ClassName" ELSE '.$db->prepStringForDB('DataObjectTest_TeamComment').' END AS "RecordClassName" ' .
|
'DataObjectTest\NamespacedClass',
|
||||||
'FROM "DataObjectTest_TeamComment" ' .
|
'"DataObjectTest\NamespacedClass"."ID" = "DataObjectTest_TeamComment"."ID"'
|
||||||
'LEFT JOIN "DataObjectTest\NamespacedClass" ON "DataObjectTest\NamespacedClass"."ID" = "DataObjectTest_TeamComment"."ID"';
|
);
|
||||||
|
$expected = 'SELECT DISTINCT "DataObjectTest_TeamComment"."ClassName", '
|
||||||
|
. '"DataObjectTest_TeamComment"."Created", '
|
||||||
|
. '"DataObjectTest_TeamComment"."LastEdited", '
|
||||||
|
. '"DataObjectTest_TeamComment"."Name", '
|
||||||
|
. '"DataObjectTest_TeamComment"."Comment", '
|
||||||
|
. '"DataObjectTest_TeamComment"."TeamID", '
|
||||||
|
. '"DataObjectTest_TeamComment"."ID", '
|
||||||
|
. 'CASE WHEN "DataObjectTest_TeamComment"."ClassName" IS NOT NULL '
|
||||||
|
. 'THEN "DataObjectTest_TeamComment"."ClassName" '
|
||||||
|
. 'ELSE ' . $db->prepStringForDB('DataObjectTest_TeamComment') . ' END AS "RecordClassName" '
|
||||||
|
. 'FROM "DataObjectTest_TeamComment" '
|
||||||
|
. 'LEFT JOIN "DataObjectTest\NamespacedClass" ON '
|
||||||
|
. '"DataObjectTest\NamespacedClass"."ID" = "DataObjectTest_TeamComment"."ID"';
|
||||||
$this->assertEquals($expected, $list->sql(), 'Retains backslashes in namespaced classes');
|
$this->assertEquals($expected, $list->sql(), 'Retains backslashes in namespaced classes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,10 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$subDq->where('DataQueryTest_A.Name = \'John\'');
|
$subDq->where('DataQueryTest_A.Name = \'John\'');
|
||||||
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
||||||
|
|
||||||
$this->assertContains("WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') OR (DataQueryTest_A.Name = 'Bob'))", $dq->sql());
|
$this->assertContains(
|
||||||
|
"WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') OR (DataQueryTest_A.Name = 'Bob'))",
|
||||||
|
$dq->sql()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConjunctiveGroup() {
|
public function testConjunctiveGroup() {
|
||||||
@ -52,7 +55,10 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$subDq->where('DataQueryTest_A.Name = \'John\'');
|
$subDq->where('DataQueryTest_A.Name = \'John\'');
|
||||||
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
||||||
|
|
||||||
$this->assertContains("WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') AND (DataQueryTest_A.Name = 'Bob'))", $dq->sql());
|
$this->assertContains(
|
||||||
|
"WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') AND (DataQueryTest_A.Name = 'Bob'))",
|
||||||
|
$dq->sql()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNestedGroups() {
|
public function testNestedGroups() {
|
||||||
@ -66,7 +72,11 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$subSubDq->where('DataQueryTest_A.Age = 50');
|
$subSubDq->where('DataQueryTest_A.Age = 50');
|
||||||
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
$subDq->where('DataQueryTest_A.Name = \'Bob\'');
|
||||||
|
|
||||||
$this->assertContains("WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') OR ((DataQueryTest_A.Age = 18) AND (DataQueryTest_A.Age = 50)) OR (DataQueryTest_A.Name = 'Bob'))", $dq->sql());
|
$this->assertContains(
|
||||||
|
"WHERE (DataQueryTest_A.ID = 2) AND ((DataQueryTest_A.Name = 'John') OR ((DataQueryTest_A.Age = 18) "
|
||||||
|
. "AND (DataQueryTest_A.Age = 50)) OR (DataQueryTest_A.Name = 'Bob'))",
|
||||||
|
$dq->sql()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEmptySubgroup() {
|
public function testEmptySubgroup() {
|
||||||
|
@ -843,7 +843,8 @@ class SSViewer {
|
|||||||
$template = $this->chosenTemplates[$key];
|
$template = $this->chosenTemplates[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheFile = TEMP_FOLDER . "/.cache" . str_replace(array('\\','/',':'), '.', Director::makeRelative(realpath($template)));
|
$cacheFile = TEMP_FOLDER . "/.cache"
|
||||||
|
. str_replace(array('\\','/',':'), '.', Director::makeRelative(realpath($template)));
|
||||||
$lastEdited = filemtime($template);
|
$lastEdited = filemtime($template);
|
||||||
|
|
||||||
if(!file_exists($cacheFile) || filemtime($cacheFile) < $lastEdited || isset($_GET['flush'])) {
|
if(!file_exists($cacheFile) || filemtime($cacheFile) < $lastEdited || isset($_GET['flush'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user