Updating

There is no update command. An update is a git pull and a few steps by hand. The commands below run from the site's folder — the one with web/ and private/ — as the site's user.

Before you start

Back up what lives only on this site:

  • the database;
  • the configuration, private/energine/configs/system.config.<host>.php;
  • web/uploads/;
  • your changes in private/energine/site/ — they are part of the repository, so commit them or copy them;
  • private/energine/tests/local.php, if you use the repository's tests.

The links in web/, vendor/ and the resizer's cache can be made again and need no backup.

Do not run git clean -fdx or git stash --all in the repository: git ignores the configuration and tests/local.php, and these commands delete or hide them.

1. The code

git -C private/energine pull

The files in web/images, web/scripts, web/stylesheets and web/templates are links into the repository, so they show the new versions at once.

2. The entry files and the links

cp private/energine/htdocs/index.php private/energine/htdocs/bootstrap.php private/energine/htdocs/auth.php web/
cp private/energine/htdocs/resizer/timthumb.php web/resizer/
rm -f web/resizer/timthumb-config.php
cd web && php index.php setup linker && cd ..

This is needed when the update changed the files in htdocs/ or added, removed or renamed static files; it is safe to do every time. timthumb-config.php belongs to the old resizer: the new one keeps the name timthumb.php for the nginx rule and does not read it. The copied files must belong to the site's user. A new script gets into the pages' import map only after setup linker.

If the update removed a module from the core, delete its line from modules in the configuration first: with a module that is missing setup linker stops, names it and leaves the static files as they were.

3. The database

Changes to the database come as scripts in private/energine/sql/cut/, one per stage. Nothing records which of them a database has had, and running a script again changes nothing. So after an update, run every script from stage10.sql on, in order:

mariadb -u site -p site < private/energine/sql/cut/stage10.sql

— then stage11.sql, stage12.sql and so on to the last one, with your database's user and name. Skip stage11-demo.sql: it is for the demo content. stage1.sql–stage7.sql move a database of the full Energine, as it was when Simple split off, to Simple; a Simple site never needs them.

4. Interface strings

New strings of the core come with the scripts above. New strings of the site's module are in site/modules/main/translations.php; load them:

cd web && php index.php setup translations && cd ..

setup translations adds only what is missing and keeps every translation edited in the admin.

5. The configuration

No command changes the site's configuration. When the template configs/system.config.default.php gets a new key — the mail.smtp block, say — copy it into your configuration by hand. To see what changed in the template:

git -C private/energine diff ORIG_HEAD HEAD -- configs/system.config.default.php

Keys that left the template are ignored, so an older configuration keeps working.

6. Check

cd web && php index.php setup check