Skip to content

Conversation

@bh1428
Copy link
Contributor

@bh1428 bh1428 commented Feb 21, 2021

  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

The search index is created inside the container: when the container is upgraded the index will be removed and search is broken. If you try to rebuild the index using the Searchindex Manager you get another error: (existing) directories are not found and as a consequence you cannot rebuild the index. This PR fixes both issues and thereby closes #27.

Benefits of this PR and context:

This fixes an outstanding bug and closes #27.

How Has This Been Tested?

The change has been tested by:

  • Install new container from remote docker-dokuwiki.
  • Run install.php and restart container.
  • Create a page and test search: works.
  • Remove container and create/start a new one from the remote docker-dokuwiki image.
  • Test search: broken.
  • Install and try to rebuild the search index using the Searchindex Manager: does not work, complains about missing path.
  • Build new (local) image from this PR.
  • Remove container and create/start a new one from the local build.
  • Test search: still broken (as expected)
  • Rebuild index using Searchindex Manager: this now works.
  • Test search: works as expected.
  • Again: remove container and create/start a new one from the local build.
  • Test search: still works as expected.

Source / References:

See issue #27.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Collaborator

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@aptalca
Copy link
Member

aptalca commented Mar 25, 2021

Sorry I keep putting this off because I have a question about the PR, but haven't asked it yet.

What's the deal with the savedir setting? Shouldn't it just work since we're symlinking?

@bh1428
Copy link
Contributor Author

bh1428 commented Mar 25, 2021

First of all, I am not a Docker and/or PHP specialist, so my knowledge here is limited, but from what I understand...

Yes we are indeed symlinking. However for some reason dokuwiki seems to use a function to retrieve real absolute paths in inc/init.php: function init_paths -> init_path -> fullpath. From the comments I get that fullpath behaves similary to the PHP's realpath (http://php.net/manual/en/function.realpath.php#75992)) and that seems a way to get the real absolute path.

When the savedir is relative (./data), the SearchIndex Manager plugin does not work because it finds the savedir by walking up the tree from its own absolute path (/config/dokuwiki/lib/plugins/searchindex). In other words savedir should be at /config/dokuwiki/data. That is not entirely wrong (our wiki pages are there), however that location only contains those parts of the savedir we explicitly placed outside the container (for example the cache subdirectory is not there and that's a problem for the SearchIndex Manager plugin).

If you change savedir to the absolute path inside the container (i.e. /app/dokuwiki/data) the location of the SearchIndex Manager plugin is no longer used and the plugin now finds the cache directory: you can rebuild the search index. My set 'savedir' to path in container patch changes the savedir to the absolute path when the container is started and the savedir path is still the default path (thereby automating the manual fix which is adapting the savedir in the configuration). This makes the SearchIndex Manager plugin work and still keeps the cache directory inside the container (I like that: upgrading the container means cleaning the cache).

@aptalca aptalca merged commit 60de741 into linuxserver:master Apr 15, 2021
@bh1428 bh1428 deleted the issue_27_search_index branch June 12, 2021 12:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search index only "updates" on page edit

3 participants