Ticket #6245 (new defect)

Opened 4 months ago

Last modified 4 months ago

FTP Class Incompatibilities

Reported by: DD32 Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: Administration Version: 2.5
Severity: normal Keywords: ftp needs-testing
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

6245.diff (2.8 kB) - added by DD32 on 03/16/08 05:32:33.
updated to remove a seperate chunk which slipped in.
6245.2.diff (7.9 kB) - added by DD32 on 03/16/08 07:13:51.
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 on 03/18/08 00:07:03.

Change History

03/16/08 05:32:33 changed by DD32

  • attachment 6245.diff added.

updated to remove a seperate chunk which slipped in.

03/16/08 07:13:51 changed by DD32

  • 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

03/16/08 07:19:54 changed by DD32

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.

03/16/08 09:49:11 changed by ryan

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

03/16/08 09:50:36 changed by ryan

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

03/16/08 15:23:22 changed by djr

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/

03/16/08 15:47:17 changed by djr

I should have included the revision. Tested with r7332.

(follow-up: ↓ 7 ) 03/16/08 23:07:57 changed by DD32

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.

(in reply to: ↑ 6 ; follow-up: ↓ 8 ) 03/16/08 23:21:48 changed by djr

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/)

(in reply to: ↑ 7 ) 03/18/08 00:06:48 changed by DD32

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)

03/18/08 00:07:03 changed by DD32

  • attachment 6245.3.diff added.

(follow-up: ↓ 11 ) 03/18/08 00:08:05 changed by 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.

03/18/08 00:13:11 changed by ryan

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

(in reply to: ↑ 9 ) 03/18/08 12:30:27 changed by djr

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 :)