public function run($request) { if (!Director::is_cli() && !isset($_GET['run'])) { DB::alteration_message('Must add ?run=1', 'error'); return false; } if (!Director::is_cli()) { // - Add UTF-8 so characters will render as they should when debugging (so you can visualize inproperly formatted characters easier) // - Add base_tag so that printing blocks of HTML works properly with relative links (helps with visualizing errors) ?> <head> <?php echo SSViewer::get_base_tag(''); ?> <meta charset="UTF-8"> </head> <?php } increase_time_limit_to(300); WordpressDatabase::$default_config = $this->config()->default_db; $this->db = $this->wordpressImportService->getDatabase(); // Login as default admin so 'canPublish()' definitely returns true in 'SiteTree::doPublish()' if (!Member::currentUser()) { $defaultAdmin = Member::default_admin(); if ($defaultAdmin && $defaultAdmin->exists()) { Session::set('loggedInAs', $defaultAdmin->ID); } } // Unsure if the importing functionality can ever hit this, but just incase. if (Versioned::current_stage() !== 'Stage') { throw new Exception('Versioned::current_stage() must be "Stage".'); } $this->runCustom($request); }
public function showform() { return "<head>" . SSViewer::get_base_tag("") . "</head>" . $this->Form()->forTemplate(); }