]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - doc/md/Upgrade-and-migration.md
Merge pull request #887 from ArthurHoaro/hotfix/dash-tag-rename
[github/shaarli/Shaarli.git] / doc / md / Upgrade-and-migration.md
1 ## Preparation
2
3 ### Note your current version
4
5 If anything goes wrong, it's important for us to know which version you're upgrading from.
6 The current version is present in the `version.php` file.
7
8 ### Backup your data
9
10 Shaarli 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
14 - `data/updates.txt` - contains all automatic update to the configuration and datastore files already run
15
16 See [Shaarli configuration](Shaarli configuration) for more information about Shaarli resources.
17
18 It 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
23
24 As 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:
28 - fresh installation - see [Download and installation](Download and installation)
29 - update - see the following sections
30 - check or restore the `data` directory
31
32 ## Recommended : Upgrading from release archives
33
34 All tagged revisions can be downloaded as tarballs or ZIP archives from the [releases](https://github.com/shaarli/Shaarli/releases) page.
35
36 We 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.
37
38 Once downloaded, extract the archive locally and update your remote installation (e.g. via FTP) -be sure you keep the content of the `data` directory!
39
40 After 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).
41
42 ## Upgrading with Git
43
44 ### Updating a community Shaarli
45
46 If 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:
47
48 ```bash
49 $ cd /path/to/shaarli
50 $ git pull
51
52 From github.com:shaarli/Shaarli
53 * branch master -> FETCH_HEAD
54 Updating ebd67c6..521f0e6
55 Fast-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
62 Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/):
63
64 ```bash
65 $ composer install --no-dev
66
67 Loading composer repositories with package information
68 Updating dependencies
69 - Installing shaarli/netscape-bookmark-parser (v1.0.1)
70 Downloading: 100%
71 ```
72
73 ### Migrating and upgrading from Sebsauvage's repository
74
75 If 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.
76
77 The following guide assumes that:
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)
79 - the default remote is named `origin` and points to Sebsauvage's repository
80 - the current branch is `master`
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!
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
87
88 ```bash
89 $ cd /path/to/shaarli
90
91 $ git remote -v
92 origin https://github.com/sebsauvage/Shaarli (fetch)
93 origin https://github.com/sebsauvage/Shaarli (push)
94
95 $ git branch -vv
96 * master 029f75f [origin/master] Update README.md
97
98 $ git status
99 On branch master
100 Your branch is up-to-date with 'origin/master'.
101 nothing to commit, working directory clean
102 ```
103
104 #### Step 1: update Git remotes
105
106 ```
107 $ git remote rename origin sebsauvage
108 $ git remote -v
109 sebsauvage https://github.com/sebsauvage/Shaarli (fetch)
110 sebsauvage https://github.com/sebsauvage/Shaarli (push)
111
112 $ git remote add origin https://github.com/shaarli/Shaarli
113 $ git fetch origin
114
115 remote: Counting objects: 3015, done.
116 remote: Compressing objects: 100% (19/19), done.
117 remote: Total 3015 (delta 446), reused 457 (delta 446), pack-reused 2550
118 Receiving objects: 100% (3015/3015), 2.59 MiB | 918.00 KiB/s, done.
119 Resolving deltas: 100% (1899/1899), completed with 48 local objects.
120 From https://github.com/shaarli/Shaarli
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
126 ```
127
128 #### Step 2: use the stable community branch
129
130 ```bash
131 $ git checkout origin/stable -b stable
132 Branch stable set up to track remote branch stable from origin.
133 Switched to a new branch 'stable'
134
135 $ git branch -vv
136 master 029f75f [sebsauvage/master] Update README.md
137 * stable 890afc3 [origin/stable] Merge pull request #509 from ArthurHoaro/v0.6.5
138 ```
139
140 Shaarli >= `v0.8.x`: install/update third-party PHP dependencies using [Composer](https://getcomposer.org/):
141
142 ```bash
143 $ composer install --no-dev
144
145 Loading composer repositories with package information
146 Updating dependencies
147 - Installing shaarli/netscape-bookmark-parser (v1.0.1)
148 Downloading: 100%
149 ```
150
151 Optionally, you can delete information related to the legacy version:
152
153 ```bash
154 $ git branch -D master
155 Deleted branch master (was 029f75f).
156
157 $ git remote remove sebsauvage
158
159 $ git remote -v
160 origin https://github.com/shaarli/Shaarli (fetch)
161 origin https://github.com/shaarli/Shaarli (push)
162
163 $ git gc
164 Counting objects: 3317, done.
165 Delta compression using up to 8 threads.
166 Compressing objects: 100% (1237/1237), done.
167 Writing objects: 100% (3317/3317), done.
168 Total 3317 (delta 2050), reused 3301 (delta 2034)to
169 ```
170
171 #### Step 3: configuration
172
173 After 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).
174
175 ## Troubleshooting
176
177 If 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
181 In `v0.8.1` we changed how link keys are handled (from timestamps to incremental integers).
182 Take a look at `data/updates.txt` content.
183
184 #### `updates.txt` contains `updateMethodDatastoreIds`
185
186 Try 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.