Update to SilverStripe 3.1

Static exporter will now work with SilverStripe 3.1.x. There's a few things to note: mkdir() fails on windows platforms, fopen fails to get external files.
This commit is contained in:
torleif 2014-03-07 09:38:44 +13:00
parent efb7b1dc94
commit 77eebfcbf3

View File

@ -49,8 +49,15 @@ class StaticExporter extends Controller {
if(!$this->config()->get('disable_sitetree_export')) { if(!$this->config()->get('disable_sitetree_export')) {
$objs[] = $this->config()->get('export_objects'); $objs[] = $this->config()->get('export_objects');
$objs[] = "SiteTree"; $objs[] = "SiteTree";
$objs[] = "Page";
$this->config()->set('export_objects', $objs); foreach($objs as $obj){
if(is_string($obj)) {
$mypage = $obj::get();
foreach($mypage as $page){
StaticExporter::$export_objects []= $page;
}
}
}
} }
} }
} }
@ -225,12 +232,10 @@ class StaticExporter extends Controller {
* @return array * @return array
*/ */
public function getExportUrls() { public function getExportUrls() {
$classes = $this->config()->get('export_objects'); $classes = StaticExporter::$export_objects;
$urls = array(); $urls = array();
foreach($classes as $obj) { foreach($classes as $obj) {
$link = $obj->Link; $link = $obj->Link();
$urls[$link] = $link; $urls[$link] = $link;
} }