|
2 | 2 | Patching Nextcloud |
3 | 3 | ================== |
4 | 4 |
|
| 5 | +Obtaining a patch |
| 6 | +----------------- |
| 7 | + |
| 8 | +If you found a related pull request on GitHub that solves your issue, or you want to help developers and verify a fix works, you can get a patch for the pull request. |
| 9 | + |
| 10 | +1. Using https://github.com/nextcloud/server/pull/26396 as an example. |
| 11 | +2. Append ``.patch`` to the URL: https://github.com/nextcloud/server/pull/26396.patch |
| 12 | +3. Download the patch to your server and follow the `Applying a patch`_ steps. |
| 13 | +4. If you are on an older Nextcloud version, you might first need to go to the correct backported patch for your version. |
| 14 | + |
| 15 | +.. image:: images/getting-a-patch-from-github.png |
| 16 | + :alt: backportbot-nextcloud linking to the pull request for an older version. |
| 17 | + |
| 18 | +5. You can find the appropriate version by looking for a link posted by ``backportbot-nextcloud`` to the backport pull request for your release, or by checking for a developer comment with a manual backport link. Use the ``.patch`` URL of that backport PR. |
| 19 | + |
5 | 20 | Applying a patch |
6 | 21 | ---------------- |
7 | 22 |
|
8 | 23 | Patching server |
9 | 24 | ^^^^^^^^^^^^^^^ |
10 | 25 |
|
11 | | -1. Navigate into your Nextcloud server's root directory (contains the ``status.php`` file) |
12 | | -2. Now apply the patch with the following command:: |
| 26 | +1. Navigate to your Nextcloud server's root directory (the one that contains the ``status.php`` file). |
| 27 | +2. Apply the patch with the following command:: |
13 | 28 |
|
14 | 29 | patch -p 1 < /path/to/the/file.patch |
15 | 30 |
|
16 | | -.. note:: |
17 | | - |
18 | | - There can be errors about not found files, especially when you take a patch from GitHub there might be development or test files included in the patch. when the files are in build/ or a tests/ subdirectory it is mostly being |
19 | | - |
20 | 31 | Patching apps |
21 | 32 | ^^^^^^^^^^^^^ |
22 | 33 |
|
23 | | -1. Navigate to the root of this app (mostly ``apps/[APPID]/``), if you can not find the app there use the ``sudo -E -u www-data php occ app:getpath APPID`` command to find the path. |
24 | | -2. Now apply the patch with the same command as in `Patching server`_ |
| 34 | +1. Navigate to the root of the app (usually ``apps/[APPID]/``). If you cannot find the app there, use the ``sudo -E -u www-data php occ app:getpath APPID`` command to find the path. |
| 35 | +2. Apply the patch with the same command as in `Patching server`_. |
25 | 36 |
|
26 | 37 | Reverting a patch |
27 | 38 | ----------------- |
28 | 39 |
|
29 | 40 | 1. Navigate to the directory where you applied the patch. |
30 | | -2. Now revert the patch with the ``-R`` option:: |
| 41 | +2. Revert the patch with the ``-R`` option:: |
31 | 42 |
|
32 | 43 | patch -R -p 1 < /path/to/the/file.patch |
33 | 44 |
|
34 | | -Getting a patch from a GitHub pull request |
35 | | ------------------------------------------- |
36 | | - |
37 | | -If you found a related pull request on GitHub that solves your issue, or you want to help developers and verify a fix works, you can get a patch for the pull request. |
38 | | - |
39 | | -1. Using https://github.com/nextcloud/server/pull/26396 as an example. |
40 | | -2. Append ``.patch`` to the URL: https://github.com/nextcloud/server/pull/26396.patch |
41 | | -3. Download the patch to your server and follow the `Applying a patch`_ steps. |
42 | | -4. In case you are on an older version, you might first need to go the the correct version of the patch. |
| 45 | +Notes and troubleshooting |
| 46 | +------------------------- |
43 | 47 |
|
44 | | -.. image:: images/getting-a-patch-from-github.png |
45 | | - :alt: backportbot-nextcloud linking to the pull request for an older version. |
| 48 | +.. note:: |
46 | 49 |
|
47 | | -5. You can find it by looking for a link by the ``backportbot-nextcloud`` or a developer will leave a manual comment about the backport to an older Nextcloud version. For the example above you the pull request for Nextcloud 21 is at https://github.com/nextcloud/server/pull/26406 and the patch at https://github.com/nextcloud/server/pull/26406.patch |
| 50 | + You may see errors about files not being found, especially when applying patches from GitHub. Patches can include development or test files (for example, files under ``build/`` or ``tests/``) that are not present on your installation. These messages are expected and can be ignored if they refer only to such files. |
0 commit comments