Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Yeray Santana Hualde
syncEnrollments
Commits
b97dccfb
Commit
b97dccfb
authored
Feb 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt to clean up working directory after bundle install.
parent
e0c84a94
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
provider.php
laravel/cli/tasks/bundle/providers/provider.php
+3
-1
file.php
laravel/file.php
+22
-7
No files found.
laravel/cli/tasks/bundle/providers/provider.php
View file @
b97dccfb
...
@@ -23,7 +23,7 @@ abstract class Provider {
...
@@ -23,7 +23,7 @@ abstract class Provider {
{
{
// When installing a bundle from a Zip archive, we'll first clone
// When installing a bundle from a Zip archive, we'll first clone
// down the bundle zip into the bundles "working" directory so
// down the bundle zip into the bundles "working" directory so
// we have a spot to do all of our bundle extration
s
.
// we have a spot to do all of our bundle extration
work
.
$target
=
path
(
'storage'
)
.
'work/laravel-bundle.zip'
;
$target
=
path
(
'storage'
)
.
'work/laravel-bundle.zip'
;
File
::
put
(
$target
,
file_get_contents
(
$url
));
File
::
put
(
$target
,
file_get_contents
(
$url
));
...
@@ -46,6 +46,8 @@ abstract class Provider {
...
@@ -46,6 +46,8 @@ abstract class Provider {
$path
=
$this
->
path
(
$bundle
);
$path
=
$this
->
path
(
$bundle
);
File
::
cpdir
(
$latest
->
getRealPath
(),
path
(
'bundle'
)
.
$path
);
File
::
cpdir
(
$latest
->
getRealPath
(),
path
(
'bundle'
)
.
$path
);
@
unlink
(
$target
);
}
}
/**
/**
...
...
laravel/file.php
View file @
b97dccfb
<?php
namespace
Laravel
;
use
Closure
,
FilesystemIterator
;
<?php
namespace
Laravel
;
use
Closure
,
FilesystemIterator
as
fIterator
;
class
File
{
class
File
{
...
@@ -174,15 +174,29 @@ class File {
...
@@ -174,15 +174,29 @@ class File {
return
false
;
return
false
;
}
}
/**
* Move a directory from one location to another.
*
* @param string $source
* @param string $destination
* @param int $options
* @return void
*/
public
static
function
mvdir
(
$source
,
$destination
,
$options
=
fIterator
::
SKIP_DOTS
)
{
static
::
cpdir
(
$source
,
$destination
,
true
,
$options
);
}
/**
/**
* Recursively copy directory contents to another directory.
* Recursively copy directory contents to another directory.
*
*
* @param string $source
* @param string $source
* @param string $destination
* @param string $destination
* @param bool $delete
* @param bool $delete
* @param int $options
* @return void
* @return void
*/
*/
public
static
function
cpdir
(
$source
,
$destination
,
$delete
=
false
)
public
static
function
cpdir
(
$source
,
$destination
,
$delete
=
false
,
$options
=
fIterator
::
SKIP_DOTS
)
{
{
if
(
!
is_dir
(
$source
))
return
;
if
(
!
is_dir
(
$source
))
return
;
...
@@ -194,7 +208,7 @@ class File {
...
@@ -194,7 +208,7 @@ class File {
mkdir
(
$destination
,
0777
,
true
);
mkdir
(
$destination
,
0777
,
true
);
}
}
$items
=
new
FilesystemIterator
(
$source
,
FilesystemIterator
::
SKIP_DOTS
);
$items
=
new
fIterator
(
$source
,
$options
);
foreach
(
$items
as
$item
)
foreach
(
$items
as
$item
)
{
{
...
@@ -210,7 +224,7 @@ class File {
...
@@ -210,7 +224,7 @@ class File {
static
::
cpdir
(
$path
,
$location
);
static
::
cpdir
(
$path
,
$location
);
if
(
$delete
)
rmdir
(
$item
->
getRealPath
());
if
(
$delete
)
@
rmdir
(
$item
->
getRealPath
());
}
}
// If the file system item is an actual file, we can copy the
// If the file system item is an actual file, we can copy the
// file from the bundle asset directory to the public asset
// file from the bundle asset directory to the public asset
...
@@ -220,7 +234,7 @@ class File {
...
@@ -220,7 +234,7 @@ class File {
{
{
copy
(
$item
->
getRealPath
(),
$location
);
copy
(
$item
->
getRealPath
(),
$location
);
if
(
$delete
)
unlink
(
$item
->
getRealPath
());
if
(
$delete
)
@
unlink
(
$item
->
getRealPath
());
}
}
}
}
...
@@ -231,13 +245,14 @@ class File {
...
@@ -231,13 +245,14 @@ class File {
* Get the most recently modified file in a directory.
* Get the most recently modified file in a directory.
*
*
* @param string $directory
* @param string $directory
* @param int $options
* @return SplFileInfo
* @return SplFileInfo
*/
*/
public
static
function
latest
(
$directory
)
public
static
function
latest
(
$directory
,
$options
=
fIterator
::
SKIP_DOTS
)
{
{
$time
=
0
;
$time
=
0
;
$items
=
new
FilesystemIterator
(
$directory
,
FilesystemIterator
::
SKIP_DOTS
);
$items
=
new
fIterator
(
$directory
,
$options
);
// To get the latest created file, we'll simply spin through the
// To get the latest created file, we'll simply spin through the
// directory, setting the latest file if we encounter a file
// directory, setting the latest file if we encounter a file
...
...
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