首页 > Personal > Blog > blog搬家 续2
2011
01-14

blog搬家 续2

昨天还说wordpress在godaddy上备份很成问题, 今天就找到了一个很强大的插件, BackWPup. 可以备份wordpress上所有东西, 文件, 数据库, blog, 而且有定时任务(设置里禁用wp-cron, 然后设置一个hoster cron, 定时执行wp-cron.php(godaddy 的话 hosting center里有cron manager 可以添加cron), 就可以实现真正的定时, 而不是wp-cron这种假定时, 只能访问时才能触发), 备份起来非常方便, 还可以把备份发送到邮箱里, 这样一来备份问题就完全解决了. 使用了下, 备份之后发送都没问题, 不过备份文件变大以后会出warning, 而且php mail方式邮件发不出去, 网上找了个解决warning的办法: backwpup/app/backwpup_dojob.php

When mailing an archive, the log shows this…

2010-10-18 13:19.51: Creating mail
2010-10-18 13:19.51: [WARNING] date() expects parameter 2 to be long, string given
2010-10-18 13:19.51: [WARNING] date() expects parameter 2 to be long, string given
2010-10-18 13:19.51: [WARNING] date() expects parameter 2 to be long, string given
2010-10-18 13:19.51: [WARNING] date() expects parameter 2 to be long, string given
2010-10-18 13:19.51: [WARNING] date() expects parameter 2 to be long, string given
2010-10-18 13:19.51: Adding Attachment to mail

Looking at the code, the warning occurs on line 1031 when formatting the subject of the email…

$phpmailer->Subject = __(‘BackWPup File from’,’backwpup’).’ ‘.date_i18n(‘Y-m-d H:i’,$this->job[‘starttime’]).’: ‘.$this->job[‘name’];

‘starttime’ is set on line 189….

$jobs[$this->jobid][‘starttime’]=current_time(‘timestamp’); //set start time for job

The problem is the starttime is assigned to the $jobs array – but the mailing accesses the $this->job array.

A workaround I did that resolves the issue (so the email subject has the starttime & no warning is reported to the log) is to change the starttime assignment to also assign to $this->job…

$this->job[‘starttime’] = $jobs[$this->jobid][‘starttime’]=current_time(‘timestamp’); //DTC //set start time for job

发邮件方式换成sendmail就可以了.

PS: 晚上又一个好消息, 之前日志导出之后, 再导入其他blog基本都不成功, 只能成功倒回wordpress. 终于试出了原因. 导出的xml文件第一行多了一行空行, 这么简单的问题…. 国内各大blog的导入兼容性还是很成问题的. 所以现在为了导出文件可用, 不止要删除最后两行的godaddy广告, 还要删除第一行的空行…

解决引号替换问题, 安装 Quotmarks Replacer 插件, 也可以自己修改代码/wp-includes/formatting.php

查找以下代码并注释掉:

// static strings
$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

成为:

// static strings
//$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
//$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

wordpress基本所有问题已经解决, 再次回归, 暂时又要告别163bog了. 花了大概一个星期晚上的时间, 真够折腾的.

最后, 总结一下一些常用的 wordpress 插件:

Akismet(自带, 过滤评论)

Google XML Sitemaps with Multisite support(生成sitemap)

Quotmarks Replacer(解决括号问题)

WordPress Importer(导入插件)

WP-DownloadManager(文件下载, 因为godaddy免费空间的广告, 有点问题, 文件最下面会有广告脚本)

WP-PageNavi(页面导航)

个人经验, 如果插件装了无法使用, 先去插件网站看下Installation或者Usage, 一般都能解决.

修改文章页面模板single.php去掉文章页面侧边栏, 增大阅读面积.

<div id=”container” class=”one-column”>

删除 <?php get_sidebar(); ?>

修改style.css

.one-column #content {
    margin: 0 auto;
    width: 900px;
}

删除meta中多余项 wp-includes\default-widgets.php中删除3行

<li><a href=”<?php bloginfo(‘rss2_url’); ?>” title=”<?php echo esc_attr(__(‘Syndicate this site using RSS 2.0’)); ?>”><?php _e(‘Entries <abbr title=”Really Simple Syndication”>RSS</abbr>’); ?></a></li>
<li><a href=”<?php bloginfo(‘comments_rss2_url’); ?>” title=”<?php echo esc_attr(__(‘The latest comments to all posts in RSS’)); ?>”><?php _e(‘Comments <abbr title=”Really Simple Syndication”>RSS</abbr>’); ?></a></li>
<li><a href=”http://wordpress.org/” title=”<?php echo esc_attr(__(‘Powered by WordPress, state-of-the-art semantic personal publishing platform.’)); ?>”>WordPress.org</a></li>

修改文章字体

#content,
#content input,
#content textarea {
    color: #333;
    font-size: 13px;
    font-family: ‘Trebuchet MS’,Trebuchet,Verdana,Sans-Serif;
    line-height: 20px;
}

最后编辑:
作者:wy182000
这个作者貌似有点懒,什么都没有留下。

留下一个回复