diff --git a/application/transaction.class.inc.php b/application/transaction.class.inc.php index 0e4ca4be1..f818eba67 100644 --- a/application/transaction.class.inc.php +++ b/application/transaction.class.inc.php @@ -26,8 +26,6 @@ * @copyright Copyright (C) 2010-2012 Combodo SARL * @license http://opensource.org/licenses/AGPL-3.0 */ - - class privUITransaction { /** @@ -101,7 +99,6 @@ class privUITransaction /** * The original (and by default) mechanism for storing transaction information * as an array in the $_SESSION variable - * */ class privUITransactionSession { @@ -207,6 +204,7 @@ class privUITransactionFile { throw new Exception('The directory "'.APPROOT.'data" must be writable to the application.'); } + /** @noinspection MkdirRaceConditionInspection */ if (!@mkdir(APPROOT.'data/transactions')) { throw new Exception('Failed to create the directory "'.APPROOT.'data/transactions". Ajust the rights on the parent directory or let an administrator create the transactions directory and give the web sever enough rights to write into it.'); @@ -268,27 +266,26 @@ class privUITransactionFile /** * Removes the transaction specified by its id * @param int $id The Identifier (as returned by GetNewTransactionId) of the transaction to be removed. - * @return void + * @return bool true if the token can be removed */ public static function RemoveTransaction($id) { - $bSuccess = true; $sFilepath = APPROOT.'data/transactions/'.$id; clearstatcache(true, $sFilepath); - if(!file_exists($sFilepath)) - { + if (!file_exists($sFilepath)) { $bSuccess = false; - self::Error("RemoveTransaction: Transaction '$id' not found. Pending transactions for this user:\n".implode("\n", self::GetPendingTransactions())); + self::Error("RemoveTransaction: Transaction '$id' not found. Pending transactions for this user:\n" + .implode("\n", self::GetPendingTransactions())); + } else { + $bSuccess = @unlink($sFilepath); } - $bSuccess = @unlink($sFilepath); - if (!$bSuccess) - { + + if (!$bSuccess) { self::Error('RemoveTransaction: FAILED to remove transaction '.$id); - } - else - { + } else { self::Info('RemoveTransaction: OK '.$id); } + return $bSuccess; }