SilverStripe 4 compatibility

This commit is contained in:
Loz Calver 2016-11-02 11:39:25 +00:00
parent 552684ce12
commit 286c79160a
11 changed files with 113 additions and 83 deletions

View File

@ -5,23 +5,19 @@ sudo: false
language: php language: php
php: php:
- 5.3
- 5.4
- 5.5 - 5.5
- 5.6 - 5.6
- 7.0 - 7.0
env: env:
- DB=MYSQL CORE_RELEASE=3.2 - DB=MYSQL CORE_RELEASE=master
matrix: matrix:
include: include:
- php: 5.6 - php: 5.6
env: DB=MYSQL CORE_RELEASE=3 env: DB=MYSQL CORE_RELEASE=master
- php: 5.6 - php: 5.6
env: DB=MYSQL CORE_RELEASE=3.1 env: DB=PGSQL CORE_RELEASE=master
- php: 5.6
env: DB=PGSQL CORE_RELEASE=3.2
allow_failures: allow_failures:
- php: 7.0 - php: 7.0

View File

@ -1,11 +0,0 @@
<?php
// add the extension to pages
if (class_exists('SiteTree')) {
SiteTree::add_extension('GoogleSitemapSiteTreeExtension');
}
// if you need to add this to DataObjects include the following in
// your own _config:
// GoogleSiteMap::register_dataobject('MyDataObject');

View File

@ -5,4 +5,11 @@ GoogleSitemap:
enabled: true enabled: true
objects_per_sitemap: 1000 objects_per_sitemap: 1000
google_notification_enabled: false google_notification_enabled: false
use_show_in_search: true use_show_in_search: true
---
Only:
classexists: SilverStripe\CMS\Model\SiteTree
---
SilverStripe\CMS\Model\SiteTree:
extensions:
- GoogleSitemapSiteTreeExtension

View File

@ -1,6 +1,6 @@
--- ---
Name: googlesitemaproutes Name: googlesitemaproutes
--- ---
Director: SilverStripe\Control\Director:
rules: rules:
'sitemap.xml': 'GoogleSitemapController' 'sitemap.xml': 'GoogleSitemapController'

View File

