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.
Last modified 5 years ago Last modified on 11/10/12 08:42:59

This page describes the update/migrate different phTagr versions. It is recommended to use GIT to stay up-to-date.

General

This 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.

Update using GIT

Currently GIT is the best method to keep your phTagr up-to-date! See HowToInstallFromGit and HowToMigrateToGit for further information.

The 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).

Execute following commands in your phtagr directory

$ git stash
$ git pull --rebase
$ git submodule update --init --recursive
$ git stash pop

Alternatively, you can call it chained in a single line (update of modules should be rare).

$ git stash && git pull --rebase && git stash pop

Git mentions if anything goes wrong. Mainly if your changes could not be merged to the current code base.

Continue with the Database Migration

Update from ZIP File

It 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.

  1. Rename your old phTagr
    $ cd /var/www
    $ mv phtagr phtagr.old
    
  2. Fetch the latest phTagr sources from !SourceForge and unzip it to /var/www/
    $ wget https://sourceforge.net/projects/phtagr/files/latest
    $ unzip phtagr-<version>-<git hash>.zip
    
  3. Migrate required files and directories from the old to the new phTagr
    $ cp phtagr.old/Config/core.php phtagr/Config/core.php
    $ cp phtagr.old/Config/database.php phtagr/Config/database.php
    $ mv phtagr.old/users/* phtagr/users
    
  4. Continue with the Database Migration

Database Migration

From time to time a database upgrade is required. phTagr comes with a automatic database migration which have to be triggered manually.

Open URL phtagr/setup, goto Dashboard in the upper right corner, select the menu System and submenu Database upgrade'. All required migrations are listed.

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)

Further, 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.

For 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.

phTagr 2.2b3

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.

See 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.

Following migration instruction assumes that your are running at least 2.2b2. If not, please read prior migration guide.

Migration using git

cd /var/www/phtagr  # goto to your phtagr directory
git stash 
git checkout cakephp-2.0 
git submodule sync
git submodule init
git submodule update
git stash pop
mv config/database.php Config
rm -r config        # config directory should be empty
find tmp/cache -type f | grep -v empty | xargs rm   # Remove cache files in tmp dir

Continue with the database configuration migration

Migration from ZIP archive

  1. Fetch the latest phTagr sources from !SourceForge and unzip it to /var/www/
    $ wget https://sourceforge.net/projects/phtagr/files/latest
    $ unzip phtagr-master-XXX.zip
    
    $ cd /var/www
    $ sudo mv phtagr phtagr.old
    $ sudo mv ~/phtagr .
    
  2. Make phtagr/users and phtagr/tmp writable by webserver if required
    sudo chmod -R go+w phtagr/users phtagr/tmp
    
  3. Migrate required files and directories from the old to the new phTagr
    $ mv phtagr.old/Config/core.php phtagr/Config/core.php
    $ mv phtagr.old/Config/database.php phtagr/Config/database.php
    $ mv phtagr.old/users/* phtagr/users
    $ mv phtagr.old/tmp/logs/* phtagr/tmp/logs
    

Continue with the database migration at Dashboard -> System -> Database Upgrade

Migration of the database configuration

If you migrate prior 2.2b3 you need to adapt the database configuration in Config/database.php. The old database configuration looks like:

<?php
/** 
 * Automatic generated database configuration file by phTagr
 *
 * Date: 2011-01-09 21:09:50
 */
class DATABASE_CONFIG
{
  var $default = array('driver' => 'mysql',
                'connect' => 'mysql_connect',
                'persistent' => true,
                'host' => 'localhost',
                'login' => 'phtagr',
                'password' => 'phtagr',
                'database' => 'phtagr',
                'encoding' => 'utf8',
                'prefix' => 'pt2_');
}
?>

The new database configuration replaces the driver and connect settings to a single datasource setting and adds a test configuration:

<?php
/** 
 * Automatic generated database configuration file by phTagr
 *
 * Date: 2011-01-09 21:09:50
 */
class DATABASE_CONFIG
{
  var $default = array(
                'datasource' => 'Database/Mysql',
                'persistent' => true,
                'host' => 'localhost',
                'login' => 'phtagr',
                'password' => 'phtagr',
                'database' => 'phtagr',
                'encoding' => 'utf8',
                'prefix' => 'pt2_');

  var $test = array(
                'datasource' => 'Database/Mysql',
                'persistent' => true,
                'host' => 'localhost',
                'login' => 'phtagr',
                'password' => 'phtagr',
                'database' => 'phtagr',
                'encoding' => 'utf8',
                'prefix' => 'pt2_test_');

}

Please adapt your database configuration properly.

Now we need to remove old (600px small) preview files and rebuild new 900 pixel sized

$ rm users/*/cache/*/preview-*
$ cakephp/lib/Cake/Console/cake preview generate --size preview -v

Than phtagr should run find again!

phTagr prior 2.2

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.

Due 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.

The new folder structure is

/phtagr        <-- phTagr root directory
    /cakephp   <-- CakePHP framework
    /Config    <-- Configuration directory for phTagr
    /users     <-- Users directory for uploaded files
    /tmp       <-- Temporary directory for cached files
    /webroot   <-- Webroot 
    ...

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.

Note Before you migrate, please ensure that you have done your backups, especially your database if the database might migration fail.

phTagr in /var/www from zip archive

In following example it is assumed that your are installed phtagr from a ZIP archive and phtagr was installed at /var/www.

# download and extract phtagr 2.2 in your home directory
cd 
wget http://sourceforge.net/projects/phtagr/files/latest # phtagr-master-XXX.zip
unzip phtagr-<version>-<git hash>.zip
cd /var/www
sudo mv phtagr phtagr.old
sudo mv ~/phtagr .
cp phtagr.old/app/config/core.php phtagr/Config/core.php.old
cp phtagr.old/app/config/database.php phtagr/Config/database.php.old
rm -rf phtagr/users
mv phtagr.old/app/users phtagr
mv phtagr.old/app/tmp/logs/* phtagr/tmp/logs

Make shure that phtagr/tmp and phtagr/users is writeable by the webserver. If not execute:

chmod -R go+w phtagr/users phtagr/tmp

Please adapt the database configuration as described in section phTagr 2.2b3.

Now 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;

mysql -u phtagr -p phtagr
mysql> update files set path=REPLACE(path, '/var/www/phtagr/app/users', '/var/www/phtagr/users');
mysql> quit;

Since 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.

Now 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.

If 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.

In your apache config before:

    DocumentRoot /var/www/cake/phtagr/webroot
    <Directory /var/www/cake/phtagr/webroot>
        // ...
    </Directory>

In your apache config after:

    DocumentRoot /var/www/phtagr/webroot
    <Directory /var/www/phtagr/webroot>
        // ...
    </Directory>

phTagr in /var/www from git

In following example assumes that phtagr is installed at /var/www via git.

cd /var/www/cake/phtagr
git stash
git pull
git submodule init
git submodule update
git stash pop
cd /var/www
sudo mv cake/phtagr phtagr

The 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_.

mysql -u phtagr -p phtagr
mysql> update pt_files set pt_path=REPLACE(path, '/var/www/cake/phtagr/users', '/var/www/phtagr/users');
mysql> quit;

Done. 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.

To finalize the upgrade login as admin user and goto Dashboard -> System -> Database upgrade and init the new database migration utility.

If everything works as expected you can delete the old directory /var/www/cake.

phTagr in user directory

The 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.

phTagr 2.1.1 To phTagr 2.1.2 (>r581)

phTagr 2.1.2 (r581) switched the CakePHP framework from CakePHP 1.2 to CakePHP 1.3. Please fetch a new CakePHP from CakePHP's git hub and replace the current ./cake directory with new ./cake directory provided by the archive of CakePHP.