Commit Graph

55 Commits

Author SHA1 Message Date
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

Built from https://develop.svn.wordpress.org/trunk@45611


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast
cf3fa9f7c8 Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-admin.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45583


git-svn-id: http://core.svn.wordpress.org/trunk@45394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 12:52:01 +00:00
Sergey Biryukov
c77e771c84 Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424


git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 00:12:54 +00:00
Sergey Biryukov
74e9c3d20d Docs: Improve documentation for various WP_Filesystem_Base methods and extending classes.
Props jaydeep-rami, man4toman, SaeedFard, mukesh27, mohadeseghasemi, ebrahimzadeh, juiiee8487, SergeyBiryukov.
Fixes #42227, #46806, #46840. See #46543.
Built from https://develop.svn.wordpress.org/trunk@45226


git-svn-id: http://core.svn.wordpress.org/trunk@45035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 04:13:51 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


Built from https://develop.svn.wordpress.org/trunk@42228


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
Drew Jaynes
1a28ec87e1 Docs: Remove @access notations from method DocBlocks in wp-admin/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

Built from https://develop.svn.wordpress.org/trunk@41161


git-svn-id: http://core.svn.wordpress.org/trunk@41001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:40:43 +00:00
Drew Jaynes
852e6921d2 Docs: Add missing return descriptions for WP_Filesystem_SSH2::chown() and WP_Filesystem_SSH2::run_command().
Fixes #30989.

Built from https://develop.svn.wordpress.org/trunk@37270


git-svn-id: http://core.svn.wordpress.org/trunk@37236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-21 02:38:29 +00:00
Sergey Biryukov
aff11cdc9f I18N: Remove <code> tag from translatable string in wp-admin/includes/class-wp-filesystem-ssh2.php.
Props ramiy.
Fixes #35741.
Built from https://develop.svn.wordpress.org/trunk@36670


git-svn-id: http://core.svn.wordpress.org/trunk@36637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 02:11:28 +00:00
Sergey Biryukov
a7c5161db1 I18N: Add translator comments for strings in wp-admin/includes/class-wp-filesystem-ftpext.php.
See #34684.
Built from https://develop.svn.wordpress.org/trunk@35663


git-svn-id: http://core.svn.wordpress.org/trunk@35627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 17:22:27 +00:00
Sergey Biryukov
6b94d7c89c I18N: Add translator comments for strings in wp-admin/includes/class-wp-filesystem-ssh2.php.
Props ramiy.
See #34684.
Built from https://develop.svn.wordpress.org/trunk@35661


git-svn-id: http://core.svn.wordpress.org/trunk@35625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 17:18:40 +00:00
Drew Jaynes
e6578e7b4f Docs: Use 3-digit, x.x.x-style semantic versioning in the DocBlocks for post_form_autocomplete_off() and WP_Filesystem_SSH2::sftp_path().
Props aaronrutley.
Fixes #34518.

Built from https://develop.svn.wordpress.org/trunk@35468


git-svn-id: http://core.svn.wordpress.org/trunk@35432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 13:16:24 +00:00
Dion Hulse
a4c41f6ee4 Updates: SSH2 Transport: Add a connection error when the SFTP subsystem cannot be initialized.
Fixes #33478

Built from https://develop.svn.wordpress.org/trunk@34739


git-svn-id: http://core.svn.wordpress.org/trunk@34703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 05:43:25 +00:00
Dion Hulse
d8aaf01b97 Updates: SSH2 Transport: Use a work around to avoid a bug where PHP's SSH2 extension fails to list the contents of the / directory.
This fixes issues where SSH2 with chrooted environments runs into a `Unable to locate WordPress Content directory (wp-content).` error.

The workaround is to simply list the contents of the `/./` directory instead of `/`.

Fixes #33919

Built from https://develop.svn.wordpress.org/trunk@34738


git-svn-id: http://core.svn.wordpress.org/trunk@34702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 05:40:25 +00:00
Scott Taylor
b8c37073d8 Add @access docs to class-wp-filesystem-* files.
Props wenthemes.
Fixes #33725.

Built from https://develop.svn.wordpress.org/trunk@33984


git-svn-id: http://core.svn.wordpress.org/trunk@33953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 01:21:24 +00:00
Dion Hulse
09da29102b WP_Filesystem: SSH2 handler: Remove support for is_writable() via SSH, it turns out PHP doesn't verify the writability via SFTP and instead uses a comparison based on the current php system process user instead of the ssh user.
This fixes the 'The update cannot be installed because we will be unable to copy some files.' error encountered during updates by skipping the write test completely.

