[wp-trac] [WordPress Trac] #28097: wp_get_attachment_url returning guid when uploads directory not writeable by webserver

WordPress Trac noreply at wordpress.org
Thu May 1 20:31:48 UTC 2014


#28097: wp_get_attachment_url returning guid when uploads directory not writeable
by webserver
--------------------------+------------------------------
 Reporter:  jtwg          |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> Related to this issue: https://core.trac.wordpress.org/ticket/26992
>
> In our case we have a setup where we have five machines sharing a
> WordPress database: an internally-facing machine that's not publicly
> accessible where new content is created, and four externally-facing
> machines that serve content to the public.
>
> On the internally-facing machine the webserver has permission to write to
> wp-content/uploads, on the externally-facing machine the webserver does
> not. Because wp_get_attachment_url simply checks for $uploads!['error']
> the correct attachment URL is not returned on the externally-facing
> machines when $uploads!['error'] is true.
>
> It seems that the correct solution here would be only to fail if the
> error is something other than permissions-related, or if the function is
> being called only for retrieving existing attachments. This problem
> occurs on the first of every month, because WP is expecting there to be a
> new directory for the new month and there isn't one.

New description:

 Related to this issue: #26992

 In our case we have a setup where we have five machines sharing a
 WordPress database: an internally-facing machine that's not publicly
 accessible where new content is created, and four externally-facing
 machines that serve content to the public.

 On the internally-facing machine the webserver has permission to write to
 wp-content/uploads, on the externally-facing machine the webserver does
 not. Because wp_get_attachment_url simply checks for $uploads!['error']
 the correct attachment URL is not returned on the externally-facing
 machines when $uploads!['error'] is true.

 It seems that the correct solution here would be only to fail if the error
 is something other than permissions-related, or if the function is being
 called only for retrieving existing attachments. This problem occurs on
 the first of every month, because WP is expecting there to be a new
 directory for the new month and there isn't one.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28097#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list