diff --git a/extension/ext_conf_template.txt b/extension/ext_conf_template.txt index 4878b6c051a05d79e6b3cc6daa75f6eb15110e22..a4bad3791c287ebb401820b6e61a182994a02c37 100644 --- a/extension/ext_conf_template.txt +++ b/extension/ext_conf_template.txt @@ -51,11 +51,11 @@ fillStoreSystemBySqlErrorMsg3 = # cat=debug/sql; type=string; label=SQL log mode:Default is 'modify'. A logfile of QFQ fired SQL statements will be written. Possible modes are 'all' - every statement will be logged (this might a lot). 'modify' - log only statements who change data. 'error' - log only DB errors. 'none' - log never. sqlLogMode = modify -# cat=debug/sql; type=string; label=SQL log file:Default is 'typo3conf/sql.log'. A logfile of fired SQL statements. PathFile is absolute or relative to '<site path>'. -sqlLog = typo3conf/sql.log +# cat=debug/sql; type=string; label=SQL log file:Default is 'fileadmin/protected/log/sql.log'. A logfile of fired SQL statements. PathFile is absolute or relative to '<site path>'. +sqlLog = fileadmin/protected/log/sql.log -# cat=debug/mail; type=string; label=Mail log file:Default is 'typo3conf/mail.log'. A logfile of sent mail. PathFile is absolute or relative to '<site path>'. -mailLog = typo3conf/mail.log +# cat=debug/mail; type=string; label=Mail log file:Default is 'fileadmin/protected/log/mail.log'. A logfile of sent mail. PathFile is absolute or relative to '<site path>'. +mailLog = fileadmin/protected/log/mail.log # cat=debug/info; type=string; label=Show debug info:Default is 'auto'. Possible values: [yes|no|auto][,download]. For 'auto': If a BE User is logged in, a debug information will be shown on the FE. showDebugInfo = auto diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index ec0828034dc92765aa77b5a3da11d7e132b3eac0..94c3203059fa1a84c06b96296c80d390bcb51baa 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -14,6 +14,7 @@ const CONFIG_T3 = 'LocalConfiguration.php'; // T3 config file const GFX_INFO = 'typo3conf/ext/qfq/Resources/Public/icons/note.gif'; const API_DIR = 'typo3conf/ext/qfq/qfq/api'; +const QFQ_LOG_DIR = 'fileadmin/protected/log'; const QFQ_LOG = 'qfq.log'; const QFQ_TEMP_FILE_PATTERN = 'qfq.split.XXXXX'; const QFQ_TEMP_SOURCE = '.temp.source'; diff --git a/extension/qfq/qfq/File.php b/extension/qfq/qfq/File.php index b3d25c95bf02a7f4928214e06b46417536290694..fc4987f0561276ce109a55022c012765a9c0fd53 100644 --- a/extension/qfq/qfq/File.php +++ b/extension/qfq/qfq/File.php @@ -34,6 +34,7 @@ class File { * @param bool|false $phpUnit * @throws CodeException * @throws UserFormException + * @throws UserReportException */ public function __construct($phpUnit = false) { $this->session = Session::getInstance($phpUnit); diff --git a/extension/qfq/qfq/helper/Logger.php b/extension/qfq/qfq/helper/Logger.php index 9ec42f3b1fa28565d260c08751ef2ca3199e4616..67f27a98b5700f82d7de77302498d60886c2df87 100644 --- a/extension/qfq/qfq/helper/Logger.php +++ b/extension/qfq/qfq/helper/Logger.php @@ -10,6 +10,7 @@ namespace qfq; require_once(__DIR__ . '/../Constants.php'); require_once(__DIR__ . '/../exceptions/UserFormException.php'); +require_once(__DIR__ . '/../helper/Support.php'); /** * Class Logger @@ -33,15 +34,22 @@ class Logger { } if (!$handle = fopen($filename, $mode)) { - throw new UserFormException("Error - cannot open. File: " . $filename . " ( CWD: " . getcwd() . ")", ERROR_IO_OPEN); + + // If open fails, maybe die directory does not exist. Create it: + Support::mkDirParent($filename); + + // Try to open the file a second time. + if (!$handle = fopen($filename, $mode)) { + throw new UserFormException("Error - cannot open. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last(), ERROR_IO_OPEN); + } } if (fwrite($handle, $msg . PHP_EOL) === false) { - throw new UserFormException("Error - cannot write. File: " . $filename . " ( CWD: " . getcwd() . ")", ERROR_IO_WRITE); + throw new UserFormException("Error - cannot write. File: " . $filename . " ( CWD: " . getcwd() . ") - " . error_get_last(), ERROR_IO_WRITE); } fclose($handle); - } // logMessage() + } /** * @param array $fe