2008.08.22 Friday 11:21
WordPress 2.6.1 とWordPressIntegrator
7bitさんのWordPressIntegratorですが、スニペットとプラグインの設置以外にWordPress側の改造が必要になるのがちょっと面倒ですね。これがまた、WordPressのバージョンアップが結構頻繁にあり、その度にWordPressIntegratorと一緒に使うための改造点が変わってしまうと言う複雑さ... 念のため、最新版のWordPress 2.6.1 日本語版を改造した時の悪戦苦闘(最近は慣れてきましたが...笑)の奇跡を下記に記しておきます。必ずしもこの順に改造をする必要は無いのですが、私が出るエラーメッセージを見ながら対処した奇跡そのものを書いてあります。他の方の参考になれば...
なお、使ったMODxのバージョンはSVN版(rev.3938)で、WordPressIntegratorは1.2.0です。
なお、使ったMODxのバージョンはSVN版(rev.3938)で、WordPressIntegratorは1.2.0です。
まずはWordPress側を何も修正しないで使うと...
画面(フロントエンド)上に以下のエラーメッセージが表示されます。
Fatal error: Call to a member function main() on a non-object in /hogehoge/public_html/wp261/wp-includes/functions.php on line 1111
「wp-settings.php」の4箇所の「=& new」を「= new」に変更...
表示されるエラーが以下に変わります。
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: Invalid argument supplied for foreach()
Error type/ Nr.: Warning - 2
File: /hogehoge/public_html/wp261/wp-includes/classes.php
Line: 148
Line 148 source: foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
Parser timing
MySQL: 0.0056 s (13 Requests)
PHP: 0.2713 s
Total: 0.2769 sWordPressIntegratorスニペットに「global $wp_taxonomies;」を追加...
表示されるエラーが以下に変わります。
Fatal error: Call to a member function set_404() on a non-object in /hogehoge/public_html/wp261/wp-includes/classes.php on line 296
「wp-settings.php」の1箇所の「=&」を「=」に変更...
画面(フロントエンド)上のエラーは無く正常に表示されますが、MODxのイベントログに以下が発生します。
Redefining already defined constructor for class WP_Dependencies
「wp-includes/class.wp-dependencies.php」の中にある「function __construct() {}」の行をコメントアウト...
MODxのイベントログのエラーが以下に変わります。
Assigning the return value of new by reference is deprecated
「wp-includes/」ディレクトリ内の「cache.php/query.php/theme.php」の3つのファイルに1箇所ずつある「=& new」を「= new」に変更...
MODxのイベントログのエラーが以下に変わります。
Redefining already defined constructor for class WP_Object_Cache
「wp-includes/cache.php」の以下の3行をコメントアウト...
function WP_Object_Cache() {
return $this->__construct();
}
で、無事にノーエラーで動作するようになりました!