Commit Graph

78 Commits

Author SHA1 Message Date
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
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
1d95dcfa2c Docs: Remove superfluous @package WordPress and @subpackage notations used outside of file headers in a variety of core files.
Per the inline documentation standards for PHP, there should only be one `@package` and/or `@subpackage` notation per file, and only in the file header.

See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 16:58:42 +00:00
Dion Hulse
4efebd4b71 Filesystem: Add return statement to WP_Filesystem_ftpsockets->rmdir
Props tymvie.
Fixes #39405.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-28 03:52:42 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
Dominik Schilling
d59bcc98df Filesystem API: Cleanup temporary file when the temporary file couldn't be opened.
Props ruud@joyo.
See #34772.
Fixes #36942, #36943.
Built from https://develop.svn.wordpress.org/trunk@38094


git-svn-id: http://core.svn.wordpress.org/trunk@38035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-18 19:43:30 +00:00
Dion Hulse
bda1b2ace9 Filesystem: Revert [33648] and [34733] unfortunately these have caused issues for some servers, while fixing it for others.
See #28013

Fixes #34976 for trunk
Fixes #34976 for trunk

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


git-svn-id: http://core.svn.wordpress.org/trunk@35908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-15 02:36:28 +00:00
Dion Hulse
060476a1f2 Filesystem API: Cast the port to an int in the FTPSockets class. PemFTP requires that the port be specified as an integer, not a numeric string.
Fixes #35088

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


git-svn-id: http://core.svn.wordpress.org/trunk@35906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-15 00:29:26 +00:00
Sergey Biryukov
5539193dd0 I18N: Add translator comments for strings in wp-admin/includes/class-wp-filesystem-ftpsockets.php.
Fixes #34684.
Built from https://develop.svn.wordpress.org/trunk@35664


git-svn-id: http://core.svn.wordpress.org/trunk@35628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 17:23:29 +00:00
Drew Jaynes
0fc9bed46e Docs: Add a summary, version, and parameter and return descriptions to the DocBlock for WP_Filesystem_ftpsockets::get_contents().
Also reverses the return types as `string` is expected, `false` is the outlier.

See [30978].

See #30989. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 14:22:24 +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
a32d83586e Upgrades: When upgrading via FTP, use LIST -a to detect if a file exists.
`LIST` & `NLST` by default on some servers require the `-a` flag to view hidden files (ie. `.maintenance`)
Although we could simply pass the `-a` flag to `NLST`, opting to use `LIST` which we use elsewhere should mean less chance of server incompatibilities.

Props jcroucher.
Fixes #28013.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-19 12:38:25 +00:00
Scott Taylor
23f62a59da Correct typo in doc block for WP_Filesystem_ftpsockets::rmdir
Props Toro_Unit.
Fixes #33255.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-18 23:33:24 +00:00
Dion Hulse
8f47efe7dc WP Filesystem: Correctly parse the permissions field in the directory listings, and actually set it in FTP environments
Props mnelson4 for initial patch.
Fixes #29548

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


git-svn-id: http://core.svn.wordpress.org/trunk@32894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-24 04:49:25 +00:00
Scott Taylor
6a08b00632 Add @access annotations to methods that have no doc block in wp-admin/includes/*.
Makes it easier to search for no doc blocks via `}[\n\t\r ]+(protected|private|public)`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 21:32:24 +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
Dominik Schilling
9b79c36713 WP_Filesystem: Change WP_Filesystem_FTPext::exists() and WP_Filesystem_ftpsockets::exists() to return true for empty directories.
Both methods are using *nlist() which returns a list of files in a given directory or the file itself for a given file. If the result was an empty list we assumed that the file doesn't exists. This includes also cases where $file is actually an empty directory. To prevent this we now check if $file is a directory before returning the result of an empty list.
Other filesystem methods are using `file_exists()` which already checks whether a file or directory exists.

fixes #30815.
Built from https://develop.svn.wordpress.org/trunk@31815


git-svn-id: http://core.svn.wordpress.org/trunk@31797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-18 19:22: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
7c5038feb6 Calling ->chown() and ->chgrp() in WP_Filesystem_ftpsockets produces no side-effects. Remove the calls. ->chgrp() is defined in the super class, and does nothing, can be removed from the child class.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 21:10:23 +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
0a511680f4 Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value. Constructors do not have meaningful return values, anything that is returned from here is discarded.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:54:23 +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
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
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
2f513d3320 Fix some hackificator odds and ends in wp-admin:
* `wp-activate.php` and `wp-admin/themes.php` don't need the closing PHP tag
* Switch single quotes for HTML attribute values to double in a few places
* Convert `include_once file.php` syntax to `include_once( 'file.php' )`
* Add access modifiers to methods/members in: `_WP_List_Table_Compat`, `Walker_Nav_Menu_Edit`, `Walker_Nav_Menu_Checklist`, `WP_Screen`, `Walker_Category_Checklist`
* `edit_user()` doesn't need to import the `$wpdb` global
* `wp_list_widgets()` doesn't need to import the `$sidebars_widgets` global
* switch/endswitch syntax is not supported in Hack
* A `<ul>` in `wp-admin/users.php` is unclosed

See #27881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:04:16 +00:00
Scott Taylor
41e1ecdfaf Add access modifier (public) to members and methods in WP_Filesystem_ftpsockets.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 00:14:14 +00:00
Sergey Biryukov
cdba99d3b3 Being consistent is the gist, no single @since should have been missed.
see #26713.
Built from https://develop.svn.wordpress.org/trunk@26869


git-svn-id: http://core.svn.wordpress.org/trunk@26755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-25 02:00:11 +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
26ebfca466 Make use of the mbstring.func_overload helper functions in WP_Filesystem so byte lengths are properly determined. See #25259 Fixes #25237
Built from https://develop.svn.wordpress.org/trunk@25349


git-svn-id: http://core.svn.wordpress.org/trunk@25311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 08:27:10 +00:00
Dion Hulse
7a6fad844a WP_Filesystem: Let the code breathe, add some additional whitespace between method definitions and comments.
Built from https://develop.svn.wordpress.org/trunk@25305


git-svn-id: http://core.svn.wordpress.org/trunk@25267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-09 02:55: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
Dion Hulse
db6cf37f91 WP_Filesystem: FTP Sockets: Avoid using the file_exists() / is_exists() / exists() PemFTP functionality as it's buggy on ncFTPd servers, switching to listing the file instead which is what we use for the FTP Extension transport. Fixes #14049
Built from https://develop.svn.wordpress.org/trunk@25274


git-svn-id: http://core.svn.wordpress.org/trunk@25240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 08:29:09 +00:00
Helen Hou-Sandí
b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
dd32
2a708450ec WP_Filesystem: Return symlinked directory names correctly, previously the FTP extensions would return it as 'source -> dest' instead of simply 'source'. Props kurtpayne. Fixes #17846
git-svn-id: http://core.svn.wordpress.org/trunk@21223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-06 11:39:39 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +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
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
dd32
65176075c0 Standardise return values in WP_Filesystem::dirlist(), ::chmod() and ::exists()
git-svn-id: http://svn.automattic.com/wordpress/trunk@12999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-07 01:59:30 +00:00
dd32
a87c1e3ca9 Reduce code duplication, Formatting cleanups, Reduce Chmod IO calls. See #10913 for excess IO calls.
git-svn-id: http://svn.automattic.com/wordpress/trunk@12998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-07 01:31:40 +00:00
dd32
a8793e00c0 Fix recursive chmod for WP_Filesystem. Props reaperhulk for FtpExt. Fixes #11261
git-svn-id: http://svn.automattic.com/wordpress/trunk@12997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-07 01:12:29 +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
791cebe932 Typo fixes, props dd32, fixes #11030
git-svn-id: http://svn.automattic.com/wordpress/trunk@12104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-10-25 17:30:58 +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