-
OpenPNE-3alpha1(ルートディレクトリ)
-
apps
-
mobile_frontend
-
pc_backend
-
pc_frontend
-
cache
-
config
-
data
-
fixtures
-
sql
-
doc
-
lib
-
form
-
helper
-
model
-
log
-
plugins
-
sfOpenPNEAuthLoginIDPlugin
-
sfOpenPNESecurityUserPlugin
-
test
-
bootstrap
-
functional
-
unit
-
web
-
css
-
errors
-
images
-
js
-
uploads
8 月 2
[OpenPNE3]alpha1をインストールした時のメモ
OpenPNE3 開発用ページを参考に、OpenPNE3 alpha1をインストールしてみました。
1. OpenPNE3 alpha1 本体のダウンロード
今回はsvnのtagsからエクスポートします。
-
$ cd /var/www # ここに設置するとする
-
$ svn export https://trac.openpne.jp/svn/OpenPNE3/tags/OpenPNE-3alpha1/
-
$ cd ./OpenPNE-3alpha1
エクスポート直後のOpenPNE-3alpha1ディレクトリ階層はこんな感じです。
libフォルダの中にformフォルダがある。どうやらsymfony 1.1のようです。
私の環境はいくつかのプロジェクトが入っているサーバなので、サーバ自体にsymfonyをインストールしたくないです。
(パッケージの中にsymfony本体を含めて欲しいんだけどな。。。)
2. symfony 1.1.1 本体のダウンロードと設置
そんなわけで、OpenPNE3 alpha1内にsymfonyを含めることにしました。意外と簡単。というか特に特別なことがいらなかった。
-
$ cd ./lib
-
$ wget http://www.symfony-project.org/get/symfony-1.1.1.tgz
-
$ tar zxvf symfony-1.1.1.tgz
-
$ rm symfony-1.1.1.tgz
これで /lib/symfony-1.1.1のディレクトリの中にsymfonyがたくさんはいっている状態です。
3. 設定ファイルの準備
ここから設定系。まずはconfigディレクトリ内の*.sampleファイルをコピーして、
.sampleなしのファイルを作成します。OpenPNE3 開発用ページに便利コマンドが載ってるので採用します。
-
$ cd ../
-
$ pwd
-
/var/www/OpenPNE-3alpha1
-
$ ls config/*.sample | sed -e 's/\.sample$//g' | awk '{print "cp "$1".sample "$1}' | sh
すると、databases.yml、ProjectConfiguration.class.php、propel.iniの3つが作成されます。
4. プロジェクト設定とsymfonyライブラリへのパスの指定
まずはconfig/ProjectConfiguration.class.php を編集して、さっきのsymfonyライブラリのディレクトリを指定してあげます。
-
$ vim config/ProjectConfiguration.class.php
スクリプト中に##SYMFONY_LIB_DIR#という文字列があるので、パスを指定します。さきほど解凍したsymfony-1.1.1ディレクトリの中のlibディレクトリが該当します。書き換えると、以下のようなスクリプトになります。(ルートは/var/www/OpenPNE- 3alpha1と仮定)
-
<?php
-
-
require_once '/var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/autoload/sfCoreAutoload.class.php';
-
sfCoreAutoload::register();
-
-
class ProjectConfiguration extends sfProjectConfiguration
-
{
-
public function setup()
-
{
-
}
-
}
これでsymfonyライブラリへのパスが通ったので、symfonyコマンドも動くようになります。./symfonyを実行すると以下のようなコマンド一覧が表示されれば、パスの設定が正しいことを表します。逆に実行しても何も表示されずに終了してしまった場合、パスの設定が間違っているので、もう1 度確認してみてください。
-
$ pwd
-
/var/www/OpenPNE-3alpha1
-
$ ./symfony
-
Available tasks:
-
:help Displays help for a task (h)
-
:list Lists tasks
-
cache
-
:clear Clears the cache (cc, clear-cache)
-
configure
-
:author Configure project author
-
:database Configure database DSN
-
generate
-
:app Generates a new application (init-app)
-
:module Generates a new module (init-module)
-
:project Generates a new project (init-project)
-
:task Creates a skeleton class for a new task
-
i18n
-
:extract Extracts i18n strings from php files
-
:find Finds non "i18n ready" strings in an application
-
log
-
:clear Clears log files (log-purge)
-
:rotate Rotates an application log files (log-rotate)
-
plugin
-
:add-channel Add a new PEAR channel
-
:install Installs a plugin (plugin-install)
-
:list Lists installed plugins (plugin-list)
-
:uninstall Uninstalls a plugin (plugin-uninstall)
-
:upgrade Upgrades a plugin (plugin-upgrade)
-
project
-
:clear-controllers Clears all non production environment controllers (clear-controllers)
-
:deploy Deploys a project to another server (sync)
-
:disable Disables an application in a given environment (disable)
-
:enable Enables an application in a given environment (enable)
-
:freeze Freezes symfony libraries (freeze)
-
:permissions Fixes symfony directory permissions (permissions, fix-perms)
-
:unfreeze Unfreezes symfony libraries (unfreeze)
-
:upgrade1.1 Upgrade a symfony project to the 1.1 symfony release
-
propel
-
:build-all Generates Propel model, SQL and initializes the database (propel-build-all)
-
:build-all-load Generates Propel model, SQL, initializes database, and load data (propel-build-all-load)
-
:build-db Creates database for current model (propel-build-db)
-
:build-forms Creates form classes for the current model
-
:build-model Creates classes for the current model (propel-build-model)
-
:build-schema Creates a schema.xml from an existing database (propel-build-schema)
-
:build-sql Creates SQL for the current model (propel-build-sql)
-
:data-dump Dumps data to the fixtures directory (propel-dump-data)
-
:data-load Loads data from fixtures directory (propel-load-data)
-
:generate-crud Generates a Propel CRUD module (propel-generate-crud)
-
:init-admin Initializes a Propel admin module (propel-init-admin)
-
:insert-sql Inserts SQL for current model (propel-insert-sql)
-
:schema-to-xml Creates schema.xml from schema.yml (propel-convert-yml-schema)
-
:schema-to-yml Creates schema.yml from schema.xml (propel-convert-xml-schema)
-
test
-
:all Launches all tests (test-all)
-
:functional Launches functional tests (test-functional)
-
:unit Launches unit tests (test-unit)
5. データベースの設定
次はMySQLにユーザーとデータベースを新規に作成します。DB名は「openpne3alpha1」、ユーザー名も「openpne3alpha1」、パスワードは「123456」と仮定します。
-
$ mysql -u root
-
Welcome to the MySQL monitor. Commands end with ; or \g.
-
Your MySQL connection id is 10 to server version: 5.0.22
-
-
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
-
-
mysql> CREATE DATABASE openpne3alpha1 DEFAULT CHARACTER SET utf8;
-
Query OK, 1 row affected (0.22 sec)
-
-
mysql> GRANT ALL ON openpne3alpha1.* TO openpne3alpha1@localhost IDENTIFIED BY "123456";
-
Query OK, 0 rows affected (0.07 sec)
-
-
mysql> exit
-
Bye
MySQLの設定が終了次第、symfonyコマンドを用いてDSN(Data Source Name)を一括設定します。以下のコマンドを実行すると、configディレクトリ内のdatabases.ymlやpropel.iniの中のDSN 部分が一括で書き換えられます。
-
$ ./symfony configure:database mysql://openpne3alpha1:123456@localhost/openpne3alpha1
忘れてはいけないのが、config/databases.ymlにデータベースのエンコードを指定することです。「encoding: utf8」という記述を含めます。
-
$ vim config/databases.yml
YAMLファイルは以下のようになります。
-
all:
-
propel:
-
class: sfPropelDatabase
-
param:
-
dsn: 'mysql://openpne3alpha1:123456@localhost/openpne3alpha1'
-
encoding: utf8
最後に、symfonyコマンドのpropel:build-all-loadを実行して、スキーマファイルに基づきモデルとCREATE TABLE文を作成し、TABLEは実際に作成し、さらにテストデータも挿入します。
-
$ ./symfony propel:build-all-load pc_frontend
-
>> schema converting "/var/www/OpenPNE-3alpha1/config/schema.yml" to XML
-
>> schema putting /var/www/OpenPNE-3alpha1/config/generated-schema.xml
-
>> schema converting "/var/www/OpenPNE-3a...lugin/config/schema.yml" to XML
-
>> schema putting /var/www/OpenPNE-3alpha...PNEAuthLoginIDPlugin-schema.xml
-
>> file+ config/generated-sfOpenPNEAuthLoginIDPlugin-schema.xml
-
>> file- /var/www/OpenPNE-3alpha1/plugin...PNEAuthLoginIDPlugin-schema.xml
-
Buildfile: /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build.xml
-
[resolvepath] Resolved /var/www/OpenPNE-3alpha1/config to /var/www/OpenPNE-3alpha1/config
-
-
propel-project-builder> check-project-or-dir-set:
-
-
propel-project-builder> check-project-set:
-
-
propel-project-builder> set-project-dir:
-
-
propel-project-builder> check-buildprops-exists:
-
-
propel-project-builder> check-buildprops-for-propel-gen:
-
-
propel-project-builder> check-buildprops:
-
-
propel-project-builder> configure:
-
[echo] Loading project-specific props from /var/www/OpenPNE-3alpha1/config/propel.ini
-
[property] Loading /var/www/OpenPNE-3alpha1/config/propel.ini
-
-
propel-project-builder> om:
-
[phing] Calling Buildfile '/var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'om'
-
[property] Loading /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties
-
-
propel> check-run-only-on-schema-change:
-
-
propel> om-check:
-
-
propel> om:
-
[echo] +------------------------------------------+
-
[echo] | |
-
[echo] | Generating Peer-based Object Model for |
-
[echo] | YOUR Propel project! (NEW OM BUILDERS)! |
-
[echo] | |
-
[echo] +------------------------------------------+
-
[phingcall] Calling Buildfile '/var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'om-template'
-
[property] Loading /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties
-
-
propel> om-template:
-
[propel-om] Target database type: mysql
-
[propel-om] Target package: lib.model
-
[propel-om] Using template path: /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/templates
-
[propel-om] Output directory: /var/www/OpenPNE-3alpha1
-
[propel-om] Processing: generated-schema.xml
-
[propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
-
[propel-om] Processing: generated-sfOpenPNEAuthLoginIDPlugin-schema.xml
-
[propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
-
[propel-om] Processing Datamodel : JoinedDataModel
-
[propel-om] - processing database : propel
-
[propel-om] + member
-
[propel-om] -> BaseMemberPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseMember [builder: SfObjectBuilder]
-
[propel-om] -> MemberMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) MemberPeer
-
[propel-om] -> (exists) Member
-
[propel-om] + profile
-
[propel-om] -> BaseProfilePeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseProfile [builder: SfObjectBuilder]
-
[propel-om] -> ProfileMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) ProfilePeer
-
[propel-om] -> (exists) Profile
-
[propel-om] + profile_i18n
-
[propel-om] -> BaseProfileI18nPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseProfileI18n [builder: SfObjectBuilder]
-
[propel-om] -> ProfileI18nMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) ProfileI18nPeer
-
[propel-om] -> (exists) ProfileI18n
-
[propel-om] + profile_option
-
[propel-om] -> BaseProfileOptionPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseProfileOption [builder: SfObjectBuilder]
-
[propel-om] -> ProfileOptionMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) ProfileOptionPeer
-
[propel-om] -> (exists) ProfileOption
-
[propel-om] + profile_option_i18n
-
[propel-om] -> BaseProfileOptionI18nPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseProfileOptionI18n [builder: SfObjectBuilder]
-
[propel-om] -> ProfileOptionI18nMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) ProfileOptionI18nPeer
-
[propel-om] -> (exists) ProfileOptionI18n
-
[propel-om] + member_profile
-
[propel-om] -> BaseMemberProfilePeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseMemberProfile [builder: SfObjectBuilder]
-
[propel-om] -> MemberProfileMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) MemberProfilePeer
-
[propel-om] -> (exists) MemberProfile
-
[propel-om] + friend
-
[propel-om] -> BaseFriendPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseFriend [builder: SfObjectBuilder]
-
[propel-om] -> FriendMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) FriendPeer
-
[propel-om] -> (exists) Friend
-
[propel-om] + community
-
[propel-om] -> BaseCommunityPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseCommunity [builder: SfObjectBuilder]
-
[propel-om] -> CommunityMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) CommunityPeer
-
[propel-om] -> (exists) Community
-
[propel-om] + community_member
-
[propel-om] -> BaseCommunityMemberPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseCommunityMember [builder: SfObjectBuilder]
-
[propel-om] -> CommunityMemberMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) CommunityMemberPeer
-
[propel-om] -> (exists) CommunityMember
-
[propel-om] + authentication_login_id
-
[propel-om] -> BaseAuthenticationLoginIdPeer [builder: SfPeerBuilder]
-
[propel-om] -> BaseAuthenticationLoginId [builder: SfObjectBuilder]
-
[propel-om] -> AuthenticationLoginIdMapBuilder [builder: SfMapBuilderBuilder]
-
[propel-om] -> (exists) AuthenticationLoginIdPeer
-
[propel-om] -> (exists) AuthenticationLoginId
-
-
BUILD FINISHED
-
-
Total time: 3.3003 seconds
-
>> file- /var/www/OpenPNE-3alpha1/config...PNEAuthLoginIDPlugin-schema.xml
-
>> file- /var/www/OpenPNE-3alpha1/config/generated-schema.xml
-
>> autoload reloading autoloading
-
>> schema converting "/var/www/OpenPNE-3alpha1/config/schema.yml" to XML
-
>> schema putting /var/www/OpenPNE-3alpha1/config/generated-schema.xml
-
>> schema converting "/var/www/OpenPNE-3a...lugin/config/schema.yml" to XML
-
>> schema putting /var/www/OpenPNE-3alpha...PNEAuthLoginIDPlugin-schema.xml
-
>> file+ config/generated-sfOpenPNEAuthLoginIDPlugin-schema.xml
-
>> file- /var/www/OpenPNE-3alpha1/plugin...PNEAuthLoginIDPlugin-schema.xml
-
Buildfile: /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build.xml
-
[resolvepath] Resolved /var/www/OpenPNE-3alpha1/config to /var/www/OpenPNE-3alpha1/config
-
-
propel-project-builder> check-project-or-dir-set:
-
-
propel-project-builder> check-project-set:
-
-
propel-project-builder> set-project-dir:
-
-
propel-project-builder> check-buildprops-exists:
-
-
propel-project-builder> check-buildprops-for-propel-gen:
-
-
propel-project-builder> check-buildprops:
-
-
propel-project-builder> configure:
-
[echo] Loading project-specific props from /var/www/OpenPNE-3alpha1/config/propel.ini
-
[property] Loading /var/www/OpenPNE-3alpha1/config/propel.ini
-
-
propel-project-builder> sql:
-
[phing] Calling Buildfile '/var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'sql'
-
[property] Loading /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties
-
-
propel> check-run-only-on-schema-change:
-
-
propel> sql-check:
-
-
propel> pgsql-quoting-check:
-
-
propel> sql:
-
[echo] +------------------------------------------+
-
[echo] | |
-
[echo] | Generating SQL for YOUR Propel project! |
-
[echo] | |
-
[echo] +------------------------------------------+
-
[phingcall] Calling Buildfile '/var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'sql-template'
-
[property] Loading /var/www/OpenPNE-3alpha1/lib/symfony-1.1.1/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties
-
-
propel> sql-template:
-
[propel-sql] Processing: generated-schema.xml
-
[propel-sql] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
-
[propel-sql] Processing: generated-sfOpenPNEAuthLoginIDPlugin-schema.xml
-
[propel-sql] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
-
[propel-sql] Writing to SQL file: /var/www/OpenPNE-3alpha1/data/sql/lib.model.schema.sql
-
[propel-sql] + member [builder: MysqlDDLBuilder]
-
[propel-sql] + profile [builder: MysqlDDLBuilder]
-
[propel-sql] + profile_i18n [builder: MysqlDDLBuilder]