Report any technical problems you discover and discuss solutions.

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

  • jayaich
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
10 years 11 months ago - 10 years 11 months ago #3020 by 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:

===========

Part of the message is hidden for the guests. Please log in or register to see it.

===========

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.
Last edit: 10 years 11 months ago by jayaich. Reason: Add attachment

Please Log in or Create an account to join the conversation.

  • jayaich
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
10 years 11 months ago #3021 by jayaich
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 +?>

Please Log in or Create an account to join the conversation.

Moderators: ronmjultenJohnSmith
Time to create page: 0.138 seconds
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo