WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#6245 closed defect (bug) (fixed)

FTP Class Incompatibilities

Reported by: DD32 Owned by:
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: ftp needs-testing
Focuses: Cc:

Description

Related to #5586, However, This is a ticket for incompatibilities found with the FTP classes & wrappers.

On a certain FTP server i was recieving the CWD as 257 "/home/dd32/", Its failing to split out the correct pathname. See Patch.

Also, trailingshashit() the current working dir. returns, some servers append /, some dont, standardise it and allways return a slashed string. See Patch.

Finally, a Patch to get_filesystem_method() to allow Pure FTP method via the PemFTP class. Pem FTP has 2 methods, 1. Sockets(currently checked for), or 2. Pure PHP which uses fsockopen/fwrite/fread. So if fsock exists, allow it to use that method too. Once again, See patch.

Also, Theres a patch in the works for a better WP_Filesystem_ftp*::find_base_dir() function, I'm currently testing it out a bit more, It should be faster, not have to perform as many ftp checks, and most importantly, Should handle WordPress installs within subfolders of other WordPress installs.

Attachments (3)

6245.diff (2.8 KB) - added by DD32 13 years ago.
updated to remove a seperate chunk which slipped in.
6245.2.diff (7.9 KB) - added by DD32 13 years ago.
needs-testing: New code for searching for wordpress install via ftp. Also introduces FTP_BASE constant to fit in with the other FTP_ constants
6245.3.diff (3.6 KB) - added by DD32 13 years ago.

Download all attachments as: .zip

Change History (15)

@DD32
13 years ago

updated to remove a seperate chunk which slipped in.

@DD32
13 years ago

needs-testing: New code for searching for wordpress install via ftp. Also introduces FTP_BASE constant to fit in with the other FTP_ constants

#1 @DD32
13 years ago

attachment 6245.2.diff added.

needs-testing: New code for searching for wordpress install via ftp. Also introduces FTP_BASE constant to fit in with the other FTP_ constants

Calling testers, Calling testers!

This code should fail gracefully in event that the folder cannot be found, so you should be able to test ok.

This code should also handle cases where the wordpress install which is being delt with, is inside another, eg:

/home/.../dd32.id.au/wordpress/ <- Main WordPress blog
/home/.../dd32.id.au/wordpress/devblog/ <- A WordPress blog in a subfolder

Previously, updating a plugin in the devblog would find the main blog instead, as it just assumed the first blog it found was correct.
New code should find the Devblog instead.

As an added bonus, It should also be much faster in locating it for the ajority of WordPress installs.

You may also install (version 1.4) http://dd32.id.au/files/wp-filesystem-tester.zip and follow through that way, As long as this patch isnt commited(just yet) "FS" will be the current code, and will fail on certain setups (And you'll see it does a lot of folder changing), "FS2" in the above plugin uses the new function, and should locate it with much fewer iterations needed.
If the paths are not correctly displayed on that plugin, I need to hear from you.

#2 @ryan
13 years ago

(In [7327]) FTP CWD fixes from DD32. see #6245

#3 @ryan
13 years ago

(In [7328]) find_base_dir fixes from DD32. see #6245

#4 @djr
13 years ago

In latest trunk I can't get the new FTP system to find my WordPress install. This is the output of DD32's FileSystem Tester:

Connection Method	ftpsockets
ABSPATH	/var/www/vhosts/iphonemobiel.nl/httpdocs/
PLUGINDIR	wp-content/plugins
FS Errors	None
FS CWD	/
FS WordPress Locator	Changing to /var/www/vhosts/iphonemobiel.nl/httpdocs/
Changing to /httpdocs
Changing to 
FS WordPress Location	
FS2 WordPress Locator	Changing to /var/www/vhosts/iphonemobiel.nl/httpdocs/
Changing to /httpdocs
Changing to 
FS2 WordPress Location	
Tests Stopped; Error: WordPress could not be located

Latest trunk is installed in /httpdocs/

#5 @djr
13 years ago

I should have included the revision. Tested with r7332.

#6 follow-up: @DD32
13 years ago

In latest trunk I can't get the new FTP system to find my WordPress install. This is the output of DD32's FileSystem? Tester:

Thanks for testing it out.

Currently its looking for the wp-settings.php file existing in said folder, Is that the case? Or is it located elsewhere?

When you log in via ftp, what folder are you logged into? Ie. is it the folder /var/www/vhosts/iphonemobiel.nl/ or is it / or somewhere else between?

Can you also check to see if you have a folder of /var/ inside your home directory where you shouldnt have one? It might be left over from the old plugin update code when it did something stupid with ftp.

#7 in reply to: ↑ 6 ; follow-up: @djr
13 years ago

Replying to DD32:

Currently its looking for the wp-settings.php file existing in said folder, Is that the case? Or is it located elsewhere?
When you log in via ftp, what folder are you logged into? Ie. is it the folder /var/www/vhosts/iphonemobiel.nl/ or is it / or somewhere else between?

wp-settings.php is in /httpdocs as seen by the ftp application. The full file path is /var/www/vhosts/iphonemobiel.nl/httpdocs/.

Can you also check to see if you have a folder of /var/ inside your home directory where you shouldnt have one? It might be left over from the old plugin update code when it did something stupid with ftp.

There is not a leftover var folder in my home dir ("home" being /var/www/vhosts/iphonemobiel.nl/)

#8 in reply to: ↑ 7 @DD32
13 years ago

Replying to djr:

wp-settings.php is in /httpdocs as seen by the ftp application. The full file path is /var/www/vhosts/iphonemobiel.nl/httpdocs/.

Cheers for that, I've just tried a similar setup with some modifications i've just made, If it doesnt work after 6245.3.diff is applied, give me another shout with the debug output and i'll look into it closer (As i say, I think its fixed with this patch)

@DD32
13 years ago

#9 follow-up: @DD32
13 years ago

attachment 6245.3.diff added.

Fixes the location search for when wordpress is installed in / Also fixes a few issues where it skips over WordPress when it should've found it.

#10 @ryan
13 years ago

(In [7369]) Basedir location fixes for ftp fs from DD32. see #6245

#11 in reply to: ↑ 9 @djr
13 years ago

Replying to DD32:

attachment 6245.3.diff added.

Fixes the location search for when wordpress is installed in / Also fixes a few issues where it skips over WordPress when it should've found it.

Send you (by email) the output as seen by your plugin and some additional questions :)

#12 @DD32
12 years ago

  • Milestone changed from 2.9 to 2.6
  • Resolution set to fixed
  • Status changed from new to closed

Marking as fixed in the 2.6 branch due to no furthur issues cropping up.

Note: See TracTickets for help on using tickets.