dns - Typo3 Extbase: get domain in CommandController -
i'm trying access base url of site inside command action this:
namespace vendor\txtest\command; class testcommandcontroller extends \typo3\cms\extbase\mvc\controller\commandcontroller { /** * logger * * @var \typo3\cms\core\log\logmanager */ protected $logger; /** * class constructor */ public function __construct() { $this->logger = \typo3\cms\core\utility\generalutility::makeinstance( 'typo3\\cms\\core\\log\\logmanager' )->getlogger( __class__ ); } /** * test command */ public function testcommand() { $homeurl = \typo3\cms\core\utility\generalutility::locationheaderurl( '/' ); $this->logger->info( 'url: ' . $homeurl ); $this->logger->info( "\n\r\n\r" ); } }
when run command scheduler backend module, domain looks ok, when runs automatically, result is:
mon, 10 mar 2014 ... component="vendor.txnews.command.testcommandcontroller": url: http:///
what correct way domain in context?
php knows domain server-call. if site on specific server, might have several urls pointing server. php not know domain has. request user doing php getting information in $_server-var typo3/extbase can read. assume script running on different servers if want url? can put configuration on server different each server?
one approach store url user-call , read in background-module.
Comments
Post a Comment