MyCUST - Deminy的个人网站
首页 关于我 我的感想 个人百科 我的链接 我的照片 与我联系
MSN 留言本 我的文章 个人计划 农历年历 常见问题 朋友专栏

MyCUST

目录

Summary

  • Operation time: 2007-08-25 02:52 EDT
  • Table: cdb_posts
  • # of records: 281,200
  • Size: 186.3 MiB
  • DB server: 4.1.22-standard-log

域名管理

  • mycust.us: 注册者为deminy。此为当前使用的主域名。
  • mycust.com: 注册者为王同学。不在控制范围之内。
  • mycust.net: 注册者为王同学。指向mycust.us。
  • mycust.com: 注册者为阎同学。暂未启用。

Step

  • backup
    • make a local copy:
      rm -rf mycust.20070825.bz2;
      mysqldump --skip-opt -q -e --create-options -h localhost -u deminy_cust -p deminy_cust | bzip2 -c > mycust.20070825.bz2

    • make a copy in same DB: deminy_cust.cdb_posts2.

    • make a new field in same tabledeminy_cust.cdb_posts.message2.
      ALTER TABLE `cdb_posts` ADD `message2` MEDIUMTEXT AFTER `message` ; # nullable
      UPDATE `cdb_posts` set `message2` = `message`;[1]

An efficient way

1. viewthread.php convert the file to UTF-8, and add following code to function viewthread_procpost($post, $special = 0)

	# http://www.mycust.us/bbs/viewthread.php?tid=17721&page=1&fromuid=1615#pid169532
	if (function_exists('mb_eregi_replace')) {
		$func = 'mb_eregi_replace';
	} else {
		$func = 'eregi_replace';
	}
	if ($post['dbdateline'] < strtotime('Thu, 27 Oct 2005 00:00:00 +0800')) {
		$post['message'] = $func('mycust.org', 'mycust.us', $post['message']);
	} else if ($post['dbdateline'] < strtotime('Mon, 26 Oct 2007 14:00:00 +0800')) {
		$post['message'] = $func('mycust.com', 'mycust.us', $post['message']);
	}
	$post['message'] = $func('王风行', '王同学', $post['message']);

.htaccess[2]

# ErrorDocument 404 /bbs/index.php

Options All -Indexes

# Order allow,deny
# Deny from all

AddHandler application/x-httpd-php5 .php

# Redirect all other domains to mycust.us
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.deminy\.net$ [NC]
RewriteRule mycust(/.*)?$ http://www.mycust.us/$1 [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.mycust\.us$ [NC]
RewriteRule ^(.*)$ http://www.mycust.us/$1 [R=301,L]

# Move from dvbbs to Discuz!
# http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule
RewriteBase /bbs/
RewriteCond %{SCRIPT_FILENAME}  dispbbs\.asp [NC]
RewriteCond %{QUERY_STRING}     ^(ID=(.*)|(.*)&ID=(.*))$ [NC] 
RewriteRule .* viewthread.php?%3&tid=%2%4 [R=301,L]

# Redirect / to /bbs
RewriteRule ^/?$ /bbs/ [R=302,L]

维护日志

  • Wed 19 Dec 2007 09:32:11 PM EST 强行升级Discuz!到6.0.0。
  • 2007-12-02 15:49:07 修改.htaccess,将mycust.net通过重定向方式指向mycust.us。另有其他修改。
  • 2007-11-27: 从服务器上删除mycust.com的DNS记录,并将mycust.net停靠(park)在mycust.us。

Trouble Shooting

  • Thu 20 Dec 2007 12:30:07 PM PST
    function authcode() in file include/global.inc.php won't work properly if "mbstring.func_overload = 7". Thus logged-in user would quit automatically when session (logged in database) expires.

Backup

mysqldump --opt -u -p

See Also

References

  1. Rollback query: UPDATE `cdb_posts` set `message` = `message2` where `message2` IS NOT NULL;
  2. 关于.htaccess的当前文件放置在这里

取自"http://www.deminy.net/wiki/MyCUST"

本页面已经被浏览2,781次。 这页的最后修订在 2008年7月26日 (星期六) 01:32。 版权声明