Project-Id-Version: Trac 0.12
Report-Msgid-Bugs-To: trac-dev@googlegroups.com
POT-Creation-Date: 2008-01-30 09:20+0100
PO-Revision-Date: 2010-07-19 23:05+0200
Last-Translator: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Language-Team: en_US <trac-dev@googlegroups.com>
Plural-Forms: nplurals=2; plural=(n != 1)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Generated-By: Babel 0.9.6

Warning: Can't synchronize with repository "(default)" (Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? ). Look in the Trac log for more information.

Changes between Initial Version and Version 1 of HowToUpdate


Ignore:
Timestamp:
11/10/12 08:42:59 (6 years ago)
Author:
sebastian
Comment:

Page rename from HowToMigratePhtagr

Legend:

Unmodified
Added
Removed
Modified
  • HowToUpdate

    v1 v1  
     1This page describes the update/migrate different phTagr versions. It is recommended to use GIT to stay up-to-date. 
     2[[PageOutline]] 
     3 
     4= General =  
     5 
     6This section describes the general steps to upgrade or migrate your phTagr gallery to a newer version. If no other revision is mentioned below you can follow these steps. 
     7  
     8== Update using GIT == 
     9 
     10Currently GIT is the best method to keep your phTagr up-to-date! See HowToInstallFromGit and HowToMigrateToGit for further information. 
     11 
     12The following instructions assume that you have installed phTagr via git and you are using at least version 2.2 of phtagr (later than 2012-06-29). 
     13 
     14Execute following commands in your phtagr directory 
     15 
     16{{{ 
     17$ git stash 
     18$ git pull --rebase 
     19$ git submodule update --init --recursive 
     20$ git stash pop 
     21}}} 
     22 
     23Alternatively, you can call it chained in a single line (update of modules should be rare). 
     24 
     25{{{ 
     26$ git stash && git pull --rebase && git stash pop 
     27}}} 
     28 
     29Git mentions if anything goes wrong. Mainly if your changes could not be merged to the current code base. 
     30 
     31Continue with the Database Migration 
     32 
     33== Update from ZIP File == 
     34 
     35It is assumed that your phTagr gallery files are located in {{{/var/www/phtagr}}}. The configuration file {{{phtagr/Config/core.php}}} and the user upload directory {{{phtagr/users}}} have to be migrated from the old to the new phtagr sources. 
     36 
     37 1. Rename your old phTagr 
     38 {{{ 
     39$ cd /var/www 
     40$ mv phtagr phtagr.old 
     41}}} 
     42 1. Fetch the [https://sourceforge.net/projects/phtagr/files/latest latest phTagr] sources from [https://sourceforge.net/projects/phtagr/ !SourceForge] and unzip it to {{{/var/www/}}} 
     43 {{{ 
     44$ wget https://sourceforge.net/projects/phtagr/files/latest 
     45$ unzip phtagr-<version>-<git hash>.zip 
     46}}} 
     47 1. Migrate required files and directories from the old to the new phTagr 
     48 {{{ 
     49$ cp phtagr.old/Config/core.php phtagr/Config/core.php 
     50$ cp phtagr.old/Config/database.php phtagr/Config/database.php 
     51$ mv phtagr.old/users/* phtagr/users 
     52}}} 
     53 1. Continue with the Database Migration 
     54 
     55== Database Migration == 
     56 
     57From time to time a database upgrade is required. phTagr comes with a automatic database migration which have to be triggered manually.  
     58 
     59Open URL phtagr/setup, goto ''Dashboard'' in the upper right corner, select the menu ''System'' and submenu ''Database upgrade'. All required migrations are listed. 
     60 
     61'''Note:''' The database update function should be tested well but it is always a good behaviour to create a backup of your files before your run an update (e.g. using `mysqldump`) 
     62 
     63Further, depending on your size of phtagr installation, a database migration might consume some time and memory. Some limit adoptions need to be done to `php.ini` if the upgrade does not work in the first run. You might increase the memory limit to 256M (memory_limit = 256M) in `/etc/php5/apache2/php.ini` to run all migration properly.  
     64 
     65For migration ''006-one-meta-data-table'' with more than 10000 photos and a lot of meta data it is recommended to increase the memory limit. For smaller databases the current memory limit should be fine. 
     66 
     67= phTagr 2.2b3 = 
     68 
     69'''phTagr 2.2b3 uses now CakePHP 2.1'''. CakePHP 2.1 is the current version of the great MVC framework and brings new fancy features towards phTagr. The downside: CakePHP 2.1 (and so phTagr) requires now at least PHP 5.2.8 and the PDO extension (PHP Data Objects). Further, the folder structure changed (again). Besides some internal changes the folder structure is now capitalized in singular. In CakePHP 1.3 folders are named {{{controllers/components}}} and in CakePHP 2.1 names are like {{{Controller/Component}}}. Further the database configuration changed slightly. If you're using git the migration is harmless. Sorry for this inconvenience but this should be the last major change for the next time.    
     70 
     71See http://book.cakephp.org/2.0/en/getting-started/cakephp-folder-structure.html for new CakePHP 2.1 folder structure. Note: phTagr uses cake as git submodule and is located in cakephp directory. 
     72 
     73'''Following migration instruction assumes that your are running at least 2.2b2. If not, please read prior migration guide.''' 
     74 
     75== Migration using git == 
     76 
     77{{{ 
     78cd /var/www/phtagr  # goto to your phtagr directory 
     79git stash  
     80git checkout cakephp-2.0  
     81git submodule sync 
     82git submodule init 
     83git submodule update 
     84git stash pop 
     85mv config/database.php Config 
     86rm -r config        # config directory should be empty 
     87find tmp/cache -type f | grep -v empty | xargs rm   # Remove cache files in tmp dir 
     88}}} 
     89 
     90Continue with the database configuration migration 
     91 
     92== Migration from ZIP archive == 
     93 
     94 1. Fetch the [https://sourceforge.net/projects/phtagr/files/latest latest phTagr] sources from [https://sourceforge.net/projects/phtagr/ !SourceForge] and unzip it to {{{/var/www/}}} 
     95 {{{ 
     96$ wget https://sourceforge.net/projects/phtagr/files/latest 
     97$ unzip phtagr-master-XXX.zip 
     98}}} 
     99 {{{ 
     100$ cd /var/www 
     101$ sudo mv phtagr phtagr.old 
     102$ sudo mv ~/phtagr . 
     103}}} 
     104 1. Make {{{phtagr/users}}} and {{{phtagr/tmp}}} writable by webserver if required 
     105 {{{ 
     106sudo chmod -R go+w phtagr/users phtagr/tmp 
     107}}} 
     108 1. Migrate required files and directories from the old to the new phTagr 
     109 {{{ 
     110$ mv phtagr.old/Config/core.php phtagr/Config/core.php 
     111$ mv phtagr.old/Config/database.php phtagr/Config/database.php 
     112$ mv phtagr.old/users/* phtagr/users 
     113$ mv phtagr.old/tmp/logs/* phtagr/tmp/logs 
     114}}} 
     115 
     116Continue with the database migration at ''Dashboard'' -> ''System'' -> ''Database Upgrade'' 
     117 
     118== Migration of the database configuration ==  
     119 
     120If you migrate prior 2.2b3 you need to adapt the database configuration in {{{Config/database.php}}}. The old database configuration looks like: 
     121 
     122{{{ 
     123<?php 
     124/**  
     125 * Automatic generated database configuration file by phTagr 
     126 * 
     127 * Date: 2011-01-09 21:09:50 
     128 */ 
     129class DATABASE_CONFIG 
     130{ 
     131  var $default = array('driver' => 'mysql', 
     132                'connect' => 'mysql_connect', 
     133                'persistent' => true, 
     134                'host' => 'localhost', 
     135                'login' => 'phtagr', 
     136                'password' => 'phtagr', 
     137                'database' => 'phtagr', 
     138                'encoding' => 'utf8', 
     139                'prefix' => 'pt2_'); 
     140} 
     141?> 
     142}}} 
     143 
     144The new database configuration replaces the {{{driver}}} and {{{connect}}} settings to a single {{{datasource}}} setting and adds a test configuration: 
     145 
     146{{{ 
     147<?php 
     148/**  
     149 * Automatic generated database configuration file by phTagr 
     150 * 
     151 * Date: 2011-01-09 21:09:50 
     152 */ 
     153class DATABASE_CONFIG 
     154{ 
     155  var $default = array( 
     156                'datasource' => 'Database/Mysql', 
     157                'persistent' => true, 
     158                'host' => 'localhost', 
     159                'login' => 'phtagr', 
     160                'password' => 'phtagr', 
     161                'database' => 'phtagr', 
     162                'encoding' => 'utf8', 
     163                'prefix' => 'pt2_'); 
     164 
     165  var $test = array( 
     166                'datasource' => 'Database/Mysql', 
     167                'persistent' => true, 
     168                'host' => 'localhost', 
     169                'login' => 'phtagr', 
     170                'password' => 'phtagr', 
     171                'database' => 'phtagr', 
     172                'encoding' => 'utf8', 
     173                'prefix' => 'pt2_test_'); 
     174 
     175} 
     176}}} 
     177 
     178Please adapt your database configuration properly.  
     179 
     180Now we need to remove old (600px small) preview files and rebuild new 900 pixel sized  
     181{{{ 
     182$ rm users/*/cache/*/preview-* 
     183$ cakephp/lib/Cake/Console/cake preview generate --size preview -v 
     184}}} 
     185 
     186Than phtagr should run find again! 
     187 
     188= phTagr prior 2.2 = 
     189 
     190'''In phTagr 2.2 the folder structure changed'''. phTagr is no longer a subfolder of the PHP framework CakePHP. Since phTagr 2.2 CakePHP is a subfolder of phTagr. The change has the advantage that CakePHP can be used as GIT submodule and simplifies the folders which where confusing in the past. Now there is only {{{/var/www/phtagr}}} as root directory. 
     191 
     192Due this change the phTagrs folder {{{/var/www/cake/phtagr}}} becomes {{{/var/www/phtagr}}} ({{{/var/www/phtagr/phtagr}}} becomes {{{/var/www/phtagr}}} or {{{~/public_html/phtagr/app}}} becomes {{{~/public_html/phtagr}}}). Or in more abstract words phtagr root directory __was__ CakePHP's root directory and both switches their roles. 
     193 
     194The new folder structure is  
     195 
     196{{{ 
     197/phtagr        <-- phTagr root directory 
     198    /cakephp   <-- CakePHP framework 
     199    /Config    <-- Configuration directory for phTagr 
     200    /users     <-- Users directory for uploaded files 
     201    /tmp       <-- Temporary directory for cached files 
     202    /webroot   <-- Webroot  
     203    ... 
     204}}} 
     205 
     206'''Following migration instructions require a phtagr installation with version 2.1.3 or later (2011-03-07 or later).''' Please upgrade your installation to 2.1.3 and than to 2.2. These steps are required for correct database migration. 
     207 
     208'''Note''' Before you migrate, please ensure that you have done your backups, especially your database if the database might migration fail. 
     209 
     210== phTagr in /var/www from zip archive == 
     211 
     212In following example it is assumed that your are installed phtagr from a ZIP archive and phtagr was installed at {{{/var/www}}}. 
     213 
     214{{{ 
     215# download and extract phtagr 2.2 in your home directory 
     216cd  
     217wget http://sourceforge.net/projects/phtagr/files/latest # phtagr-master-XXX.zip 
     218unzip phtagr-<version>-<git hash>.zip 
     219cd /var/www 
     220sudo mv phtagr phtagr.old 
     221sudo mv ~/phtagr . 
     222cp phtagr.old/app/config/core.php phtagr/Config/core.php.old 
     223cp phtagr.old/app/config/database.php phtagr/Config/database.php.old 
     224rm -rf phtagr/users 
     225mv phtagr.old/app/users phtagr 
     226mv phtagr.old/app/tmp/logs/* phtagr/tmp/logs 
     227}}} 
     228 
     229Make shure that {{{phtagr/tmp}}} and {{{phtagr/users}}} is writeable by the webserver. If not execute: 
     230 
     231{{{ 
     232chmod -R go+w phtagr/users phtagr/tmp 
     233}}} 
     234 
     235'''Please adapt the database configuration as described in section ''phTagr 2.2b3''.''' 
     236 
     237Now the user files have a new location. Before they where in {{{/var/www/phtagr/app/users}}} now they are in {{{/var/www/phtagr/users}}}. These change must be updated in the database as well. The following example assumes that phTagr uses no table prefixes. Otherwise check command {{{mysql> show tables;}}} 
     238 
     239{{{ 
     240mysql -u phtagr -p phtagr 
     241mysql> update files set path=REPLACE(path, '/var/www/phtagr/app/users', '/var/www/phtagr/users'); 
     242mysql> quit; 
     243}}} 
     244 
     245Since phtagr 2.2 updated the CakePHP as well we need to migrate the core configuration file manually. Before we copied a backup to {{{Config/core.php.old}}} to the new phtagr directory. At least the {{{Security.salt}}} value is required for correct password encryption. Please copy the value of {{{Security.salt}}} within {{{Config/core.php.old}}} to {{{Config/core.php}}}. If you modified your old core configuration file, please apply your changes to the new core configuration as well.  
     246 
     247Now everything should be working again. To finalize the upgrade login as admin user and goto ''Dashboard'' -> ''System'' -> ''Database upgrade'' and init the new database migration utility. 
     248 
     249If you have troubles accessing phtagr check your web server configuration if the document root points to the correct directory. If the document root points to {{{/var/www/phtagr/app/webroot}}} it should not point to {{{/var/www/phtagr/webroot}}}. 
     250 
     251In your apache config before: 
     252{{{ 
     253    DocumentRoot /var/www/cake/phtagr/webroot 
     254    <Directory /var/www/cake/phtagr/webroot> 
     255        // ... 
     256    </Directory> 
     257}}} 
     258 
     259In your apache config after: 
     260{{{ 
     261    DocumentRoot /var/www/phtagr/webroot 
     262    <Directory /var/www/phtagr/webroot> 
     263        // ... 
     264    </Directory> 
     265}}} 
     266 
     267 
     268== phTagr in /var/www from git == 
     269 
     270In following example assumes that phtagr is installed at {{{/var/www}}} via git. 
     271 
     272{{{ 
     273cd /var/www/cake/phtagr 
     274git stash 
     275git pull 
     276git submodule init 
     277git submodule update 
     278git stash pop 
     279cd /var/www 
     280sudo mv cake/phtagr phtagr 
     281}}} 
     282 
     283The user files need to be migrated in the database. Before they where located in {{{/var/www/cake/phtagr}}} now they are in {{{/var/www/phtagr/users}}}. Following example assumes that the table prefix (written in {{{Config/database.php}}}) is set to {{{pt_}}}. 
     284 
     285{{{ 
     286mysql -u phtagr -p phtagr 
     287mysql> update pt_files set pt_path=REPLACE(path, '/var/www/cake/phtagr/users', '/var/www/phtagr/users'); 
     288mysql> quit; 
     289}}} 
     290 
     291Done. If it is not working check your web server configuration if the document root points to the correct directory. If the document root points to {{{/var/www/cake/phtagr/webroot}}} it should not point to {{{/var/www/phtagr/webroot}}}. 
     292 
     293To finalize the upgrade login as admin user and goto ''Dashboard'' -> ''System'' -> ''Database upgrade'' and init the new database migration utility. 
     294 
     295If everything works as expected you can delete the old directory {{{/var/www/cake}}}. 
     296 
     297== phTagr in user directory == 
     298 
     299The migration works similar to the above examples. Maybe you need to adapt the {{{RewriteBase}}} in {{{.htaccess}}} files respectively. Also migrate the database entries for the files. 
     300 
     301= phTagr 2.1.1 To phTagr 2.1.2 (>r581) = 
     302 
     303phTagr 2.1.2 (r581) switched the CakePHP framework from CakePHP 1.2 to CakePHP 1.3. Please fetch a new CakePHP from [http://github.com/cakephp/cakephp/downloads CakePHP's git hub] and replace the current {{{./cake}}} directory with new {{{./cake}}} directory provided by the archive of CakePHP.