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
|
||||
- php: 5.6
|
||||
env: DB=MYSQL BEHAT_TEST=1
|
||||
- php: 7.0
|
||||
env: DB=MYSQL PDO=1
|
||||
|
||||
before_script:
|
||||
- composer self-update || true
|
||||
|
@ -1,4 +1,8 @@
|
||||
<?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}.
|
||||
*
|
||||
@ -413,8 +417,8 @@ HTML;
|
||||
public function deleteinstallfiles() {
|
||||
if(!Permission::check("ADMIN")) return Security::permissionFailure($this);
|
||||
|
||||
$title = new Varchar("Title");
|
||||
$content = new HTMLText('Content');
|
||||
$title = new DBVarchar("Title");
|
||||
$content = new DBHTMLText('Content');
|
||||
|
||||
// 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,
|
||||
|
@ -5,6 +5,8 @@
|
||||
* @subpackage model
|
||||
*/
|
||||
|
||||
use SilverStripe\Model\FieldType\DBHTMLText;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$htmlFields = array();
|
||||
foreach($allFields as $field => $fieldSpec) {
|
||||
if(preg_match('/([^(]+)/', $fieldSpec, $matches)) {
|
||||
$class = $matches[0];
|
||||
if(class_exists($class)){
|
||||
if($class == 'HTMLText' || is_subclass_of($class, 'HTMLText')) $htmlFields[] = $field;
|
||||
}
|
||||
$fieldObj = $this->owner->dbObject($field);
|
||||
if($fieldObj instanceof DBHTMLText) {
|
||||
$htmlFields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Model\FieldType\DBVarchar;
|
||||
|
||||
class VirtualPageTest extends FunctionalTest {
|
||||
protected static $fixture_file = 'VirtualPageTest.yml';
|
||||
protected static $use_draft_site = false;
|
||||
@ -618,7 +620,7 @@ class VirtualPageTest_NotRoot extends Page implements TestOnly {
|
||||
private static $can_be_root = false;
|
||||
}
|
||||
|
||||
class VirtualPageTest_TestDBField extends Varchar implements TestOnly {
|
||||
class VirtualPageTest_TestDBField extends DBVarchar implements TestOnly {
|
||||
public function forTemplate() {
|
||||
return strtoupper($this->XML());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user