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:
Sam Minnee 2016-03-23 10:00:16 +13:00
parent 209e1568c3
commit 46b35ecb0e
4 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -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,

View File

@ -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;
}
}

View File

@ -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());
}