Props jobst.
Fixes #33480 for trunk

Built from https://develop.svn.wordpress.org/trunk@33688


git-svn-id: http://core.svn.wordpress.org/trunk@33655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 11:43:25 +00:00
Dion Hulse
c445d60a00 SSH2 Upgrade transport: Use ssh2_sftp_realpath() instead of shell commands to determine the current directory on the remote server. This should allow it to be used on chrooted SSH sessions.
See #32345

Built from https://develop.svn.wordpress.org/trunk@32726


git-svn-id: http://core.svn.wordpress.org/trunk@32696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 06:31:28 +00:00
Scott Taylor
c6a4512b1b Add missing doc blocks to wp-admin/includes/*.
Fix some egregious uses of tabbing.
Some functions can simply return `apply_filters(...)` instead of setting a variable that is immediately returned.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32654


git-svn-id: http://core.svn.wordpress.org/trunk@32624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 20:17:26 +00:00
Dion Hulse
8a9181d8d4 SSH2 Upgrade transport: Trim the trailing newline character from the ouput of pwd to avoid a PHP Segfault.
Fixes #30802 for trunk.

Built from https://develop.svn.wordpress.org/trunk@31686


git-svn-id: http://core.svn.wordpress.org/trunk@31667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 04:32:27 +00:00
Scott Taylor
eeda68bbda Fix some erroneous @param annotations.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31219


git-svn-id: http://core.svn.wordpress.org/trunk@31200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 22:44:25 +00:00
Scott Taylor
895794f74d In WP_Filesystem_Base subclasses that set $wp_base, remove this dead code.
Unused since [8009] - "Make WP_Filesystem work with new directory constants"

There is currently no declared field and no `@property` annotation.

See #30799.

Built from https://develop.svn.wordpress.org/trunk@31209


git-svn-id: http://core.svn.wordpress.org/trunk@31190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 17:23:22 +00:00
Scott Taylor
b29a20b90a WP_Filesystem_Base should declare $errors and $options as fields for use by subclasses.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31208


git-svn-id: http://core.svn.wordpress.org/trunk@31189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 17:10:43 +00:00
Scott Taylor
da99d29a59 Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value - anything that is returned is discarded.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31125


git-svn-id: http://core.svn.wordpress.org/trunk@31106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:13:22 +00:00
Scott Taylor
574fabf2bc Improve some wp-admin/includes/class-wp-filesystem-*.php docs for @param.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@30978


git-svn-id: http://core.svn.wordpress.org/trunk@30964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 20:40:23 +00:00
Scott Taylor
37a23b2c73 Improve various @param docs.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30682


git-svn-id: http://core.svn.wordpress.org/trunk@30672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 02:17:21 +00:00
Scott Taylor
da4c39480f Improve various @param docs for src/wp-admin/includes/class-wp-filesystem-*.php.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30678


git-svn-id: http://core.svn.wordpress.org/trunk@30668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 00:13:22 +00:00
Dion Hulse
dbbd9fb5ec Filesystem: Fix the move() method of the SSH2 transport, which was using the SSH2 link rather than the SFTP link.
Props nobleclem. Fixes #29405

Built from https://develop.svn.wordpress.org/trunk@29970


git-svn-id: http://core.svn.wordpress.org/trunk@29716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-20 07:46:19 +00:00
Drew Jaynes
097dc8ee15 Fix syntax for single- and multi-line comments in wp-admin-directory files.
See #28931.

Built from https://develop.svn.wordpress.org/trunk@29206


git-svn-id: http://core.svn.wordpress.org/trunk@28990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 09:14:16 +00:00
Scott Taylor
d5e35d187f Add access modifier (public) to members and methods in WP_Filesystem_SSH2.
See #27881, #22234.

Built from https://develop.svn.wordpress.org/trunk@28491


git-svn-id: http://core.svn.wordpress.org/trunk@28317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 00:18:14 +00:00
Andrew Nacin
3c3e9a530b Filesystem: Fix getchmod() for direct and ssh2 transports, for directories.
props DavidAnderson.
fixes #26598.

Built from https://develop.svn.wordpress.org/trunk@27566


git-svn-id: http://core.svn.wordpress.org/trunk@27409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-17 20:17:15 +00:00
Dion Hulse
c43600ea4b First pass at documenting the WP_Filesystem methods. This also introduces stubs of the methods into the base class which are documented, which subclasses can override, some methods were cleaned up at the same time.
See #18476 See #23122. Props kurtpayne, bananastalktome, and, DrewAPicture 

Built from https://develop.svn.wordpress.org/trunk@25560


git-svn-id: http://core.svn.wordpress.org/trunk@25478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-22 04:44:10 +00:00
Dion Hulse
023a4c7336 WP_Filesyste: SSH2 PHP Extension support: Fix a case where defining a custom FS_CHMOD_FILE / FS_CHMOD_DIR constant wouldn't take effect due to chmod() failing with a invalid path. Fixes #23589
Built from https://develop.svn.wordpress.org/trunk@25306


git-svn-id: http://core.svn.wordpress.org/trunk@25268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-09 03:05:09 +00:00
Dion Hulse
6d1ffc62ea WP_Filesystem: Ensure that all files are read/written correctly by verifying the return values from fwrite() and using FTP_BINARY mode (ASCII converts line endings as per the spec). See #25237
Built from https://develop.svn.wordpress.org/trunk@25304


git-svn-id: http://core.svn.wordpress.org/trunk@25266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-09 02:43:08 +00:00
Andrew Nacin
51e89cca30 Fix the chown and chgrp methods for the filesystem API's SSH2 transport. fixes #24277.
git-svn-id: http://core.svn.wordpress.org/trunk@24626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-10 04:15:13 +00:00
dd32
53062d6414 WP_Filesystem_*::mkdir() untrailingslash path consistently, don't waste time attempting to create an "empty" path. See #15575. Props lordandrei and SergeyBiryukov for initial patches.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-13 10:43:38 +00:00
duck_
c1d1590171 Fix typos in documentation (wp-admin/). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-03 14:18:10 +00:00
ryan
04487fc268 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 20:05:12 +00:00
dd32
a83a2842ea Optimisations to WP_Filesystem; Pass known information to called functions. Props aldenta (John Ford) for investigation and patch. See #10913
git-svn-id: http://svn.automattic.com/wordpress/trunk@17525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-22 00:04:15 +00:00
nacin
30d6eb32c6 Remove redundant isset() and empty() checks.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-19 21:29:21 +00:00
ryan
8760e7da1b Coding standards, space after if
git-svn-id: http://svn.automattic.com/wordpress/trunk@12752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-01-18 20:34:48 +00:00
dd32
41e561b941 Standardise WP_Filesystem_*::put_contents() arguments to support chmod reliably across all transports. Fixes #10889
git-svn-id: http://svn.automattic.com/wordpress/trunk@12723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-01-14 09:23:53 +00:00
azaozz
103ba096a7 Include 'hidden' directories in filesystem dirlist by default, props dd32, fixes #10774
git-svn-id: http://svn.automattic.com/wordpress/trunk@11934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-15 02:21:00 +00:00
ryan
8e3808bce2 Remove trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@11930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-09-14 14:03:32 +00:00
azaozz
5c21d67399 WP_Filesystem fixes and phpdoc, props hakre dd32, see #10304
git-svn-id: http://svn.automattic.com/wordpress/trunk@11831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-08-16 08:34:53 +00:00
azaozz
ca27f326a9 Add constants for ftp connections timeouts, props dd32, see #10522
git-svn-id: http://svn.automattic.com/wordpress/trunk@11823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-08-15 12:01:04 +00:00
azaozz
5a98759e8d Fix class-wp-filesystem-ssh2 put_contents() for empty files, props lostinlafayette dd32, fixes #10604
git-svn-id: http://svn.automattic.com/wordpress/trunk@11818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-08-15 07:49:28 +00:00
ryan
75c820b140 Enforce stream_get_contents() requirement for ssh2 fs. Props dd32. fixes #10093 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@11632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-06-23 21:54:53 +00:00
azaozz
3ba803dc49 Fix typo, props morfiusx and Denis-de-Bernardy, fixes #10137 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@11564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-06-14 09:28:29 +00:00
ryan
857a0563cf SS2 FS fixes. Props DD32. fixes #8210
git-svn-id: http://svn.automattic.com/wordpress/trunk@11063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-22 23:38:01 +00:00
ryan
e89192b1a8 Strip trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@10150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-12-09 18:03:31 +00:00