mail :
The attachment files are the template file for blog site's
configuration and database schema.
Please help to write following program:
create_blog.pl
It will do following things:
- modified the file wp-config.php for these variable:
define('DB_NAME', 'uniforce_blog'); define('DB_USER', 'uniblogadmin');
define('DB_PASSWORD', '123uniforce');
- modified the file blog_db.sql by replace the url
to a new url.
将文件wp-config.php and blog_db.sql文件中的用户名和密码替换下来,以便可以在其它的地方能够通过参数直接使用。
#!/usr/bin/perl
#use warnings
use Tie::File;
sub blog{ #php
$phpfile=$directory.'wp-config.php'; #print "$phpfile\n";
open (CONFIG,$phpfile) or die "can't open wp-config.php$!\n";
foreach $_(<CONFIG>){ s/\'DB_NAME\',.*\)/\'DB_NAME\', \'$db_name\'\)/; s/\'DB_USER\',.*\)/\'DB_USER\', \'$db_user\'\)/; s/\'DB_PASSWORD\',.*\)/\'DB_PASSWORD\', \'$db_passwd\'\)/;
#print "$_\n"; `echo "$_">>blog1`; } `rm -rf $phpfile`; `mv blog1 $phpfile`;
#sql $datafile=$directory.'blog_db.sql';
tie my @lines, 'Tie::File', $datafile or die "Cannot open $datafile: $!\n"; my $url_old = 'http://b2k.uniforce.net
|
阅读(291) | 评论(0) | 转发(0) |