Make WordPress Core

Opened 21 months ago

Last modified 5 months ago

#55376 new enhancement

Use wp_filesize in core

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords: good-first-bug has-patch
Focuses: Cc:

Description

Introduced in [52837] as part of #49412, the wp_filesize function is a wrapper around filesize. It has some improves on this function, like casting to int and filters. The filesize function is call throughout core functions. This function may be useful in more contexts.

Attachments (1)

55376.diff (4.3 KB) - added by nihar007 15 months ago.
Hi,

Download all attachments as: .zip

Change History (13)

#1 @spacedmonkey
21 months ago

CC @flixos90

This ticket was mentioned in PR #2402 on WordPress/wordpress-develop by Chargnn.


21 months ago
#2

  • Keywords has-patch added; needs-patch removed

Replaced usage of filesize functions to wp_filesize in wp-admin/theme-editor.php

Trac ticket: https://core.trac.wordpress.org/ticket/55376

mauriac commented on PR #2402:


21 months ago
#3

LGTM!

#4 follow-up: @spacedmonkey
21 months ago

I would consider using this function in the following places.

https://github.com/WordPress/wordpress-develop/blob/8697aee5f9d834c1d7135524c7f13dc3c96f4d85/src/wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php#L87

https://github.com/WordPress/wordpress-develop/blob/2648a5f984b8abf06872151898e3a61d3458a628/src/wp-includes/ms-files.php#L45

https://github.com/WordPress/wordpress-develop/blob/ba518c2d86e62ed63b24e9a720d42aee3ab951fb/src/wp-admin/includes/class-wp-filesystem-direct.php#L490

https://github.com/WordPress/wordpress-develop/blob/33048b933379ae48723f617588ed8aa996ca5d14/src/wp-admin/includes/class-wp-filesystem-ssh2.php#L649

https://github.com/WordPress/wordpress-develop/blob/ba518c2d86e62ed63b24e9a720d42aee3ab951fb/src/wp-admin/includes/ms.php#L33

https://github.com/WordPress/wordpress-develop/blob/ecf1d6a158c70dd7f10cc42c4b26ecb0fb22bb59/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L1287

https://github.com/WordPress/wordpress-develop/blob/2d707c45127d204936eef48b3c9e133b60596b33/src/wp-admin/includes/update-core.php#L1256

https://github.com/WordPress/wordpress-develop/blob/26bb0d7479e1dd08dd982513ee6bee94f4c6f13d/src/wp-admin/includes/plugin.php#L401

https://github.com/WordPress/wordpress-develop/blob/6adff3d989319e633cfdcdb7aff4dc906087c230/src/wp-includes/script-loader.php#L2736

https://github.com/WordPress/wordpress-develop/blob/8db1549c0f1af05fbb919ad2eeb7f7bff5a63da9/src/wp-includes/class-wp-customize-manager.php#L6035

spacedmonkey commented on PR #2402:


21 months ago
#5

Thanks @Chargnn for the patch. I have added some links other places where this function can be used.

#6 in reply to: ↑ 5 @acoulombe
21 months ago

Replying to spacedmonkey:

spacedmonkey commented on PR #2402:

I would consider using this function in the following places.

Thank you! Looking into this right now.

Last edited 21 months ago by acoulombe (previous) (diff)

#7 @spacedmonkey
19 months ago

  • Milestone changed from Awaiting Review to Future Release

@nihar007
15 months ago

Hi,

#9 @nihar007
15 months ago

Thanks, @spacedmonkey for your advice, I followed your instruction and changed the filesize() function in the rest of the files.

#10 @spacedmonkey
8 months ago

  • Keywords needs-patch needs-refresh added; has-patch removed

@nihar007 This patch needs a refresh.

This ticket was mentioned in PR #4361 on WordPress/wordpress-develop by @spacedmonkey.


8 months ago
#11

  • Keywords has-patch added; needs-patch needs-refresh removed

@spacedmonkey commented on PR #4361:


5 months ago
#12

Fixed

Note: See TracTickets for help on using tickets.