File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
administrator/components/com_patchtester/PatchTester/Model Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -326,21 +326,27 @@ public function revert($id)
326326 );
327327 }
328328
329- if (!\JFile:: delete (JPATH_COMPONENT . '/backups/ ' . md5 ($ file ->old ) . '.txt ' ))
329+ if (file_exists (JPATH_COMPONENT . '/backups/ ' . md5 ($ file ->old ) . '.txt ' ))
330330 {
331- throw new \RuntimeException (
332- \JText::sprintf ('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE ' , JPATH_COMPONENT . '/backups/ ' . md5 ($ file ->old ) . '.txt ' )
333- );
331+ if (!\JFile::delete (JPATH_COMPONENT . '/backups/ ' . md5 ($ file ->old ) . '.txt ' ))
332+ {
333+ throw new \RuntimeException (
334+ \JText::sprintf ('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE ' , JPATH_COMPONENT . '/backups/ ' . md5 ($ file ->old ) . '.txt ' )
335+ );
336+ }
334337 }
335338
336339 break ;
337340
338341 case 'added ' :
339- if (!\JFile:: delete (\JPath:: clean ( JPATH_ROOT . '/ ' . $ file ->new ) ))
342+ if (file_exists ( JPATH_ROOT . '/ ' . $ file ->new ))
340343 {
341- throw new \RuntimeException (
342- \JText::sprintf ('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE ' , JPATH_ROOT . '/ ' . $ file ->new )
343- );
344+ if (!\JFile::delete (JPATH_ROOT . '/ ' . $ file ->new ))
345+ {
346+ throw new \RuntimeException (
347+ \JText::sprintf ('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE ' , JPATH_ROOT . '/ ' . $ file ->new )
348+ );
349+ }
344350 }
345351
346352 break ;
You can’t perform that action at this time.
0 commit comments