phinx init results in directory is not writable when path contains OneDrive
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
Problem
I tried to follow the Installation guide from the docs and couldn't get past
vendor/bin/phinx init
The Issue I got is:
In Init.php line 146:
The directory "C:\path\to\myrepo" is not writable
init [-f|--format FORMAT] [--] [<path>]
What I tried
After looking at line 146:
if (!is_writable($dirname)) {
I separately tested the is_writable() method in php
php -r "echo is_writable('C:\\path\\to\\myrepo') ? 'Writable' : 'Not writable';"
and the result was Not writable.
Then I tested creating a file and writing into it with php
php -r "if(file_put_contents('C:\\path\\to\\myrepo\\phpwritten.txt','test')) { echo 'Success'; } else { echo 'Error';
and it worked.
After some testing I found out the Onedrive part is making the is_writable() method return false.
C:\Users\myuser\OneDrive - company\myrepo
Workaround
After using a path without OneDrive in it everything worked.
Also removing line 146 lead to a successful creation of the phinx.php file
Maybe there is a way to fix this or add a note in the docs like in #116 ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Init.php line 146 and reproduce the failure on Windows with a repository path containing OneDrive, comparing is_writable() with the successful file-write command described in the issue. Done means either the init command handles this path correctly or the Installation documentation clearly records the limitation and workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100