Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.
  • Page:
  • 1

TOPIC:

v3: bug - files/dirs/templates not being deleted 9 years 3 months ago #3020

  • jayaich
  • jayaich's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 82
  • Thank you received: 5
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.

Please Inloggen or Create an account to join the conversation.

Last edit: by jayaich. Reason: Add attachment

v3: bug - files/dirs/templates not being deleted 9 years 3 months ago #3021

  • jayaich
  • jayaich's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 82
  • Thank you received: 5
Adding the attachment didn't work. So putting it inline again:
--- 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 Inloggen or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ronmjultenJohnSmith
Time to create page: 0.053 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search