mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX: Changes to support php7 and new DBFields
These changes are necessary for CMS to work with this API breakage: https://github.com/silverstripe/silverstripe-framework/pull/4551
This commit is contained in:
parent
209e1568c3
commit
46b35ecb0e
@ -30,6 +30,8 @@ matrix:
|
|||||||
env: DB=MYSQL PDO=1
|
env: DB=MYSQL PDO=1
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: DB=MYSQL BEHAT_TEST=1
|
env: DB=MYSQL BEHAT_TEST=1
|
||||||
|
- php: 7.0
|
||||||
|
env: DB=MYSQL PDO=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Model\FieldType\DBVarchar;
|
||||||
|
use SilverStripe\Model\FieldType\DBHTMLText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The most common kind of controller; effectively a controller linked to a {@link DataObject}.
|
* The most common kind of controller; effectively a controller linked to a {@link DataObject}.
|
||||||
*
|
*
|
||||||
@ -413,8 +417,8 @@ HTML;
|
|||||||
public function deleteinstallfiles() {
|
public function deleteinstallfiles() {
|
||||||
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
|
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
|
||||||
|
|
||||||
$title = new Varchar("Title");
|
$title = new DBVarchar("Title");
|
||||||
$content = new HTMLText('Content');
|
$content = new DBHTMLText('Content');
|
||||||
|
|
||||||
// We can't delete index.php as it might be necessary for URL routing without mod_rewrite.
|
// We can't delete index.php as it might be necessary for URL routing without mod_rewrite.
|
||||||
// There's no safe way to detect usage of mod_rewrite across webservers,
|
// There's no safe way to detect usage of mod_rewrite across webservers,
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* @subpackage model
|
* @subpackage model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use SilverStripe\Model\FieldType\DBHTMLText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds tracking of links in any HTMLText fields which reference SiteTree or File items.
|
* Adds tracking of links in any HTMLText fields which reference SiteTree or File items.
|
||||||
*
|
*
|
||||||
@ -205,11 +207,9 @@ class SiteTreeLinkTracking extends DataExtension {
|
|||||||
$allFields = $this->owner->db();
|
$allFields = $this->owner->db();
|
||||||
$htmlFields = array();
|
$htmlFields = array();
|
||||||
foreach($allFields as $field => $fieldSpec) {
|
foreach($allFields as $field => $fieldSpec) {
|
||||||
if(preg_match('/([^(]+)/', $fieldSpec, $matches)) {
|
$fieldObj = $this->owner->dbObject($field);
|
||||||
$class = $matches[0];
|
if($fieldObj instanceof DBHTMLText) {
|
||||||
if(class_exists($class)){
|
$htmlFields[] = $field;
|
||||||
if($class == 'HTMLText' || is_subclass_of($class, 'HTMLText')) $htmlFields[] = $field;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Model\FieldType\DBVarchar;
|
||||||
|
|
||||||
class VirtualPageTest extends FunctionalTest {
|
class VirtualPageTest extends FunctionalTest {
|
||||||
protected static $fixture_file = 'VirtualPageTest.yml';
|
protected static $fixture_file = 'VirtualPageTest.yml';
|
||||||
protected static $use_draft_site = false;
|
protected static $use_draft_site = false;
|
||||||
@ -618,7 +620,7 @@ class VirtualPageTest_NotRoot extends Page implements TestOnly {
|
|||||||
private static $can_be_root = false;
|
private static $can_be_root = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VirtualPageTest_TestDBField extends Varchar implements TestOnly {
|
class VirtualPageTest_TestDBField extends DBVarchar implements TestOnly {
|
||||||
public function forTemplate() {
|
public function forTemplate() {
|
||||||
return strtoupper($this->XML());
|
return strtoupper($this->XML());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user