/** * Befüllt den Record Pfaden * * @param string $sPath * @return tx_mklib_model_Dam */ public function fillPath($sPath = false) { // Pathname immer setzen! if (!$this->hasFilePath()) { if (tx_rnbase_util_TYPO3::isTYPO60OrHigher()) { $this->setFilePathName($this->getUrl()); } else { $this->setFilePathName($this->getFilePath() . $this->getFileName()); } } tx_rnbase::load('tx_mklib_util_File'); // webpath setzen if ((!$sPath || $sPath == 'webpath') && !$this->hasFileWebpath()) { $this->setFileWebpath(tx_mklib_util_File::getWebPath($this->getFilePathName())); } // serverpath setzen if ((!$sPath || $sPath == 'serverpath') && !$this->hasFileServerpath()) { $this->setFileServerpath(tx_mklib_util_File::getServerPath($this->getFilePathName())); } // relpath setzen if ((!$sPath || $sPath == 'relpath') && !$this->hasFileRelpath()) { $this->setFileRelpath(tx_mklib_util_File::getRelPath($this->getFilePathName())); } return $this; }
/** * getRelPath testen */ public function testGetRelPathWithRemovedStartingSlashSetToTrue() { if (defined('TYPO3_cliMode') && TYPO3_cliMode) { $this->markTestSkipped('Geht leider nicht unter CLI.'); } $pathSite = tx_mklib_util_File::getDocumentRoot(); $this->assertEquals('', tx_mklib_util_File::getRelPath('', TRUE)); $this->assertEquals('typo3conf/', tx_mklib_util_File::getRelPath(tx_mklib_util_File::getSiteUrl() . '\\typo3conf', TRUE)); $this->assertEquals('typo3conf/', tx_mklib_util_File::getRelPath($pathSite . '\\typo3conf', TRUE)); $this->assertEquals('typo3conf/localconf.php', tx_mklib_util_File::getRelPath($pathSite . '/typo3conf\\localconf.php', TRUE)); }