@ -1,4 +1,15 @@
<?php <?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Object;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\View\ArrayData;
/** /**
* Sitemaps are a way to tell Google about pages on your site that they might * Sitemaps are a way to tell Google about pages on your site that they might
* not otherwise discover. In its simplest terms, a XML Sitemap usually called * not otherwise discover. In its simplest terms, a XML Sitemap usually called
@ -225,8 +236,8 @@ class GoogleSitemap extends Object
Translatable::disable_locale_filter(); Translatable::disable_locale_filter();
} }
if ($class == "SiteTree") { if ($class == SiteTree::class) {
$instances = Versioned::get_by_stage('SiteTree', 'Live'); $instances = Versioned::get_by_stage(SiteTree::class, 'Live');
if($filter) { if($filter) {
$instances = $instances->filter('ShowInSearch', 1); $instances = $instances->filter('ShowInSearch', 1);
@ -341,7 +352,7 @@ class GoogleSitemap extends Object
$sitemaps = new ArrayList(); $sitemaps = new ArrayList();
$filter = Config::inst()->get('GoogleSitemap', 'use_show_in_search'); $filter = Config::inst()->get('GoogleSitemap', 'use_show_in_search');
if (class_exists('SiteTree')) { if (class_exists(SiteTree::class)) {
// move to extension hook. At the moment moduleexists config hook // move to extension hook. At the moment moduleexists config hook
// does not work. // does not work.
if (class_exists('Translatable')) { if (class_exists('Translatable')) {
@ -349,7 +360,7 @@ class GoogleSitemap extends Object
} }
$filter = ($filter) ? "\"ShowInSearch\" = 1" : ""; $filter = ($filter) ? "\"ShowInSearch\" = 1" : "";
$class = 'SiteTree'; $class = SiteTree::class;
$instances = Versioned::get_by_stage($class, 'Live', $filter); $instances = Versioned::get_by_stage($class, 'Live', $filter);
$this->extend("alterDataList", $instances, $class); $this->extend("alterDataList", $instances, $class);
$count = $instances->count(); $count = $instances->count();
@ -365,7 +376,7 @@ class GoogleSitemap extends Object
$lastModified = ($lastEdited) ? date('Y-m-d', strtotime($lastEdited)) : date('Y-m-d'); $lastModified = ($lastEdited) ? date('Y-m-d', strtotime($lastEdited)) : date('Y-m-d');
$sitemaps->push(new ArrayData(array( $sitemaps->push(new ArrayData(array(
'ClassName' => 'SiteTree', 'ClassName' => $this->sanitiseClassName(SiteTree::class),
'LastModified' => $lastModified, 'LastModified' => $lastModified,
'Page' => $i 'Page' => $i
))); )));

View File

@ -1,7 +1,12 @@
<?php <?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config;
use SilverStripe\Control\HTTPResponse;
/** /**
* Controller for displaying the sitemap.xml. The module displays an index * Controller for displaying the sitemap.xml. The module displays an index
* sitemap at the sitemap.xml level, then outputs the individual objects * sitemap at the sitemap.xml level, then outputs the individual objects
* at a second level. * at a second level.
* *
@ -34,7 +39,7 @@ class GoogleSitemapController extends Controller
{ {
if (GoogleSitemap::enabled()) { if (GoogleSitemap::enabled()) {
Config::inst()->update('SSViewer', 'set_source_file_comments', false); Config::inst()->update('SSViewer', 'set_source_file_comments', false);
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"'); $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
$this->getResponse()->addHeader('X-Robots-Tag', 'noindex'); $this->getResponse()->addHeader('X-Robots-Tag', 'noindex');
@ -45,14 +50,14 @@ class GoogleSitemapController extends Controller
'Sitemaps' => $sitemaps 'Sitemaps' => $sitemaps
); );
} else { } else {
return new SS_HTTPResponse('Page not found', 404); return new HTTPResponse('Page not found', 404);
} }
} }
/** /**
* Specific controller action for displaying a particular list of links * Specific controller action for displaying a particular list of links
* for a class * for a class
* *
* @return mixed * @return mixed
*/ */
public function sitemap() public function sitemap()
@ -60,9 +65,9 @@ class GoogleSitemapController extends Controller
$class = $this->unsanitiseClassName($this->request->param('ID')); $class = $this->unsanitiseClassName($this->request->param('ID'));
$page = $this->request->param('OtherID'); $page = $this->request->param('OtherID');
if (GoogleSitemap::enabled() && $class && $page && ($class == 'SiteTree' || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))) { if (GoogleSitemap::enabled() && $class && $page && ($class == SiteTree::class || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))) {
Config::inst()->update('SSViewer', 'set_source_file_comments', false); Config::inst()->update('SSViewer', 'set_source_file_comments', false);
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"'); $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');
$this->getResponse()->addHeader('X-Robots-Tag', 'noindex'); $this->getResponse()->addHeader('X-Robots-Tag', 'noindex');
@ -73,7 +78,7 @@ class GoogleSitemapController extends Controller
'Items' => $items 'Items' => $items
); );
} else { } else {
return new SS_HTTPResponse('Page not found', 404); return new HTTPResponse('Page not found', 404);
} }
} }

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\Control\Director;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\FieldType\DBDatetime;
/** /**
* Decorate the page object to provide google sitemaps with * Decorate the page object to provide google sitemaps with
* additionally options and configuration. * additionally options and configuration.
@ -86,7 +90,7 @@ class GoogleSitemapExtension extends DataExtension
* *
* @see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=183668&topic=8476&ctx=topic * @see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=183668&topic=8476&ctx=topic
* *
* @return SS_Datetime * @return DBDatetime
*/ */
public function getChangeFrequency() public function getChangeFrequency()
{ {
@ -96,10 +100,10 @@ class GoogleSitemapExtension extends DataExtension
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$created = new SS_Datetime(); $created = new DBDatetime();
$created->value = ($this->owner->Created) ? $this->owner->Created : $date; $created->value = ($this->owner->Created) ? $this->owner->Created : $date;
$now = new SS_Datetime(); $now = new DBDatetime();
$now->value = $date; $now->value = $date;
$versions = ($this->owner->Version) ? $this->owner->Version : 1; $versions = ($this->owner->Version) ? $this->owner->Version : 1;

View File

@ -1,5 +1,10 @@
<?php <?php
use SilverStripe\CMS\Model\ErrorPage;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\Tab;
/** /**
* @package googlesitemaps * @package googlesitemaps
*/ */
@ -33,13 +38,13 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
); );
$tabset = $fields->findOrMakeTab('Root.Settings'); $tabset = $fields->findOrMakeTab('Root.Settings');
$message = "<p>"; $message = "<p>";
$message .= sprintf(_t('GoogleSitemaps.METANOTEPRIORITY', "Manually specify a Google Sitemaps priority for this page (%s)"), $message .= sprintf(_t('GoogleSitemaps.METANOTEPRIORITY', "Manually specify a Google Sitemaps priority for this page (%s)"),
'<a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=71936#prioritize" target="_blank">?</a>' '<a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=71936#prioritize" target="_blank">?</a>'
); );
$message .= "</p>"; $message .= "</p>";
$tabset->push(new Tab('GoogleSitemap', _t('GoogleSitemaps.TABGOOGLESITEMAP', 'Google Sitemap'), $tabset->push(new Tab('GoogleSitemap', _t('GoogleSitemaps.TABGOOGLESITEMAP', 'Google Sitemap'),
new LiteralField("GoogleSitemapIntro", $message), new LiteralField("GoogleSitemapIntro", $message),
$priority = new DropdownField("Priority", $this->owner->fieldLabel('Priority'), $prorities, $this->owner->Priority) $priority = new DropdownField("Priority", $this->owner->fieldLabel('Priority'), $prorities, $this->owner->Priority)
@ -59,26 +64,26 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
$labels['Priority'] = _t('GoogleSitemaps.METAPAGEPRIO', "Page Priority"); $labels['Priority'] = _t('GoogleSitemaps.METAPAGEPRIO', "Page Priority");
} }
/** /**
* Ensure that all parent pages of this page (if any) are published * Ensure that all parent pages of this page (if any) are published
* *
* @return boolean * @return boolean
*/ */
public function hasPublishedParent() public function hasPublishedParent()
{ {
// Skip root pages // Skip root pages
if (empty($this->owner->ParentID)) { if (empty($this->owner->ParentID)) {
return true; return true;
} }
// Ensure direct parent exists // Ensure direct parent exists
$parent = $this->owner->Parent(); $parent = $this->owner->Parent();
if (empty($parent) || !$parent->exists()) { if (empty($parent) || !$parent->exists()) {
return false; return false;
} }
// Check ancestry // Check ancestry
return $parent->hasPublishedParent(); return $parent->hasPublishedParent();
} }
@ -88,12 +93,12 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
*/ */
public function canIncludeInGoogleSitemap() public function canIncludeInGoogleSitemap()
{ {
// Check that parent page is published // Check that parent page is published
if (!$this->owner->hasPublishedParent()) { if (!$this->owner->hasPublishedParent()) {
return false; return false;
} }
$result = parent::canIncludeInGoogleSitemap(); $result = parent::canIncludeInGoogleSitemap();
$result = ($this->owner instanceof ErrorPage) ? false : $result; $result = ($this->owner instanceof ErrorPage) ? false : $result;
@ -111,7 +116,7 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
if (!$priority) { if (!$priority) {
$parentStack = $this->owner->parentStack(); $parentStack = $this->owner->parentStack();
$numParents = is_array($parentStack) ? count($parentStack) - 1 : 0; $numParents = is_array($parentStack) ? count($parentStack) - 1 : 0;
$num = max(0.1, 1.0 - ($numParents / 10)); $num = max(0.1, 1.0 - ($numParents / 10));
$result = str_replace(",", ".", $num); $result = str_replace(",", ".", $num);

View File

@ -1,5 +1,17 @@
<?php <?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Director;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\Tab;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\Versioning\Versioned;
/** /**
* TODO: Migrate to new instance level interface instead of using static methods for retrieval of site maps and items (i.e. ->getSitemaps() instead of ::get_sitemaps()). * TODO: Migrate to new instance level interface instead of using static methods for retrieval of site maps and items (i.e. ->getSitemaps() instead of ::get_sitemaps()).
* *
@ -25,7 +37,7 @@ class GoogleSitemapTest extends FunctionalTest
if (class_exists('Page')) { if (class_exists('Page')) {
$this->loadFixture('googlesitemaps/tests/GoogleSitemapPageTest.yml'); $this->loadFixture('googlesitemaps/tests/GoogleSitemapPageTest.yml');
} }
GoogleSitemap::clear_registered_dataobjects(); GoogleSitemap::clear_registered_dataobjects();
GoogleSitemap::clear_registered_routes(); GoogleSitemap::clear_registered_routes();
} }
@ -93,7 +105,7 @@ class GoogleSitemapTest extends FunctionalTest
// dataobject as it hasn't been registered // dataobject as it hasn't been registered
$expected = "<loc>". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1") ."</loc>"; $expected = "<loc>". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1") ."</loc>";
$this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_DataObject exists'); $this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_DataObject exists');
$expected = "<loc>". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_OtherDataObject/1") ."</loc>"; $expected = "<loc>". Director::absoluteURL("sitemap.xml/sitemap/GoogleSitemapTest_OtherDataObject/1") ."</loc>";
$this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_OtherDataObject exists'); $this->assertEquals(1, substr_count($body, $expected), 'A link to GoogleSitemapTest_OtherDataObject exists');
@ -222,11 +234,11 @@ class GoogleSitemapTest extends FunctionalTest
if (!class_exists('Page')) { if (!class_exists('Page')) {
$this->markTestIncomplete('No cms module installed, page related test skipped'); $this->markTestIncomplete('No cms module installed, page related test skipped');
} }
$page = $this->objFromFixture('Page', 'Page1'); $page = $this->objFromFixture('Page', 'Page1');
$page->publish('Stage', 'Live'); $page->publish('Stage', 'Live');
$page->flushCache(); $page->flushCache();
$page2 = $this->objFromFixture('Page', 'Page2'); $page2 = $this->objFromFixture('Page', 'Page2');
$page2->publish('Stage', 'Live'); $page2->publish('Stage', 'Live');
$page2->flushCache(); $page2->flushCache();
@ -234,29 +246,29 @@ class GoogleSitemapTest extends FunctionalTest
$this->assertDOSContains(array( $this->assertDOSContains(array(
array('Title' => 'Testpage1'), array('Title' => 'Testpage1'),
array('Title' => 'Testpage2') array('Title' => 'Testpage2')
), GoogleSitemap::get_items('SiteTree'), "There should be 2 pages in the sitemap after publishing"); ), GoogleSitemap::get_items(SiteTree::class), "There should be 2 pages in the sitemap after publishing");
// check if we make a page readonly that it is hidden // check if we make a page readonly that it is hidden
$page2->CanViewType = 'LoggedInUsers'; $page2->CanViewType = 'LoggedInUsers';
$page2->write(); $page2->write();
$page2->publish('Stage', 'Live'); $page2->publish('Stage', 'Live');
$this->session()->inst_set('loggedInAs', null); $this->session()->inst_set('loggedInAs', null);
$this->assertDOSEquals(array( $this->assertDOSEquals(array(
array('Title' => 'Testpage1') array('Title' => 'Testpage1')
), GoogleSitemap::get_items('SiteTree'), "There should be only 1 page, other is logged in only"); ), GoogleSitemap::get_items(SiteTree::class), "There should be only 1 page, other is logged in only");
} }
public function testAccess() public function testAccess()
{ {
Config::inst()->update('GoogleSitemap', 'enabled', true); Config::inst()->update('GoogleSitemap', 'enabled', true);
$response = $this->get('sitemap.xml'); $response = $this->get('sitemap.xml');
$this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled'); $this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled');
$this->assertEquals('application/xml; charset="utf-8"', $response->getHeader('Content-Type')); $this->assertEquals('application/xml; charset="utf-8"', $response->getHeader('Content-Type'));
GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject"); GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject");
$response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1'); $response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1');
$this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled'); $this->assertEquals(200, $response->getStatusCode(), 'Sitemap returns a 200 success when enabled');
@ -264,14 +276,14 @@ class GoogleSitemapTest extends FunctionalTest
Config::inst()->remove('GoogleSitemap', 'enabled'); Config::inst()->remove('GoogleSitemap', 'enabled');
Config::inst()->update('GoogleSitemap', 'enabled', false); Config::inst()->update('GoogleSitemap', 'enabled', false);
$response = $this->get('sitemap.xml'); $response = $this->get('sitemap.xml');
$this->assertEquals(404, $response->getStatusCode(), 'Sitemap index returns a 404 when disabled'); $this->assertEquals(404, $response->getStatusCode(), 'Sitemap index returns a 404 when disabled');
$response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1'); $response = $this->get('sitemap.xml/sitemap/GoogleSitemapTest_DataObject/1');
$this->assertEquals(404, $response->getStatusCode(), 'Sitemap file returns a 404 when disabled'); $this->assertEquals(404, $response->getStatusCode(), 'Sitemap file returns a 404 when disabled');
} }
public function testDecoratorAddsFields() public function testDecoratorAddsFields()
{ {
if (!class_exists("Page")) { if (!class_exists("Page")) {
@ -279,21 +291,21 @@ class GoogleSitemapTest extends FunctionalTest
} }
$page = $this->objFromFixture('Page', 'Page1'); $page = $this->objFromFixture('Page', 'Page1');
$fields = $page->getSettingsFields(); $fields = $page->getSettingsFields();
$tab = $fields->fieldByName('Root')->fieldByName('Settings')->fieldByName('GoogleSitemap'); $tab = $fields->fieldByName('Root')->fieldByName('Settings')->fieldByName('GoogleSitemap');
$this->assertInstanceOf('Tab', $tab); $this->assertInstanceOf(Tab::class, $tab);
$this->assertInstanceOf('DropdownField', $tab->fieldByName('Priority')); $this->assertInstanceOf(DropdownField::class, $tab->fieldByName('Priority'));
$this->assertInstanceOf('LiteralField', $tab->fieldByName('GoogleSitemapIntro')); $this->assertInstanceOf(LiteralField::class, $tab->fieldByName('GoogleSitemapIntro'));
} }
public function testGetPriority() public function testGetPriority()
{ {
if (!class_exists("Page")) { if (!class_exists("Page")) {
$this->markTestIncomplete('No cms module installed, page related test skipped'); $this->markTestIncomplete('No cms module installed, page related test skipped');
} }
$page = $this->objFromFixture('Page', 'Page1'); $page = $this->objFromFixture('Page', 'Page1');
// invalid field doesn't break google // invalid field doesn't break google
@ -303,31 +315,31 @@ class GoogleSitemapTest extends FunctionalTest
// custom value (set as string as db field is varchar) // custom value (set as string as db field is varchar)
$page->Priority = '0.2'; $page->Priority = '0.2';
$this->assertEquals(0.2, $page->getGooglePriority()); $this->assertEquals(0.2, $page->getGooglePriority());
// -1 indicates that we should not index this // -1 indicates that we should not index this
$page->Priority = -1; $page->Priority = -1;
$this->assertFalse($page->getGooglePriority()); $this->assertFalse($page->getGooglePriority());
} }
public function testUnpublishedPage() public function testUnpublishedPage()
{ {
if (!class_exists('SiteTree')) { if (!class_exists(SiteTree::class)) {
$this->markTestSkipped('Test skipped; CMS module required for testUnpublishedPage'); $this->markTestSkipped('Test skipped; CMS module required for testUnpublishedPage');
} }
$orphanedPage = new SiteTree(); $orphanedPage = new SiteTree();
$orphanedPage->ParentID = 999999; // missing parent id $orphanedPage->ParentID = 999999; // missing parent id
$orphanedPage->write(); $orphanedPage->write();
$orphanedPage->publish("Stage", "Live"); $orphanedPage->publish("Stage", "Live");
$rootPage = new SiteTree(); $rootPage = new SiteTree();
$rootPage->ParentID = 0; $rootPage->ParentID = 0;
$rootPage->write(); $rootPage->write();
$rootPage->publish("Stage", "Live"); $rootPage->publish("Stage", "Live");
$oldMode = Versioned::get_reading_mode(); $oldMode = Versioned::get_reading_mode();
Versioned::reading_stage('Live'); Versioned::set_reading_mode('Live');
try { try {
$this->assertEmpty($orphanedPage->hasPublishedParent()); $this->assertEmpty($orphanedPage->hasPublishedParent());
$this->assertEmpty($orphanedPage->canIncludeInGoogleSitemap()); $this->assertEmpty($orphanedPage->canIncludeInGoogleSitemap());
@ -348,8 +360,8 @@ class GoogleSitemapTest extends FunctionalTest
*/ */
class GoogleSitemapTest_DataObject extends DataObject implements TestOnly class GoogleSitemapTest_DataObject extends DataObject implements TestOnly
{ {
public static $db = array( private static $db = array(
'Priority' => 'Varchar(10)' 'Priority' => 'Varchar(10)'
); );
@ -371,7 +383,7 @@ class GoogleSitemapTest_DataObject extends DataObject implements TestOnly
class GoogleSitemapTest_OtherDataObject extends DataObject implements TestOnly class GoogleSitemapTest_OtherDataObject extends DataObject implements TestOnly
{ {
public static $db = array( private static $db = array(
'Priority' => 'Varchar(10)' 'Priority' => 'Varchar(10)'
); );

View File

@ -4,7 +4,7 @@ GoogleSitemapTest_DataObject:
DataObjectTest2: DataObjectTest2:
Priority: 0.2 Priority: 0.2
UnindexedDataObject: UnindexedDataObject:
Priority: -1 Priority: -1
GoogleSitemapTest_OtherDataObject: GoogleSitemapTest_OtherDataObject:
OtherDataObjectTest2: OtherDataObjectTest2:
@ -12,4 +12,4 @@ GoogleSitemapTest_OtherDataObject:
GoogleSitemapTest_UnviewableDataObject: GoogleSitemapTest_UnviewableDataObject:
Unviewable1: Unviewable1:
Priority: 0.4 Priority: 0.4

View File

@ -2,7 +2,9 @@
namespace SilverStripe\GoogleSitemaps; namespace SilverStripe\GoogleSitemaps;
use Director, DataObject, TestOnly; use SilverStripe\Control\Director;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
/** /**
* @package googlesitemaps * @package googlesitemaps
@ -10,7 +12,6 @@ use Director, DataObject, TestOnly;
*/ */
class Test_DataObject extends DataObject implements TestOnly class Test_DataObject extends DataObject implements TestOnly
{ {
public static $db = array( public static $db = array(
'Priority' => 'Varchar(10)' 'Priority' => 'Varchar(10)'
); );