[wp-hackers] Keep local DB in sync with remote DB
Alex Hempton-Smith
hempsworth at googlemail.com
Sat Nov 29 15:53:04 GMT 2008
Okay, silly me should have looked in the codex first, so I can override the
options in the DB by adding this:
define('WP_SITEURL', 'http://localhost/mysite.com/wordpress');
define('WP_HOME', 'http://localhost/mysite.com');
But the if statement I posted earlier, to check if the client IP matches the
server IP doesn't seem to work; any ideas how I can define these if I am
browsing the site from localhost?
Many thanks,
Alex
On Sat, Nov 29, 2008 at 3:13 PM, Alex Hempton-Smith <
hempsworth at googlemail.com> wrote:
> Something like:
> $my_ip = getenv("HTTP_CLIENT_IP");
> $machine_ip = getenv("REMOTE_ADDR");
>
> if ($my_ip == $machine_ip) {
> // define 'siteurl' and 'home'
> };
>
> Would this work? How would I define 'siteurl' and 'home' from inside the
> wp-config.php?
>
> Many thanks,
> Alex
>
> On Sat, Nov 29, 2008 at 3:06 PM, Alex Hempton-Smith <
> hempsworth at googlemail.com> wrote:
>
>> Would I be able to define the wordpress URL and the blog URL from inside
>> the wp-config.php.
>> I want an if statement that could recognize I'm accessing the site from
>> localhost, and then define those URLs as 'localhost', at the moment I can't
>> login because WP is obviously sending me to the URLs from inside the DB,
>> mydomain.com instead of localhost.
>>
>> -- Alex
>>
>>
>>
>> On Sat, Nov 29, 2008 at 3:01 PM, Alex Hempton-Smith <
>> hempsworth at googlemail.com> wrote:
>>
>>> Thanks, I added my IP to the list of allowed hosts in the Dreamhost mySQL
>>> admin.
>>> :)
>>>
>>> -- Alex
>>>
>>>
>>>
>>> On Sat, Nov 29, 2008 at 2:55 PM, Viper007Bond <viper at viper007bond.com>wrote:
>>>
>>>> 99.9% of hosts block remote MySQL connections. Unless they have the
>>>> option
>>>> to enable it so that you can set up a cron/scheduled task to make a copy
>>>> of
>>>> your remote DB and import it into your localhost MySQL server, you're
>>>> SOL.
>>>>
>>>> On Sat, Nov 29, 2008 at 6:47 AM, Alex Hempton-Smith <
>>>> hempsworth at googlemail.com> wrote:
>>>>
>>>> > Hi,
>>>> > I'm moving my development over to a local WAMP server, instead of
>>>> uploading
>>>> > files and checking the changes every time.
>>>> > How would I keep my local mySQL database in sync with my remote mySQL
>>>> > database?
>>>> >
>>>> > The remote database is hosted at Dreamhost, so the database has a
>>>> > mysql.mydomain.com
>>>> > address, rather than localhost, but when I use that on the local WAMP
>>>> > server it shows "Error establishing a database connection".
>>>> > Many thanks,
>>>> > Alex
>>>> > _______________________________________________
>>>> > wp-hackers mailing list
>>>> > wp-hackers at lists.automattic.com
>>>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>
>>>
>>
>
More information about the wp-hackers
mailing list