[wp-hackers] Cloning content from Master site into new sites on a WP Network

Jesse Friedman highfive at jesserfriedman.com
Thu Jul 12 12:44:36 UTC 2012


After all that from yesterday I simply wrote this today:

$new_mysql_query = 'REPLACE INTO ntw_'.$newsiteid.'_posts SELECT * FROM
ntw_posts WHERE post_type="custom post type";';
$result = mysql_query($new_mysql_query);

It works perfectly and is very fast.  Is this general bad practice and if
it is could you explain why?

Jesse

On Thu, Jul 12, 2012 at 7:41 AM, Jesse Friedman <highfive at jesserfriedman.com
> wrote:

> Thanks everyone for the help yesterday. One more question.
>
> I'm running into an issue. After the switch I insert all the posts and it
> works perfectly. However something is happening with that specific new site
> because the dashboard will load amazingly slow. Oddly enough it's just that
> one site. I can visit the rest of the network no problem. I'm guessing that
> it's the restore_current_blog(); not working right (my fault).  If I
> restart Apache I'm good to go and all the pages are there.
>
> Before I attempt to tackle this issue I started to think about cloning the
> posts using mySQL and PHP? Would it be a bad idea to just connect directly
> to the database, clone the master site wp_posts table and be done with it?
>
> Jesse
>
> On Wed, Jul 11, 2012 at 3:43 PM, Otto <otto at ottodestruct.com> wrote:
>
>> On Wed, Jul 11, 2012 at 2:39 PM, Jesse Friedman
>> <highfive at jesserfriedman.com> wrote:
>> > Otto
>> >
>> > In this case I would know exactly what site I want to switch to and
>> would
>> > only happen when a new site is added.  Seems like it won't cause too
>> much
>> > of a headache in that instance.
>>
>> Right, exactly. It's a limited case, you're not overusing it, should
>> work just fine. Make sure you have the PHP memory_limit set high
>> enough to hold the products you want to pull from the master site and
>> put into the subsite.
>>
>> -Otto
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> thanks,
>
> *Jesse Friedman*
> 508-507-9673 | jesserfriedman at gmail.com
> http://jesserfriedman.com | @professor <http://twitter.com/professor>
>



-- 
thanks,

*Jesse Friedman*
508-507-9673 | jesserfriedman at gmail.com
http://jesserfriedman.com | @professor <http://twitter.com/professor>


More information about the wp-hackers mailing list