[wp-trac] [WordPress Trac] #50349: Plugin Update deletes plugin and showing "could not delete old plugin" message.
WordPress Trac
noreply at wordpress.org
Thu May 6 22:43:41 UTC 2021
#50349: Plugin Update deletes plugin and showing "could not delete old plugin"
message.
--------------------------+------------------------------
Reporter: apedog | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by pbiron):
I've also experienced this a number of times on my local dev machine.
Also happens (at least in Windows), if you've got a shell open in the
plugin directory (or one of it's sub-directories). In fact, probably 95%
(or more) of update failures I've experienced over the years on my local
were the result of this.
The only way I can think to prevent it would be to check whether any of
the files in the directory were opened before starting to try to delete
them. However, I don't think there's a reliable way in PHP to check this
(that works across OS's and web server configurations).
@apedog Do you remember what version of PHP you were running when this
happened to you? I mention that because I just noticed that the PHP
manual for [https://www.php.net/manual/en/function.unlink unlink()] now
says that as of PHP 7.3.0:
> On Windows, it is now possible to unlink() files with handles in use,
while formerly that would fail. However, it is still not possible to re-
create the unlinked file, until all handles to it have been closed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50349#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list