[TASK] Remove locking around log files 12/28312/2
authorPhilipp Gampe <philipp.gampe@typo3.org>
Wed, 12 Mar 2014 18:27:08 +0000 (19:27 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 13 Mar 2014 05:50:20 +0000 (06:50 +0100)
Log files are opened in append mode and concurrency is handled by the
operation system. The PHP documentation declares fwrite
to be atomic for normal operations.

Resolves: #56833
Releases: 6.2
Change-Id: I151fdf8ce0e237d52263ad8fbc77207fd9940633
Reviewed-on: https://review.typo3.org/28312
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Oliver Klee
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index 539b362..3519510 100644 (file)
@@ -4928,17 +4928,12 @@ Connection: close
                        $msgLine = ' - ' . $extKey . ': ' . $msg;
                        // Write message to a file
                        if ($type == 'file') {
-                               $lockObject = self::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
-                               /** @var \TYPO3\CMS\Core\Locking\Locker $lockObject */
-                               $lockObject->setEnableLogging(FALSE);
-                               $lockObject->acquire();
                                $file = fopen($destination, 'a');
                                if ($file) {
                                        fwrite($file, date(($dateFormat . ' ' . $timeFormat)) . $msgLine . LF);
                                        fclose($file);
                                        self::fixPermissions($destination);
                                }
-                               $lockObject->release();
                        } elseif ($type == 'mail') {
                                list($to, $from) = explode('/', $destination);
                                if (!self::validEmail($from)) {
@@ -5006,17 +5001,12 @@ Connection: close
                        }
                        // Write a longer message to the deprecation log
                        $destination = self::getDeprecationLogFileName();
-                       $lockObject = self::makeInstance('TYPO3\\CMS\\Core\\Locking\\Locker', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
-                       /** @var \TYPO3\CMS\Core\Locking\Locker $lockObject */
-                       $lockObject->setEnableLogging(FALSE);
-                       $lockObject->acquire();
                        $file = @fopen($destination, 'a');
                        if ($file) {
                                @fwrite($file, ($date . $msg . LF));
                                @fclose($file);
                                self::fixPermissions($destination);
                        }
-                       $lockObject->release();
                }
                if (in_array('devlog', $log) !== FALSE) {
                        // Copy message also to the developer log