Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e4cbc275
Commit
e4cbc275
authored
Dec 06, 2013
by
Julio Montoya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing realpath issue when using command in a phar
Applying suggestions.
parent
52763253
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
ImportCommand.php
lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php
+14
-6
No files found.
lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php
View file @
e4cbc275
...
@@ -65,18 +65,26 @@ EOT
...
@@ -65,18 +65,26 @@ EOT
if
((
$fileNames
=
$input
->
getArgument
(
'file'
))
!==
null
)
{
if
((
$fileNames
=
$input
->
getArgument
(
'file'
))
!==
null
)
{
foreach
((
array
)
$fileNames
as
$fileName
)
{
foreach
((
array
)
$fileNames
as
$fileName
)
{
if
(
!
file_exists
(
$fileName
))
{
$filePath
=
realpath
(
$fileName
);
// Phar compatibility.
if
(
false
===
$filePath
)
{
$filePath
=
$fileName
;
}
if
(
!
file_exists
(
$filePath
))
{
throw
new
\InvalidArgumentException
(
throw
new
\InvalidArgumentException
(
sprintf
(
"SQL file '<info>%s</info>' does not exist."
,
$file
Name
)
sprintf
(
"SQL file '<info>%s</info>' does not exist."
,
$file
Path
)
);
);
}
else
if
(
!
is_readable
(
$fileName
))
{
}
else
if
(
!
is_readable
(
$filePath
))
{
throw
new
\InvalidArgumentException
(
throw
new
\InvalidArgumentException
(
sprintf
(
"SQL file '<info>%s</info>' does not have read permissions."
,
$file
Name
)
sprintf
(
"SQL file '<info>%s</info>' does not have read permissions."
,
$file
Path
)
);
);
}
}
$output
->
write
(
sprintf
(
"Processing file '<info>%s</info>'... "
,
$file
Name
));
$output
->
write
(
sprintf
(
"Processing file '<info>%s</info>'... "
,
$file
Path
));
$sql
=
file_get_contents
(
$file
Name
);
$sql
=
file_get_contents
(
$file
Path
);
if
(
$conn
instanceof
\Doctrine\DBAL\Driver\PDOConnection
)
{
if
(
$conn
instanceof
\Doctrine\DBAL\Driver\PDOConnection
)
{
// PDO Drivers
// PDO Drivers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment