Commit Graph

148 Commits

Author SHA1 Message Date
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
Claudio Sanches 525db3aa21 Fixed incorrect package tags 2020-08-05 17:49:10 -03:00
Christopher Allford 933cdd7a7b Removed the default `id` field added to all CLI commands
Some of our endpoints don't have an "<id>" parameter but we're expecting one in the CLI. Since the `id` is already part of the supported IDs we don't actually need this since it will pull it from the route.
2020-07-10 14:16:30 -07:00
Christopher Allford c3618cad47 Added the `instance_id` parameter to the CLI runner
This is used for shipping zone methods and so we need to be able to parse it too!
2020-07-10 07:21:05 -07:00
Peter Fabian 992c6538dc Force the saving of notices only for the 'update' notice to prevent performance problems. 2020-02-25 14:58:02 +01:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Rodrigo Primo 7337ab60c2 Fix PEAR.Functions.FunctionCallSignature violations
This commit fixes all violations of the PEAR.Functions.FunctionCallSignature sniff automatically using phpcbf.
2019-12-20 15:25:23 -03:00
Gerhard c633c46045 When no update is found then just call WC_Install::update_db_version(); to ensure db version is set to current WC version, same as per WC_Admin_Notices::update_notice 2019-05-09 11:24:49 +02:00
Mike Jolley dbcfd7dcdc Update functions may re-run - handle in CLI 2019-02-28 11:11:25 +00:00
Mike Jolley 9749f5a2a9 Add progress bar to CLI command 2019-02-27 16:46:53 +00:00
Gerhard Potgieter 9c67760bc0 per_page must be between 1 and 100, default to 100. 2018-03-28 10:18:10 +02:00
Gerhard Potgieter 1f2468ca3e When no per_page is defined for list wp-cli command default to displaying all items as per the wp-cli standard. 2018-03-28 09:47:15 +02:00
Claudio Sanches 0660a50e07 Removed obvious boolean results 2018-03-21 19:57:10 -03:00
Rodrigo Primo cc67dc9f74 Merge branch 'master' into remove-unused-methods 2018-03-07 07:27:43 -03:00
Rodrigo Primo cd90c9bbc8 Fix PHPCS violations in includes/cli/class-wc-cli-update-command.php 2018-03-06 09:28:29 -03:00
Rodrigo Primo 8eb32d2c8c Fix PHPCS violations in includes/cli/class-wc-cli-tool-command.php 2018-03-06 09:24:47 -03:00
Rodrigo Primo 66911be455 Fix PHPCS violations in includes/cli/class-wc-cli-runner.php 2018-03-06 09:20:58 -03:00
Rodrigo Primo 70a03e6dfa Fix PHPCS violations in includes/cli/class-wc-cli-rest-command.php 2018-03-06 09:07:33 -03:00
Rodrigo Primo 4f18567e74 Remove unused code from WC_CLI_REST_Command class
This commit removes three unused methods and one unused property from the WC_CLI_REST_Command class that I found while fixing PHPCS violations in the includes/cli directory.
2018-03-06 08:58:32 -03:00
Rodrigo Primo b6674b3a8f Replace calls to json_decode() with wp_json_decode() 2018-03-06 08:18:31 -03:00
Rodrigo Primo 44a5903ce6 Fix PHPCS violations in includes/cli using phpcbf
Fix all violations that phpcbf can fix automatically.
2018-03-05 16:46:54 -03:00
Caleb Burks 828141c407 CLI ID argument should come after parent ID args 2018-02-25 14:59:23 -05:00
Caleb Burks e365d1e01a Use correct arg when making rest request in cli 2018-02-25 14:18:22 -05:00
Shiva Poudel 0856ba6376 Fix undefined format, closes #18418 2018-01-11 20:47:54 +05:45
Tiago Hillebrandt 84aeb00754 Use table format as default. 2018-01-11 02:41:41 -02:00
Tiago Hillebrandt 8c4a0dfefe Use table format as default. 2018-01-10 22:32:40 -02:00
Claudio Sanches a13158a75a Apply wc_maybe_define_constant() in all places 2017-09-05 16:52:39 -03:00
Mike Jolley 147a7f9419 Switch CLI tools command over to v2 API
Closes #16432
2017-08-14 10:45:44 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Akeda Bagus 53807185a8
Fixed typos.
These typos are catched by `misspell` program.

```
find . -type f | grep -v assets | grep -v dummy-data | grep -v i18n | grep -v node_modules | grep -v .git | grep -v apigen |  xargs misspell -w
```

Some results were excluded because of 3rd party ownership and non-english
sentences.
2017-07-10 12:56:28 +07:00
Justin Shreve dd80f25f90 Fix issues with CLI IDs 2017-06-16 06:29:57 -07:00
Mike Jolley c16acc6b51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	assets/css/wc-setup-rtl.css
#	assets/css/wc-setup.css
2017-05-23 19:00:24 +01:00
Mike Jolley d3666738d8 Merge branch 'pr/15069' 2017-05-23 18:56:58 +01:00
Mike Jolley 00e5189a05 Merge pull request #15070 from rasmusbe/phpdoc-missing-return-throws
Phpdoc: Add missing return and throws
2017-05-23 18:50:58 +01:00
Mike Jolley db012b3a12 Merge pull request #15011 from woocommerce/fix/14999
Add abspath checks
2017-05-23 15:57:35 +01:00
Mike Jolley d31a58b117 More abspath 2017-05-23 15:40:19 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 4f00d7e5e3 PHPDoc: Add missing return statement 2017-05-15 13:37:59 +02:00
Rasmus Bengtsson 6a7fc8650f Remove unused local variables 2017-05-15 12:06:52 +02:00
Mike Jolley b0bba8c853 Remove array merge 2017-04-28 17:09:39 +01:00
Mike Jolley 4b0fff3437 Fix zone routes in CLI
Fixes #14750
2017-04-28 15:49:51 +01:00
Claudio Sanches ffe1deba51 Disable setting options endpoint in CLI 2017-03-23 20:37:42 -03:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Aristeides Stathopoulos 70ee7ae7ea Fix some PHPCS errors 2017-03-07 19:57:28 +02:00
Justin Shreve 71d3308401 Show a reminder to include a valid --user flag when an authentication error is returned by the CLI.
Adds an additional message when the REST API returns 401 errors to the CLI, so that people properly include the `--user` flag.

To test:
* Run a command without a valid user ID (`wp wc product list`).
* See the additional error message.
* Run a command with a valid user ID, but cause another error, like a product not existing. (`wp wc product get 124124124 --user=1`).
* See that the extra error message is not displayed.
2017-03-06 11:34:06 -08:00
Justin Shreve dc501dc3be Fix CLI notice when using --fields.
A non-existent variable was being passed to `limit_item_to_fields`, causing a PHP notice to be displayed.
`PHP Notice:  Undefined variable: fields in includes/cli/class-wc-cli-rest-command.php on line 183`

This PR passes the correct value.

To Test:

1. Use `wp wc product list --user=1 --fields="sku,name"` on the command-line.
2. Make sure that a PHP notice does not display in your debug log.
2017-03-03 08:55:22 -08:00
Justin Shreve 14b06ee323 Merge pull request #13423 from woocommerce/fix/rest-command-notice
Fix PHP notice that displays when running CLI commands that accept no ID arguments.
2017-03-01 13:38:11 -08:00
Justin Shreve e8754eafcb Fix the PHP notice that is displaying when running commands like shop_coupon list that accept no ID arguments. 2017-03-01 13:22:02 -08:00
Justin Shreve 9c8dd2d916 Only target v2 of the WC REST API when generating CLI commands. 2017-03-01 13:05:04 -08:00
Justin Shreve 700026c2ab Separate positional and assoc arguments. 2017-02-10 08:38:43 -08:00