Junction / Symlink导致插件url()返回错误的URL

问题描述:

I'm testing my plugin in various WordPress versions and using symbolic links for it. I use the tool called Junction for Windows. This way I just only need to edit the trunk files. However, WordPress does not seem to handle symbolic links very well.

For example, if I run a plugin with the following code.

<?php
/*
    Plugin Name: Junction/Simlink Test
*/
echo __FILE__ . '<br />';
echo plugins_url('junctiontest.php', __FILE__) . '<br />';
?>

and create a symbolic link, (this is for Windows)

junction "z:\xampp\htdocs\wp34\wp-content\plugin\junctiontest2" "Z:\xampp\htdocs\wpcurrent\wp-content\plugins\junctiontest"

when I open the admin page of the test site with the url of wpcurrent, I get

Z:\xampp\htdocs\wpcurrent\wp-content\plugins\junctiontest\junctiontest.php
http://localhost/wpcurrent/wp-content/plugins/junctiontest/junctiontest.php

However, when I open the admin page of the test site with the url of wp34, I get

Z:\xampp\htdocs\wpcurrent\wp-content\plugins\junctiontest\junctiontest.php
http://localhost/wp34/wp-content/plugins/Z:/xampp/htdocs/wpcurrent/wp-content/plugins/junctiontest/junctiontest.php

This breaks the linked plugin.

So any suggestion to avoid this? I do not like to copy and paste the plugin into each directory every time I make a change in the trunk files.

I found this page: http://core.trac.wordpress.org/ticket/16953 It seems this is a known issue held by many plugin developers and it hasn't been solved.

我正在各种WordPress版本中测试我的插件并使用符号链接。 我使用Windows的 Junction 工具。 这样我只需要编辑trunk文件。 但是,WordPress似乎不能很好地处理符号链接。 p>

例如,如果我使用以下代码运行插件。 p>

 &lt;?php 
 / * 
插件名称:Junction / Simlink Test 
 * / 
echo __FILE__。  '&lt; br /&gt;'; 
echo plugins_url('junctiontest.php',__ FILE__)。  '&lt; br /&gt;'; 
?&gt; 
  code>  pre> 
 
 

并创建符号链接,(适用于Windows) p> \ n

junction“z:\ xampp \ htdocs \ wp34 \ wp-content \ plugin \ junctiontest2”“Z:\ xampp \ htdocs \ wpcurrent \ wp-content \ plugins \ junctiontest” p> blockquote>

当我用 wpcurrent code>的网址打开测试网站的管理页面时,我得到了 p>

  Z:\ XAMPP \ htdocs中\ wpcurrent \可湿性粉剂内容\插件\ junctiontest \ junctiontest.php 
http://localhost/wpcurrent/wp-content/plugins/junctiontest/junctiontest.php 
 代码>   pre> 
 
 

然而,当我用 wp34 code>的网址打开测试网站的管理页面时,我得到了 p>

   Z:\ XAMPP \ htdocs中\ wpcurrent \可湿性粉剂内容\插件\ junctiontest \ junctiontest.php 
http://本地主机/ wp34 /可湿性粉剂内容/插件/ Z:/ XAMPP / htdocs中/ wpcurrent /可湿性粉剂内容/插件/  junctiontest / junctiontest.php 
  code>  pre> 
 
 

这会破坏链接的插件。 p>

那么有什么建议可以避免这种情况吗? 每次我在trunk文件中进行更改时,我都不喜欢将插件复制并粘贴到每个目录中。 p>

我找到了这个页面: http://core.trac .wordpress.org / ticket / 16953 这似乎是许多插件开发者所持有的已知问题,但尚未解决。 p> div>

Use a folder synchronization tool such as DSYNCHRONIZE.