Report any technical problems you discover and discuss solutions.

v3: bug - files/dirs/templates not being deleted

  • jayaich
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
10 jaren 11 maanden geleden - 10 jaren 11 maanden geleden #3020 door jayaich
Hello,

I created a new project, and uploaded an image to it. I then deleted the project, including selecting the 'Recycle bin' and selecting to empty that. However, I got some PHP warnings:

===========

Een deel is verborgen voor gasten. Log-in of registreer om het te kunnen bekijken.

===========

There were also a couple of further warnings, but they stemmed from the fact that the above directories were not deleted. The result is that the project directory is left on the disk.

It seems that the file 'modules/xerte/delete_template.php' is not correctly handling the full pathname, and so the test for a directory fails. The code then assumes it is a file. This in turn leads to the above errors when trying to unlink a directory. (In effect the code leaves out the directory separator when joining the parent directory to the entry being checked).

A patch for this is attached.


John.
Laatst bewerkt 10 jaren 11 maanden geleden door jayaich. Reden: Add attachment

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

  • jayaich
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
10 jaren 11 maanden geleden #3021 door jayaich
Beantwoord door jayaich in topic v3: bug - files/dirs/templates not being deleted
Adding the attachment didn't work. So putting it inline again:
Code:
--- modules/xerte/delete_template.php.orig 2015-07-29 23:17:23.000000000 +0100 +++ modules/xerte/delete_template.php 2015-08-13 15:14:36.634487590 +0100 @@ -55,18 +55,17 @@ if(($f!=".")&&($f!="..")){ - if(is_dir($path . $f)){ - + $string = $path . DIRECTORY_SEPARATOR . $f; - array_push($folder_array, $path . "/" . $f); + if(is_dir($string)){ + + array_push($folder_array, $string); - delete_folder_loop($path . $f); + delete_folder_loop($string); }else{ - $string = $path . "/" . $f; - array_push($file_array, $string); } @@ -149,4 +148,4 @@ rmdir($path); } -?> \ No newline at end of file +?>

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: ronmjultenJohnSmith
Tijd voor maken pagina: 0.135 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo