]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - doc/md/Upgrade-and-migration.md
Generate HTML documentation using MkDocs (WIP)
[github/shaarli/Shaarli.git] / doc / md / Upgrade-and-migration.md
CommitLineData
fdf88d19 1## Preparation
53ed6d7d 2
b230bf20
A
3### Note your current version
4
5If anything goes wrong, it's important for us to know which version you're upgrading from.
6The current version is present in the `version.php` file.
7
fdf88d19
A
8### Backup your data
9
10Shaarli stores all user data under the `data` directory:
11- `data/config.php` - main configuration file
12- `data/datastore.php` - bookmarked links
13- `data/ipbans.php` - banned IP addresses
b230bf20 14- `data/updates.txt` - contains all automatic update to the configuration and datastore files already run
fdf88d19 15
53ed6d7d 16See [[Shaarli configuration]] for more information about Shaarli resources.
fdf88d19
A
17
18It is recommended to backup this repository _before_ starting updating/upgrading Shaarli:
19- users with SSH access: copy or archive the directory to a temporary location
20- users with FTP access: download a local copy of your Shaarli installation using your favourite client
21
22### Migrating data from a previous installation
53ed6d7d 23
fdf88d19
A
24As all user data is kept under `data`, this is the only directory you need to worry about when migrating to a new installation, which corresponds to the following steps:
25
26- backup the `data` directory
27- install or update Shaarli:
53ed6d7d 28 - fresh installation - see [[Download and installation]]
fdf88d19
A
29 - update - see the following sections
30- check or restore the `data` directory
31
b230bf20 32## Recommended : Upgrading from release archives
fdf88d19 33
53ed6d7d 34All tagged revisions can be downloaded as tarballs or ZIP archives from the [releases](https://github.com/shaarli/Shaarli/releases) page.
35
36We recommend that you use the latest release tarball with the `-full` suffix. It contains the dependencies, please read [[Download and installation]] for `git` complete instructions.
fdf88d19 37
b230bf20 38Once downloaded, extract the archive locally and update your remote installation (e.g. via FTP) -be sure you keep the content of the `data` directory!
fdf88d19 39
53ed6d7d 40After upgrading, access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [[Shaarli configuration]] for more details).
fdf88d19
A
41
42## Upgrading with Git
53ed6d7d 43
fdf88d19 44### Updating a community Shaarli
53ed6d7d 45
46If you have installed Shaarli from the [community Git repository](Download#clone-with-git-recommended), simply [pull new changes](https://www.git-scm.com/docs/git-pull) from your local clone:
fdf88d19
A
47
48```bash
49$ cd /path/to/shaarli
50$ git pull
51
52From github.com:shaarli/Shaarli
53 * branch master -> FETCH_HEAD
54Updating ebd67c6..521f0e6
55Fast-forward
56 application/Url.php | 1 +
57 shaarli_version.php | 2 +-
58 tests/Url/UrlTest.php | 1 +
59 3 files changed, 3 insertions(+), 1 deletion(-)
60```
61
53ed6d7d 62Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/):
fdf88d19
A
63
64```bash
b230bf20 65$ composer install --no-dev
fdf88d19
A
66
67Loading composer repositories with package information
68Updating dependencies
69 - Installing shaarli/netscape-bookmark-parser (v1.0.1)
70 Downloading: 100%
71```
72
73### Migrating and upgrading from Sebsauvage's repository
53ed6d7d 74
75If you have installed Shaarli from [Sebsauvage's original Git repository](https://github.com/sebsauvage/Shaarli), you can use [Git remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) to update your working copy.
fdf88d19
A
76
77The following guide assumes that:
53ed6d7d 78- you have a basic knowledge of Git [branching](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) and [remote repositories](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)
fdf88d19
A
79- the default remote is named `origin` and points to Sebsauvage's repository
80- the current branch is `master`
53ed6d7d 81 - if you have personal branches containing customizations, you will need to [rebase them](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) after the upgrade; beware though, a lot of changes have been made since the community fork has been created, so things are very likely to break!
fdf88d19
A
82- the working copy is clean:
83 - no versioned file has been locally modified
84 - no untracked files are present
85
86#### Step 0: show repository information
53ed6d7d 87
fdf88d19
A
88```bash
89$ cd /path/to/shaarli
90
91$ git remote -v
92origin https://github.com/sebsauvage/Shaarli (fetch)
93origin https://github.com/sebsauvage/Shaarli (push)
94
95$ git branch -vv
53ed6d7d 96* master 029f75f [origin/master] Update README.md
fdf88d19
A
97
98$ git status
99On branch master
100Your branch is up-to-date with 'origin/master'.
101nothing to commit, working directory clean
102```
103
104#### Step 1: update Git remotes
53ed6d7d 105
fdf88d19
A
106```
107$ git remote rename origin sebsauvage
108$ git remote -v
109sebsauvage https://github.com/sebsauvage/Shaarli (fetch)
110sebsauvage https://github.com/sebsauvage/Shaarli (push)
111
112$ git remote add origin https://github.com/shaarli/Shaarli
113$ git fetch origin
114
115remote: Counting objects: 3015, done.
116remote: Compressing objects: 100% (19/19), done.
117remote: Total 3015 (delta 446), reused 457 (delta 446), pack-reused 2550
118Receiving objects: 100% (3015/3015), 2.59 MiB | 918.00 KiB/s, done.
119Resolving deltas: 100% (1899/1899), completed with 48 local objects.
120From https://github.com/shaarli/Shaarli
53ed6d7d 121 * [new branch] master -> origin/master
122 * [new branch] stable -> origin/stable
123[...]
124 * [new tag] v0.6.4 -> v0.6.4
125 * [new tag] v0.7.0 -> v0.7.0
fdf88d19
A
126```
127
128#### Step 2: use the stable community branch
129
130```bash
131$ git checkout origin/stable -b stable
132Branch stable set up to track remote branch stable from origin.
133Switched to a new branch 'stable'
134
135$ git branch -vv
53ed6d7d 136 master 029f75f [sebsauvage/master] Update README.md
137* stable 890afc3 [origin/stable] Merge pull request #509 from ArthurHoaro/v0.6.5
fdf88d19
A
138```
139
53ed6d7d 140Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/):
fdf88d19
A
141
142```bash
b230bf20 143$ composer install --no-dev
fdf88d19
A
144
145Loading composer repositories with package information
146Updating dependencies
147 - Installing shaarli/netscape-bookmark-parser (v1.0.1)
148 Downloading: 100%
149```
150
151Optionally, you can delete information related to the legacy version:
152
153```bash
154$ git branch -D master
155Deleted branch master (was 029f75f).
156
157$ git remote remove sebsauvage
158
159$ git remote -v
160origin https://github.com/shaarli/Shaarli (fetch)
161origin https://github.com/shaarli/Shaarli (push)
162
163$ git gc
164Counting objects: 3317, done.
165Delta compression using up to 8 threads.
166Compressing objects: 100% (1237/1237), done.
167Writing objects: 100% (3317/3317), done.
168Total 3317 (delta 2050), reused 3301 (delta 2034)to
169```
170
171#### Step 3: configuration
53ed6d7d 172
173After migrating, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to `data/config.php` (see [[Shaarli configuration]] for more details).
b230bf20
A
174
175## Troubleshooting
176
177If the solutions provided here doesn't work, please open an issue specifying which version you're upgrading from and to.
178
179### You must specify an integer as a key
180
181In `v0.8.1` we changed how link keys are handled (from timestamps to incremental integers).
182Take a look at `data/updates.txt` content.
183
184#### `updates.txt` contains `updateMethodDatastoreIds`
185
186Try to delete it and refresh your page while being logged in.
187
188#### `updates.txt` doesn't exists or doesn't contain `updateMethodDatastoreIds`
189
190 1. Create `data/updates.txt` if it doesn't exist.
191 2. Paste this string in the update file `;updateMethodRenameDashTags;`
192 3. Login to Shaarli.
193 4. Delete the update file.
194 5. Refresh.