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