'index', 'build/defaults' => 'buildDefaults', 'generatesecuretoken' => 'generatesecuretoken', '$Action' => 'runRegisteredController', ); private static $allowed_actions = array( 'index', 'buildDefaults', 'runRegisteredController', 'generatesecuretoken', ); public function init() { parent::init(); // Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957) $requestedDevBuild = (stripos($this->getRequest()->getURL(), 'dev/build') === 0) && (stripos($this->getRequest()->getURL(), 'dev/build/defaults') === false); // We allow access to this controller regardless of live-status or ADMIN permission only // if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN. $canAccess = ( $requestedDevBuild || Director::isDev() || Director::is_cli() // Its important that we don't run this check if dev/build was requested || Permission::check("ADMIN") ); if(!$canAccess) return Security::permissionFailure($this); // check for valid url mapping // lacking this information can cause really nasty bugs, // e.g. when running Director::test() from a FunctionalTest instance global $_FILE_TO_URL_MAPPING; if(Director::is_cli()) { if(isset($_FILE_TO_URL_MAPPING)) { $fullPath = $testPath = BASE_PATH; while($testPath && $testPath != "/" && !preg_match('/^[A-Z]:\\\\$/', $testPath)) { $matched = false; if(isset($_FILE_TO_URL_MAPPING[$testPath])) { $matched = true; break; } $testPath = dirname($testPath); } if(!$matched) { echo 'Warning: You probably want to define '. 'an entry in $_FILE_TO_URL_MAPPING that covers "' . Director::baseFolder() . '"' . "\n"; } } else { echo 'Warning: You probably want to define $_FILE_TO_URL_MAPPING in '. 'your _ss_environment.php as instructed on the "sake" page of the doc.silverstripe.org wiki'."\n"; } } // Backwards compat: Default to "draft" stage, which is important // for tasks like dev/build which call DataObject->requireDefaultRecords(), // but also for other administrative tasks which have assumptions about the default stage. Versioned::set_stage(Versioned::DRAFT); } public function index() { // Web mode if(!Director::is_cli()) { $renderer = DebugView::create(); $renderer->writeHeader(); $renderer->writeInfo("SilverStripe Development Tools", Director::absoluteBaseURL()); $base = Director::baseURL(); echo '