2016-01-06 00:34:58 +01:00
|
|
|
<?php
|
2014-08-06 06:29:52 +02:00
|
|
|
|
2016-08-19 00:51:35 +02:00
|
|
|
namespace SilverStripe\Dev;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Control\Director;
|
2016-06-15 06:03:16 +02:00
|
|
|
use SilverStripe\ORM\DatabaseAdmin;
|
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
class DevBuildController extends Controller {
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
private static $url_handlers = array(
|
2016-01-06 00:34:58 +01:00
|
|
|
'' => 'build'
|
2014-08-06 06:29:52 +02:00
|
|
|
);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
private static $allowed_actions = array(
|
|
|
|
'build'
|
|
|
|
);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
public function build($request) {
|
|
|
|
if(Director::is_cli()) {
|
|
|
|
$da = DatabaseAdmin::create();
|
|
|
|
return $da->handleRequest($request, $this->model);
|
|
|
|
} else {
|
|
|
|
$renderer = DebugView::create();
|
2016-08-19 00:51:35 +02:00
|
|
|
echo $renderer->renderHeader();
|
|
|
|
echo $renderer->renderInfo("Environment Builder", Director::absoluteBaseURL());
|
2014-08-06 06:29:52 +02:00
|
|
|
echo "<div class=\"build\">";
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
$da = DatabaseAdmin::create();
|
2016-07-10 11:35:14 +02:00
|
|
|
$response = $da->handleRequest($request, $this->model);
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
echo "</div>";
|
2016-08-19 00:51:35 +02:00
|
|
|
echo $renderer->renderFooter();
|
|
|
|
|
2016-07-10 11:35:14 +02:00
|
|
|
return $response;
|
2014-08-06 06:29:52 +02:00
|
|
|
}
|
|
|
|
}
|
2016-01-06 00:34:58 +01:00
|
|
|
|
2014-08-06 06:29:52 +02:00
|
|
|
}
|