Problems whith path when compiling phinx application in a phar
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a console application that includes some phinx commands (basically built as explained here: https://book.cakephp.org/phinx/0/en/commands.html#wrapping-phinx-in-another-symfony-console-application).
In order to move the tool easily I compile an execuatble phar by using phing.
My problem is that paths inside phar's are changed and used by php with the phar:// prefix.
As the php manual specifies there are many functions which are not phar aware, especially glob(), which is used in the Util::getFiles() method called by the Manager::getMigrationFiles() method. The result is that no migration classes are found when executing the migrate command from the phar.
I suggest using the nette/finder library to change the Util::getFiles() method (and possibily other ones using glob), with something like this:
public static function getFiles($paths)
{
$files = [];
foreach ($paths as $path) {
foreach (\Nette\Utils\Finder::findFiles('*.php')->from($path) as $v) {
$files[] = $v->__toString();
}
}
$files = array_unique($files);
return $files;
}
Many thanks,
Frank
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
Read Util::getFiles() and its call from Manager::getMigrationFiles(). Reproduce the migrate command from the phar and verify that migration classes are discovered; done means the phar-based application finds its migration files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100