Version at: 24/04/2013, 21:14 vs. version at: 29/04/2013, 00:51
1# How to Install the CakePHP Version of the Tatoeba Web App
2
13NOTE: This is about installing the PHP version (i.e. current version) of Tatoeba.
24
35# Downloads
46
57## Required tools
68
79* Apache
810* PHP
911* MySQL
1012* SVN Client
1113
1214For those who are on Windows:
1315
1416* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL.
1517* [TortoiseSVN](http://tortoisesvn.net/downloads.html) for the SVN client
1618
1719For those who are on Macintosh or Linux:
1820
1921* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.
2022
2123## Source code
2224
2325The source code is hosted on a platform called Assembla:
2426[https://www.assembla.com/code/tatoeba2/subversion/nodes](https://www.assembla.com/code/tatoeba2/subversion/nodes)
2527
2628Repository URL:
2729[https://subversion.assembla.com/svn/tatoeba2/](https://subversion.assembla.com/svn/tatoeba2/)
2830
2931URL you'll want to checkout:
3032[https://subversion.assembla.com/svn/tatoeba2/trunk/](https://subversion.assembla.com/svn/tatoeba2/trunk/)
3133
3234
3335# Configuration
3436
3537## Virtual host
3638
3739You may set up a virtual host. I personally use http://tatoeba.dev/ as my local URL.
3840
3941To find out how to set up a virtual host on a Macintosh using XAMPP see the following page.
4042
4143[http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/]
4244
4345
4446**TODO** More details on how to do that.
4547
4648
4749## mod_rewrite
4850
4951You need to have mod_rewrite enabled, it's necessary for CakePHP.
5052
5153**TODO** More details on how to do that.
5254
5355
5456## app/config/core.php
5557
5658In the file `app/config/core.php`, put into comments the part about XCache.
5759
5860 /*
5961 Cache::config('default', array(
6062 'engine' => 'Xcache', //[required]
6163 'duration'=> 3600, //[optional]
6264 'probability'=> 100, //[optional]
6365 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
6466 'user' => 'user', //user from xcache.admin.user settings
6567 'password' => 'password', //plaintext password (xcache.admin.pass)
6668 ));
6769 Cache::config('_cake_core_', array(
6870 'engine' => 'Xcache', //[required]
6971 'duration'=> 3600, //[optional]
7072 'probability'=> 100, //[optional]
7173 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
7274 'user' => 'user', //user from xcache.admin.user settings
7375 'password' => 'password', //plaintext password (xcache.admin.pass)
7476 ));
7577 */
7678
7779And uncomment the line to use the "File" cache engine:
7880
7981`Cache::config('default', array('engine' => 'File'));`
8082
8183
8284
8385## app/config/database.php
8486
8587In the file `app/config/database.php`, set your login, password and database in the $default array.
8688
8789 var $default = array(
8890 'driver' => 'mysql',
8991 'persistent' => false,
9092 'host' => 'localhost',
9193 'login' => 'root',
9294 'password' => 'somepassword',
9395 'database' => 'tatoeba',
9496 'prefix' => '',
9597 'encoding' => 'utf8'
9698 );
9799
98100
99101## app/models/sentence.php
100102
101103Tatoeba uses some other external tools that you won't necessarily need. These tools are:
102104
103105* the search engine (Sphinx)
104106* the tools for romanization
105107
106108If you're not going to work on the search or on the romanization and don't want to install these tools, you will have to uncomment a few things in the Sentence model (`app/models/sentence.php`).
107109
108110line 274: uncomment "return array(1)"
109111
110112 public function getSeveralRandomIds($lang = 'und', $numberOfIdWanted = 10)
111113 {
112114 // Uncomment the line below if you don't have sphinx installed.
113115 return array(1);`
114116
115117line 847: uncomment "return false"
116118
117119 public function generateMetas(&$sentenceArray)
118120 {
119121 // Uncomment the line below you don't have the Chinese
120122 // romanization tools installed.
121123 return false;`
122124    
123125## Make the following directory writable.
124126
125127/app/tmp/cache/
126128
127129## For XAMPP (at least on a Mac)
128130
129131You'll need to up the default thread_stack from 64K to 256K.
130132(I tried 128K, but that wasn't enough.)
131133
132134/Applications/XAMPP/xamppfiles/etc/my.cnf
133135
134136thread_stack = 256K
135137
136138
137139# Database
138140
139141Now you need to create the database, and import the necessary things. The scripts you will need are in the `docs/database` folder.
140142
141143First, create the database. Make sure the name you use here is the name you've set in app/core/database.php. I'll name it `tatoeba`.
142144
143145 CREATE DATABASE tatoeba
144146 USE tatoeba
145147
146148Then execute the following scripts.
147149
1481501. This will create all the tables (they will be empty).
149151
150152 \. docs/database/database_20130406.sql
151153
1521542. These will create a minimal user base (one user in each group), and the associated access rights for each user.
153155
154156 \. docs/database/import/groups.sql
155157 \. docs/database/import/users.sql
156158 \. docs/database/import/acos.sql
157159 \. docs/database/import/aros.sql
158160 \. docs/database/import/aros_acos.sql
159161
1601623. This will import the list of countries. It's used in profile.
161163
162164 \. docs/database/import/countries.sql
163165
1641664. After you start adding sentences, you will get some errors related to the fact that the table langStats is empty. This table contains lists the different languages in which the sentences are and the number of sentences for each language. So after adding your first sentences, and also everytime you will add sentences in a language that wasn't present before, you will need to execute the following script to update the langStats table:
165167
166168 \. docs/database/scripts/create_fill_langStats.sql
167169
168170
169171You can fill your database with the [exported CSV files](http://tatoeba.org/files/downloads/). For example, adapt and use the following commands to add sentences:
170172
171173 cat sentences.csv | while read -r id lang text; do echo "insert into sentences (id, lang, text) values ('$id', '$lang', '${text//\'/\'}');"; done | sudo mysql -u root tatoeba_database
172174 cat links.csv | while read -r id1 id2; do echo "insert into sentences_translations (sentence_id, translation_id) values ($id1, $id2);"; done | sudo mysql -u root tatoeba_database
173175Expect this to take some time (dozens of minutes) and fill some disk space (several gigabytes).
174176
175177**TODO** Would probably be nice to have some data for sentences, comments, wall messages as well. Although they can be created manually once logged in.
176178
177179
178180
179181
180182# Logging in
181183
182184Now you should be able to go to your local Tatoeba URL (http://tatoeba.dev/ in my case), and be able to log in.
183185
184186The default usernames are:
185187
186188* admin
187189* corpus_maintainer
188190* advanced_contributor
189191* contributor
190192* inactive
191193* spammer
192194
193195The default password for each user is '123456'.
diff view generated by jsdifflib

Version at: 24/04/2013, 21:14

NOTE: This is about installing the PHP version (i.e. current version) of Tatoeba.

# Downloads

## Required tools

* Apache
* PHP
* MySQL
* SVN Client

For those who are on Windows:

* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL.
* [TortoiseSVN](http://tortoisesvn.net/downloads.html) for the SVN client

For those who are on Macintosh or Linux:

* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.

## Source code

The source code is hosted on a platform called Assembla:
[https://www.assembla.com/code/tatoeba2/subversion/nodes](https://www.assembla.com/code/tatoeba2/subversion/nodes)

Repository URL:
[https://subversion.assembla.com/svn/tatoeba2/](https://subversion.assembla.com/svn/tatoeba2/)

URL you'll want to checkout:
[https://subversion.assembla.com/svn/tatoeba2/trunk/](https://subversion.assembla.com/svn/tatoeba2/trunk/)


# Configuration

## Virtual host

You may set up a virtual host. I personally use http://tatoeba.dev/ as my local URL.

To find out how to set up a virtual host on a Macintosh using XAMPP see the following page.

[http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/]


**TODO** More details on how to do that.


## mod_rewrite

You need to have mod_rewrite enabled, it's necessary for CakePHP.

**TODO** More details on how to do that.


## app/config/core.php

In the file `app/config/core.php`, put into comments the part about XCache.

    /*
    Cache::config('default', array(
        'engine' => 'Xcache', //[required]
        'duration'=> 3600, //[optional]
        'probability'=> 100, //[optional]
        'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
        'user' => 'user', //user from xcache.admin.user settings
        'password' => 'password', //plaintext password (xcache.admin.pass)
    ));
    Cache::config('_cake_core_', array(
        'engine' => 'Xcache', //[required]
        'duration'=> 3600, //[optional]
        'probability'=> 100, //[optional]
        'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
        'user' => 'user', //user from xcache.admin.user settings
        'password' => 'password', //plaintext password (xcache.admin.pass)
    ));
    */

And uncomment the line to use the "File" cache engine:

`Cache::config('default', array('engine' => 'File'));`



## app/config/database.php

In the file `app/config/database.php`, set your login, password and database in the $default array.

    var $default = array(
        'driver' => 'mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => 'somepassword',
        'database' => 'tatoeba',
        'prefix' => '',
        'encoding' => 'utf8'
    );


## app/models/sentence.php

Tatoeba uses some other external tools that you won't necessarily need. These tools are:

* the search engine (Sphinx)
* the tools for romanization

If you're not going to work on the search or on the romanization and don't want to install these tools, you will have to uncomment a few things in the Sentence model (`app/models/sentence.php`).

line 274: uncomment "return array(1)"

    public function getSeveralRandomIds($lang = 'und',  $numberOfIdWanted = 10)
    {
        // Uncomment the line below if you don't have sphinx installed.
        return array(1);`

line 847: uncomment "return false"

    public function generateMetas(&$sentenceArray) 
    {
        // Uncomment the line below you don't have the Chinese
        // romanization tools installed.
        return false;`
	
## Make the following directory writable.

/app/tmp/cache/

## For XAMPP (at least on a Mac)

You'll need to up the default thread_stack from 64K to 256K.
(I tried 128K, but that wasn't enough.)

/Applications/XAMPP/xamppfiles/etc/my.cnf

thread_stack = 256K


# Database

Now you need to create the database, and import the necessary things. The scripts you will need are in the `docs/database` folder.

First, create the database. Make sure the name you use here is the name you've set in app/core/database.php. I'll name it `tatoeba`.

    CREATE DATABASE tatoeba
    USE tatoeba

Then execute the following scripts.

1. This will create all the tables (they will be empty).

        \. docs/database/database_20130406.sql

2. These will create a minimal user base (one user in each group), and the associated access rights for each user.

        \. docs/database/import/groups.sql
        \. docs/database/import/users.sql
        \. docs/database/import/acos.sql
        \. docs/database/import/aros.sql
        \. docs/database/import/aros_acos.sql

3. This will import the list of countries. It's used in profile.

        \. docs/database/import/countries.sql

4. After you start adding sentences, you will get some errors related to the fact that the table langStats is empty. This table contains lists the different languages in which the sentences are and the number of sentences for each language. So after adding your first sentences, and also everytime you will add sentences in a language that wasn't present before, you will need to execute the following script to update the langStats table:

        \. docs/database/scripts/create_fill_langStats.sql


You can fill your database with the [exported CSV files](http://tatoeba.org/files/downloads/). For example, adapt and use the following commands to add sentences:

    cat sentences.csv | while read -r id lang text; do echo "insert into sentences (id, lang, text) values ('$id', '$lang', '${text//\'/\'}');"; done | sudo mysql -u root tatoeba_database
    cat links.csv | while read -r id1 id2; do echo "insert into sentences_translations (sentence_id, translation_id) values ($id1, $id2);"; done | sudo mysql -u root tatoeba_database
Expect this to take some time (dozens of minutes) and fill some disk space (several gigabytes).

**TODO** Would probably be nice to have some data for sentences, comments, wall messages as well. Although they can be created manually once logged in.




# Logging in

Now you should be able to go to your local Tatoeba URL (http://tatoeba.dev/ in my case), and be able to log in.

The default usernames are: 

* admin
* corpus_maintainer
* advanced_contributor
* contributor
* inactive
* spammer

The default password for each user is '123456'.

version at: 29/04/2013, 00:51

# How to Install the CakePHP Version of the Tatoeba Web App

NOTE: This is about installing the PHP version (i.e. current version) of Tatoeba.

# Downloads

## Required tools

* Apache
* PHP
* MySQL
* SVN Client

For those who are on Windows:

* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL.
* [TortoiseSVN](http://tortoisesvn.net/downloads.html) for the SVN client

For those who are on Macintosh or Linux:

* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.

## Source code

The source code is hosted on a platform called Assembla:
[https://www.assembla.com/code/tatoeba2/subversion/nodes](https://www.assembla.com/code/tatoeba2/subversion/nodes)

Repository URL:
[https://subversion.assembla.com/svn/tatoeba2/](https://subversion.assembla.com/svn/tatoeba2/)

URL you'll want to checkout:
[https://subversion.assembla.com/svn/tatoeba2/trunk/](https://subversion.assembla.com/svn/tatoeba2/trunk/)


# Configuration

## Virtual host

You may set up a virtual host. I personally use http://tatoeba.dev/ as my local URL.

To find out how to set up a virtual host on a Macintosh using XAMPP see the following page.

[http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/]


**TODO** More details on how to do that.


## mod_rewrite

You need to have mod_rewrite enabled, it's necessary for CakePHP.

**TODO** More details on how to do that.


## app/config/core.php

In the file `app/config/core.php`, put into comments the part about XCache.

    /*
    Cache::config('default', array(
        'engine' => 'Xcache', //[required]
        'duration'=> 3600, //[optional]
        'probability'=> 100, //[optional]
        'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
        'user' => 'user', //user from xcache.admin.user settings
        'password' => 'password', //plaintext password (xcache.admin.pass)
    ));
    Cache::config('_cake_core_', array(
        'engine' => 'Xcache', //[required]
        'duration'=> 3600, //[optional]
        'probability'=> 100, //[optional]
        'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
        'user' => 'user', //user from xcache.admin.user settings
        'password' => 'password', //plaintext password (xcache.admin.pass)
    ));
    */

And uncomment the line to use the "File" cache engine:

`Cache::config('default', array('engine' => 'File'));`



## app/config/database.php

In the file `app/config/database.php`, set your login, password and database in the $default array.

    var $default = array(
        'driver' => 'mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'root',
        'password' => 'somepassword',
        'database' => 'tatoeba',
        'prefix' => '',
        'encoding' => 'utf8'
    );


## app/models/sentence.php

Tatoeba uses some other external tools that you won't necessarily need. These tools are:

* the search engine (Sphinx)
* the tools for romanization

If you're not going to work on the search or on the romanization and don't want to install these tools, you will have to uncomment a few things in the Sentence model (`app/models/sentence.php`).

line 274: uncomment "return array(1)"

    public function getSeveralRandomIds($lang = 'und',  $numberOfIdWanted = 10)
    {
        // Uncomment the line below if you don't have sphinx installed.
        return array(1);`

line 847: uncomment "return false"

    public function generateMetas(&$sentenceArray) 
    {
        // Uncomment the line below you don't have the Chinese
        // romanization tools installed.
        return false;`
	
## Make the following directory writable.

/app/tmp/cache/

## For XAMPP (at least on a Mac)

You'll need to up the default thread_stack from 64K to 256K.
(I tried 128K, but that wasn't enough.)

/Applications/XAMPP/xamppfiles/etc/my.cnf

thread_stack = 256K


# Database

Now you need to create the database, and import the necessary things. The scripts you will need are in the `docs/database` folder.

First, create the database. Make sure the name you use here is the name you've set in app/core/database.php. I'll name it `tatoeba`.

    CREATE DATABASE tatoeba
    USE tatoeba

Then execute the following scripts.

1. This will create all the tables (they will be empty).

        \. docs/database/database_20130406.sql

2. These will create a minimal user base (one user in each group), and the associated access rights for each user.

        \. docs/database/import/groups.sql
        \. docs/database/import/users.sql
        \. docs/database/import/acos.sql
        \. docs/database/import/aros.sql
        \. docs/database/import/aros_acos.sql

3. This will import the list of countries. It's used in profile.

        \. docs/database/import/countries.sql

4. After you start adding sentences, you will get some errors related to the fact that the table langStats is empty. This table contains lists the different languages in which the sentences are and the number of sentences for each language. So after adding your first sentences, and also everytime you will add sentences in a language that wasn't present before, you will need to execute the following script to update the langStats table:

        \. docs/database/scripts/create_fill_langStats.sql


You can fill your database with the [exported CSV files](http://tatoeba.org/files/downloads/). For example, adapt and use the following commands to add sentences:

    cat sentences.csv | while read -r id lang text; do echo "insert into sentences (id, lang, text) values ('$id', '$lang', '${text//\'/\'}');"; done | sudo mysql -u root tatoeba_database
    cat links.csv | while read -r id1 id2; do echo "insert into sentences_translations (sentence_id, translation_id) values ($id1, $id2);"; done | sudo mysql -u root tatoeba_database
Expect this to take some time (dozens of minutes) and fill some disk space (several gigabytes).

**TODO** Would probably be nice to have some data for sentences, comments, wall messages as well. Although they can be created manually once logged in.




# Logging in

Now you should be able to go to your local Tatoeba URL (http://tatoeba.dev/ in my case), and be able to log in.

The default usernames are: 

* admin
* corpus_maintainer
* advanced_contributor
* contributor
* inactive
* spammer

The default password for each user is '123456'.

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.