Version at: 03/05/2013, 14:58 vs. version at: 20/05/2013, 03:56
11# How to Install the CakePHP Version of the Tatoeba Web App
22
33NOTE: This is about installing the PHP version (i.e. current version) of Tatoeba.
44
55# Downloads
66
77## Required tools
88
99* Apache
10* PHP
10* PHP 5.3
1111* MySQL
1212* SVN Client
1313
1414For those who are on Windows:
1515
16* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL.
16* [XAMPP](http://www.apachefriends.org/en/xampp-windows.html) will do the trick for Apache/PHP/MySQL. But you will need to use version 1.7.7 of XAMPP rather than the latest version, because Tatoeba currently uses PHP 5.3.
1717* [TortoiseSVN](http://tortoisesvn.net/downloads.html) for the SVN client
1818
1919For those who are on Macintosh or Linux:
2020
2121* [XAMPP](http://www.apachefriends.org/en/xampp.html) works, too.
2222
2323## Source code
2424
2525The source code is hosted on a platform called Assembla:
2626[https://www.assembla.com/code/tatoeba2/subversion/nodes](https://www.assembla.com/code/tatoeba2/subversion/nodes)
2727
2828Repository URL:
2929[https://subversion.assembla.com/svn/tatoeba2/](https://subversion.assembla.com/svn/tatoeba2/)
3030
3131URL you'll want to checkout:
3232[https://subversion.assembla.com/svn/tatoeba2/trunk/](https://subversion.assembla.com/svn/tatoeba2/trunk/)
3333
3434
3535# Configuration
3636
3737## Virtual host
3838
3939You may set up a virtual host. I personally use http://tatoeba.dev/ as my local URL.
4040
4141To find out how to set up a virtual host on a Macintosh using XAMPP see the following page.
4242[http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)
4343
4444On Windows 7 using XAMPP:
4545[http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)
4646
4747
4848**TODO** More details on how to do that.
4949
5050
5151## mod_rewrite
5252
5353You need to have mod_rewrite enabled, it's necessary for CakePHP.
5454
5555**TODO** More details on how to do that.
5656
5757
5858## app/config/core.php
5959
6060In the file `app/config/core.php`, put into comments the part about XCache.
6161
6262 /*
6363 Cache::config('default', array(
6464 'engine' => 'Xcache', //[required]
6565 'duration'=> 3600, //[optional]
6666 'probability'=> 100, //[optional]
6767 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
6868 'user' => 'user', //user from xcache.admin.user settings
6969 'password' => 'password', //plaintext password (xcache.admin.pass)
7070 ));
7171 Cache::config('_cake_core_', array(
7272 'engine' => 'Xcache', //[required]
7373 'duration'=> 3600, //[optional]
7474 'probability'=> 100, //[optional]
7575 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
7676 'user' => 'user', //user from xcache.admin.user settings
7777 'password' => 'password', //plaintext password (xcache.admin.pass)
7878 ));
7979 */
8080
8181And uncomment the line to use the "File" cache engine:
8282
8383`Cache::config('default', array('engine' => 'File'));`
8484
8585
8686
8787## app/config/database.php
8888
8989In the file `app/config/database.php`, set your login, password and database in the $default array.
9090
9191 var $default = array(
9292 'driver' => 'mysql',
9393 'persistent' => false,
9494 'host' => 'localhost',
9595 'login' => 'root',
9696 'password' => 'somepassword',
9797 'database' => 'tatoeba',
9898 'prefix' => '',
9999 'encoding' => 'utf8'
100100 );
101101
102102
103103## app/models/sentence.php
104104
105105Tatoeba uses some other external tools that you won't necessarily need. These tools are:
106106
107107* the search engine (Sphinx)
108108* the tools for romanization
109109
110110If 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`).
111111
112112line 274: uncomment "return array(1)"
113113
114114 public function getSeveralRandomIds($lang = 'und', $numberOfIdWanted = 10)
115115 {
116116 // Uncomment the line below if you don't have sphinx installed.
117117 return array(1);
118118
119119line 768: uncomment "return false"
120120
121121 public function getRomanization($text,$lang)
122122 {
123123 // Uncomment the line below you don't have the
124124 // romanization tools installed.
125125 return false;
126126
127127line 851: uncomment "return false"
128128
129129 public function generateMetas(&$sentenceArray)
130130 {
131131 // Uncomment the line below you don't have the Chinese
132132 // romanization tools installed.
133133 return false;`
134134    
135135## Make the following directory writable.
136136
137137/app/tmp/cache/
138138
139139## For XAMPP (at least on a Mac)
140140
141141You'll need to up the default thread_stack from 64K to 256K.
142142(I tried 128K, but that wasn't enough.)
143143
144144/Applications/XAMPP/xamppfiles/etc/my.cnf
145145
146146thread_stack = 256K
147147
148148
149149# Database
150150
151151Now you need to create the database, and import the necessary things. The scripts you will need are in the `docs/database` folder.
152152
153153First, 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`.
154154
155155 CREATE DATABASE tatoeba
156156 USE tatoeba
157157
158158Then execute the following scripts.
159159
1601601. This will create all the tables (they will be empty).
161161
162162 \. docs/database/database_20130406.sql
163163
1641642. These will create a minimal user base (one user in each group), and the associated access rights for each user.
165165
166166 \. docs/database/import/groups.sql
167167 \. docs/database/import/users.sql
168168 \. docs/database/import/acos.sql
169169 \. docs/database/import/aros.sql
170170 \. docs/database/import/aros_acos.sql
171171
1721723. This will import the list of countries. It's used in profile.
173173
174174 \. docs/database/import/countries.sql
175175
1761764. 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:
177177
178178 \. docs/database/scripts/create_fill_langStats.sql
179179
180180
181181You 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:
182182
183183 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
184184 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
185185Expect this to take some time (dozens of minutes) and fill some disk space (several gigabytes).
186186
187187**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.
188188
189189
190190
191191
192192# Logging in
193193
194194Now you should be able to go to your local Tatoeba URL (http://tatoeba.dev/ in my case), and be able to log in.
195195
196196The default usernames are:
197197
198198* admin
199199* corpus_maintainer
200200* advanced_contributor
201201* contributor
202202* inactive
203203* spammer
204204
205205The default password for each user is '123456'.
diff view generated by jsdifflib

Version at: 03/05/2013, 14:58

# 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/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)

On Windows 7 using XAMPP:
[http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)


**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 768: uncomment "return false"

    public function getRomanization($text,$lang)
    {
        // Uncomment the line below you don't have the
        // romanization tools installed.
        return false;

line 851: 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: 20/05/2013, 03:56

# 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 5.3
* 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. But you will need to use version 1.7.7 of XAMPP rather than the latest version, because Tatoeba currently uses PHP 5.3.
* [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/](http://f6design.com/journal/2012/03/11/configuring-virtualhosts-in-xampp-on-mac/)

On Windows 7 using XAMPP:
[http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/](http://austinpassy.com/tutorials/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/)


**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 768: uncomment "return false"

    public function getRomanization($text,$lang)
    {
        // Uncomment the line below you don't have the
        // romanization tools installed.
        return false;

line 851: 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.