Opened 9 years ago
Last modified 6 years ago
#35536 new defect (bug)
WP_Upgrader goes too far up when enumerating parent paths on a network share
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.7 |
Component: | Upgrade/Install | Keywords: | needs-patch |
Focuses: | Cc: |
Description
In /wp-admin/includes/class-wp-upgrader.php
:
When is_vcs_checkout()
is walking up parent folders, the behavior of dirname()
causes WordPress to check for folders that couldn't possibly exist. For example, if "inetpub-share" was the name of a share on machine "myserver", the following folders might be searched for source control folders:
\\myserver\inetpub-share\wwwroot\.git
\\myserver\inetpub-share\.git
\\myserver\.git
\.git
Note that the last two are not even subfolders of "inetpub-share".
That is, the search should stop at "\\myserver\inetpub-share\.git"
because "inetpub-share"
should be considered a top-level folder.
Even more concerning is that checking for "\\myserver\.git"
and "\.git"
are very expensive operations in a network environment, which means that the upgrade logic takes a very long time or will time out.
My proposed remedy is to change this line:
if ( $context_dir == dirname( $context_dir ) )
to
if ( $context_dir == dirname( $context_dir )
|| (substr($context_dir , 0, 2)=='\\\\' && strpos(dirname( $context_dir ), '\\', 2)===false)
Thoughts?
Change History (3)
#2
in reply to:
↑ 1
@
9 years ago
Replying to dd32:
As a temporary workaround, you could map the Network Share to a Drive Letter (which is what most people do AFAIK) and serve off of that.
I would consider that as a last resort because I am running each site under its own credentials (for security purposes), which means that [each user would need its own mapped drive](https://support.microsoft.com/en-us/kb/257174), which in turn causes performance issues and maintenance issues.
Hobbes
As a temporary workaround, you could map the Network Share to a Drive Letter (which is what most people do AFAIK) and serve off of that.