-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocalPath's relativize() fails in some cases #70
Comments
Thanks for reporting. I miss it, I don't know how. Can I have your case specifically so that I can test it. |
Basically my web hosting provider set up the directories like this:
When accessing https://wiki.alias.com, pages will be served from |
Thanks. Sorry for the inconvenience, that's infuriating, I know. I still don't see the relativization that does not work.
What do you mean with Thanks Ps for me later, the code location are: |
I took a look at the installation and its strange that you got |
Basically the symptom was that when I created or edited a new page, I got an error IIRC, Dokuwiki tried to add a file in I think I just commented out the conditions that checked public function relativize(LocalPath $localPath): LocalPath
{
/**
* One of the problem of relativization is
* that it may be:
* * logical (when using a symling)
* * physical
*/
//if (!$this->isAbsolute() || $this->isShortName()) {
/**
* This is not a logical resolution
* (if the path is logically not absolute and is a symlink,
* we have a problem)
*/
$actualPath = $this->toCanonicalAbsolutePath();
//} else {
// $actualPath = $this;
//}
//if (!$localPath->isAbsolute() || $localPath->isShortName()) {
$localPath = $localPath->toCanonicalAbsolutePath();
//}
if (strpos($actualPath->toAbsoluteId(), $localPath->toAbsoluteId()) === 0) {
if ($actualPath->toAbsoluteId() === $localPath->toAbsoluteId()) {
return LocalPath::createFromPathString("");
}
$sepCharacter = 1; // delete the sep characters
$relativePath = substr($actualPath->toAbsoluteId(), strlen($localPath->toAbsoluteId()) + $sepCharacter);
$relativePath = str_replace($this->getDirectorySeparator(), WikiPath::NAMESPACE_SEPARATOR_DOUBLE_POINT, $relativePath);
return LocalPath::createFromPathString($relativePath);
}
/**
* May be a symlink link
*/
if ($this->isSymlink()) {
$realPath = $this->toCanonicalAbsolutePath();
return $realPath->relativize($localPath);
}
if ($localPath->isSymlink()) {
$localPath = $localPath->toCanonicalAbsolutePath();
$this->relativize($localPath);
}
throw new ExceptionBadArgument("The path ($localPath) is not a parent path of the actual path ($actualPath)");
} |
It would be great if I can have the stack trace in the log to see where the relativize function was called during the creation because recreating your environment is a lot of work. |
I don't have access to the server at the moment, but IIRC it's called from |
I want the stack trace to go way back until the creation of the page. I'll wait. In this function, the code throws an exception, where we can see the paths involved and the whole code path. During the page creation, at some point, the paths passed are not good. |
If there is a symlink in a child folder (generally the data folder), the relativization will not work if we take the canonical path. The file would be at: |
Is this what you need?
|
Yes. I have symlinked the DokuWiki root installation on my environment and it works. Maybe it comes from the This is the Apache configuration that I have used: <VirtualHost *:80>
DocumentRoot "d:/dokuwiki-symlink"
ServerName combo.nico.lan
DirectoryIndex index.php
<Directory "d:/dokuwiki-symlink" >
Require all granted
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI
</Directory>
</VirtualHost> Do you know your HTTP server configuration? |
If you add I'm trying to see the configuration value At least, as you seem to have a bit of Php knowledge, in a PHP script, you can do global $conf;
$pageDirectory = $conf['datadir'];
echo $pageDirectory Ps: I use a farm therefore the symlink does not impact the data configuration.... |
If you set the
|
If I set |
Thanks! |
Checking
...->isSymlink()
might not be enough, because it might be (one of) the ancestor's directories that is symlinked. Also, the$localPath->isSymlink()
condition inrelativize()
might be missing areturn
.Background:
Creating a new page doesn't work on my instance after upgrading combostrap to the new major version. My dokuwiki is set up on a symlinked dir and looking at the error log it appeared that combo failed to relativize the file path. Forcing canonical absolute path resolution solved the issue.
The text was updated successfully, but these errors were encountered: