Matrix installed under a symlink

I just thought I would share this with people as it caused me a bit of head scratching while changing the system root on one of our installs.


We have a fairly old dev system that we have always accessed via a path similar to "/example/mysource_matrix" where our unix devs actually made "/example" a symlink to "/m/example".



I won't go into the why, but we are moving it under something more like "/example/envname/matrix". I moved the install, ran scripts/system_move_update.php and everything seemed quite happy, but after a while someone got a "File Belongs to different Repository" error. After a bit of proding and poking I worked out that sometimes the system had been using "/example/mysource_matrix" as the root path and at others it must have been using "/m/example/mysource_matrix". Running the system_move_update script over the other root fixed the issue. But it's worth noting that you should check all your paths up to the root to see if someone has put in a symlink for you and running the move script over all possible matrix roots.



I think it should also be possible to have the system_move script flag any files that niether have the old root or the new root by actually specifically looking for the "dir=" line inside the .FFV files it looks at.


Yes, I agree. :) Could you submit this on the Bug Tracker as a feature request?

Edited to that this issue was more obvious on older versions of Matrix. From v3.14, we made Matrix and its associated scripts far more symlink friendly. Though, you'd still see this issue if you've upgraded from older versions, obviously.

The install in question is running 3.14.2 at the moment (and was probably upgraded from something older than 3.10), would you still like me to put in a bug request if this has been fixed in newer ones?


Yes, because system_move_update.php could still be extended to report any non-old/new system paths it finds.

As a side note, I regularly use this handy one-liner to verify data directory integrity (it will return a list of all the different FFV paths being used – there should only be one):

    find data -type f -path '*/.FFV/*' -print0 | xargs -r0 head -q -n1 | sort | uniq


Still, would be handy for system_move_update.php to just fix things without requiring an input directory.

Cheers,
Dan.

[quote]

    find data -type f -path ‘/.FFV/’ -print0 | xargs -r0 head -q -n1 | sort | uniq



Still, would be handy for system_move_update.php to just fix things without requiring an input directory.[/quote]

That command won’t work on our old solaris install, I have to do something more like this:
    find data | grep “/.FFV/” | xargs cat | grep “dir=”" | sort | uniq -c
thanks for the suggestion though.



I did try modifying the script to run PHP’s realpath() function over the new path before letting the script run, but I found that realpath would return “/m/example/…” but because of the way apache is configured (I think) “/example/…” seems to be the one actually getting used :frowning:





Oh and I’ve now posted a bug report - 2940