|
Haven't registered yet? Do it here now!
|
|
|
|
xxxdude
Joined: 17 Nov 2008 Posts: 3
|
|
|
|
|
|
|
Posted: Fri Nov 21, 2008 8:58 pm Post subject: Script To Help With Mass Blogs |
|
|
|
|
|
|
|
|
|
|
I Had to replace a wordpress-mu with BO, and did not have alot of time, and now that I understand how BO works, I realized it was time consuming to create alot of blogs, mostly due to the design, and uploading of the files.
One way I sped up this process, and helped me to create 170 blogs yesterday is a small script process I wrote, and will share here.
The assumption is that the blog name is located off the root, one directory up from where this script process will be. So it will create the directory for your new blog one level up.
First, create blog and grab a full zip of the files you are to upload. Note the number of the blog.
Copy those zip files to your server, assuming you have SSH capability. If not you will need to do this on your pc, and then upload.
Off the root of your web container, create a template directory, assuming you do not have one of these, or you will need to choose a different name.
Ex: mkdir template
Ex: cd template
Extract the zip. into this template directory, rename .htaccess to htaccess_dist.
Ex: unzip bofiles.zip
Open each file that was extracted and do a search replace on the number of the blog that these files were created for and replace that number with a #. Note a few files might have that number as a variable, so just where it is obvious that it is the blog number, not preceded by a dollar sign for example. Do this on all files.
Then create a work directory underneath the template directory.
mkdir work
in
Ex: mkdir work
Then using an editor, in this case nano on my system, create a list.txt file and put in these contents:
Ex: nano -w list.txt
Code: | *** START SNIP
work/archives.php
work/bopost.php
work/bositemap.php
work/cat.php
work/googlemap.php
work/index.php
work/pages.php
work/rss-feed.php
work/track.php
work/htaccess_dist
** END SNIP |
Then using an editor, in this case nano on my system, create a create.php file and put in these contents:
Code: | *** START SNIP
<?php
$bid=$_GET['bid'];
$bname=$_GET['bname'];
$files=file('list.txt');
$command='/bin/rm work/*';
exec($command);
$command='cp archives.php bopost.php bositemap.php cat.php googlemap.php index.php pages.php rss-feed.php track.php htaccess_dist work';
exec($command);
foreach($files as $file)
{
$command='/bin/sed -i \'s/#/' .$bid.'/g\' '.str_replace(' ','\ ',$file);
exec($command);
}
$command='/bin/mkdir ../'.$bname;
exec($command);
$command='/bin/cp work/* ../'.$bname;
exec($command);
$command='/bin/rm -f work/*';
exec($command);
$command='cd ../'.$bname.'; mv htaccess_dist .htaccess';
exec($command);
?>
** END SNIP
|
Then, you will need to make sure that the whole template folder has write access by apache.
Ex: chown -R apache:apache template
Now, when create your blogs that you want, and then review the blogs in your manage blog list, and just highlight everything and copy to a editor such as jedit, where you can massage it. I did up a quick macro to massage the numbers on the left and the url to end up with lines like this in my batch file. In this case I put a one second loop in there, and since i use linux it is a sleep 1. If you use windows you need to use wait.
Code: | firefox 'http://www.domain.com/create.php?bid=1&bname=newblog1'
sleep 1
firefox 'http://www.domain.com/create.php?bid=2&bname=newblog2'
sleep 1
firefox 'http://www.domain.com/create.php?bid=3&bname=newblog3'
sleep 1
|
Now, this should be enough to get you going. If you can't figure out what to do by looking at this script, or how to figure out the parts you are not doing right, you maybe should not be doing this process and get another person to help you. Done wrong, this can hurt your server setup, be forwarned, plus I could have overlooked something here since I am in a hurry today, but this should get you started
Takes about a 1 minute to setup the server side for 40 blogs, mostly due to the wait.
Note: I processed about 40 each time. Sometimes PHP got the blog variables mixed up, and the wrong blog comes up. If this happens just rerun the whole script or just the url's for the bad blogs. This process overwrites.
xxxdude |
|
|
|
|
|
|
|
Atanasis Owner
Joined: 22 May 2004 Posts: 4284 Location: The Net
|
|
|
|
|
|
|
Posted: Fri Nov 21, 2008 10:09 pm Post subject: |
|
|
|
|
|
|
|
|
|
|
well, yeah if you want more automated way to create blogs, you can always make any kind of additional scripts to speed up the process.
But you understand that you should be experienced,
Most regular webmasters are mainly marketers and not skilled programmers
Thanks for sharing it, hope it will be useful to rest users. _________________ Thanks,
Kaktusan
|
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|
|
|
|
|
|