giterlizzi / dokuwiki-plugin-advanced

Import/Export utility and control the advanced settings of your DokuWiki installation
https://www.dokuwiki.org/plugin:advanced
GNU General Public License v2.0
12 stars 7 forks source link

unlink extract_dir in import utility #10

Closed ggieling closed 6 years ago

ggieling commented 6 years ago

Giuseppe, Php reports an error after importing a namespace of files using the import utility as provided in the advanced utility.

Line 146 of /lib/plugins/advanced/admin/import.php reads 'unlink($extract_dir);' The unlink (https://secure.php.net/manual/en/function.unlink.php) command in php is used to delete a file, but $extract_dir is a directory. I think you intended to use rmdir() here.

I checked the /data/tmp directory and it indeed stil contains the directory with all the imported files. I assume I can safely delete these tmp directories.

giterlizzi commented 6 years ago

Hi, thanks for reporting this issue. I have pushed a fix to this issue.

You can update the pligin?

Thanks.

At your disposal, Joseph

ggieling commented 6 years ago

I will try later this week, I'm not at home before thursday evening.

Gerben Gieling IP Specialist

Synthon BV Microweg 22 | P.O. Box 7071 | 6503 GN Nijmegen | The Netherlands T: +31(0)24 37 27 700 | F: +31(0)24 37 27 705 | www.synthon.comhttp://www.synthon.com

From: Giuseppe Di Terlizzi [mailto:notifications@github.com] Sent: Monday, 26 February, 2018 3:49 PM To: LotarProject/dokuwiki-plugin-advanced Cc: Gerben Gieling; Author Subject: Re: [LotarProject/dokuwiki-plugin-advanced] unlink extract_dir in import utility (#10)

Hi, thanks for reporting this issue. I have pushed a fix to this issue.

You can update the pligin?

Thanks.

At your disposal, Joseph

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/LotarProject/dokuwiki-plugin-advanced/issues/10#issuecomment-368526869, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AiIutvWrefieGPdM5SjmCzhvs5CEQeh5ks5tYsRbgaJpZM4SSV7f.


This e-mail message and its attachments are subject to the disclaimer published at the following website of Synthon: http://www.synthon.com/information/disclaimer-e-mail-messages

ggieling commented 6 years ago

Giuseppe,

I found some time to test tonight. The new version produces a different error. The rmdir() function can only work on an empty directory. Unfortunately there is no flag to delete a directory recursively.

The php manualpage includes some example code blocks to recursively delete an entire tree. I think the code of https://php.net/manual/en /function.rmdir.php#110489 is quite elegant.

Gerben

On Mon, 2018-02-26 at 06:48 -0800, Giuseppe Di Terlizzi wrote:

Hi, thanks for reporting this issue. I have pushed a fix to this issue.

You can update the pligin?

Thanks.

At your disposal, Joseph


This e-mail message and its attachments are subject to the disclaimer published at the following website of Synthon: http://www.synthon.com/information/disclaimer-e-mail-messages

giterlizzi commented 6 years ago

Hi, thanks for your solution! I have found a DokuWiki function can recursively delete all files and subdirectory.

Joseph