[wp-testers] sorta an off the wall bug

Bimal Rekhadiya bimaljr at gmail.com
Thu Jun 21 15:20:45 UTC 2012


I am fully agree with Philip. The path should not absolute path. The upload
process is working with "wp-content/uploads" path. So changing this will
not make any effect. And this will help us when we move host.

I am a web developer.The Media upload is broken whenever I move Wordpress
site to client's host. Sometimes I forget to change the path and client
would little worry when he/she see the error. So I recommend to change the
path to "wp-content/uploads" and not the full absolute path.






On Thu, Jun 21, 2012 at 6:50 PM, Philip M. Hofer (Frumph) <philip at frumph.net
> wrote:

> Okie dokie.   I am storing it in my memory to remember to have people
> check that as a possible reason why the wp_upload_dir() is failing.
>
> - Phil
>
>
>
> -----Original Message----- From: Otto
> Sent: Thursday, June 21, 2012 6:16 AM
> To: wp-testers at lists.automattic.**com <wp-testers at lists.automattic.com>
> Subject: Re: [wp-testers] sorta an off the wall bug
>
>
> There's nothing wrong with that. The upload_path *should* get set to
> the full hard-path when the wp-content directory isn't in the ABSPATH.
>
> When you move the site from one place to another, yes, that
> upload_path will break if it's a hard path. But so will many other
> things, generally speaking. The upload_path is a user-changable
> variable for a reason.
>
> -Otto
>
>
> On Wed, Jun 20, 2012 at 7:56 PM, Philip M. Hofer (Frumph)
> <philip at frumph.net> wrote:
>
>> When installing wordpress and running it.    It is setting the upload_path
>> to be the path structure of where the upload directory is hardcoded with
>> /path/to/wp-content/uploads/  so what is happening is that the
>> wp_upload_dir
>> is taking that information.
>>
>> So when someone moves their site path, it's retaining the hard location, a
>> user could move their system from a subdirectory to a root of it or even
>> to
>> another location altogether and do sql dumps to restore their site the
>> upload_path doesn't reset for the new location
>>
>>
>>
>> wp_upload_dir() reports this as it's error:
>>
>> ["error"]=> string(142) "Unable to create directory
>> /home1/tkdanimc/public_html/**nikkisprite/wp-content/**uploads/2012/06.
>> Is its
>> parent directory writable by the server?"
>>
>> ^ this is because the upload_path is set to
>> /home1/tkdanimc/public_html/**nikkisprite/wp-content/uploads
>>
>> get_stylesheet_directory()  returns this:
>>
>> string(71)
>> "/home/tdoherty/public_html/ni**kkisprite.com/wp-content/**
>> themes/comicpress <http://nikkisprite.com/wp-content/themes/comicpress>"
>>
>> ^ which is correct because that is the new location on the new server
>>
>> changing the upload_path to just wp-content/uploads of course works just
>> fine
>>
>>
>>
>>
>>
>> the problem actually comes from wp-admin/includes/schema.php line 931-935
>>
>> if ( !$upload_path = get_option( 'upload_path' ) ) {
>>  $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads';
>>  update_option( 'upload_path', $upload_path );
>> }
>> update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' .
>> $upload_path );
>>
>> What this is doing, is hardcoding the current abspath and the
>> WP_CONTENT_DIR
>> with /uploads resulting in the absolute hardcoding of that location
>>
>>
>>
>>
>> What I am saying the problem is.      function wp_upload_dir()  is not
>> properly stripping out the information in line 1445-1448 because the
>> ABSPATH
>> is different then it actually is hardcoded in the upload_path
>>
>>
>>
>> Does this make sense?
>>
>>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> wp-testers mailing list
>> wp-testers at lists.automattic.**com <wp-testers at lists.automattic.com>
>> http://lists.automattic.com/**mailman/listinfo/wp-testers<http://lists.automattic.com/mailman/listinfo/wp-testers>
>>
> ______________________________**_________________
> wp-testers mailing list
> wp-testers at lists.automattic.**com <wp-testers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-testers<http://lists.automattic.com/mailman/listinfo/wp-testers>
> ______________________________**_________________
> wp-testers mailing list
> wp-testers at lists.automattic.**com <wp-testers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-testers<http://lists.automattic.com/mailman/listinfo/wp-testers>
>



-- 


More information about the wp-testers mailing list