Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
00b34a09
Commit
00b34a09
authored
12 years ago
by
Jörn Friedrich Dreyer
Browse files
Options
Downloads
Patches
Plain Diff
cache tar archive headers
parent
72a48ca3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/archive/tar.php
+13
-4
13 additions, 4 deletions
lib/archive/tar.php
with
13 additions
and
4 deletions
lib/archive/tar.php
+
13
−
4
View file @
00b34a09
...
...
@@ -14,6 +14,7 @@ class OC_Archive_TAR extends OC_Archive{
const
BZIP
=
2
;
private
$fileList
;
private
$cachedHeaders
;
/**
* @var Archive_Tar tar
...
...
@@ -74,6 +75,7 @@ class OC_Archive_TAR extends OC_Archive{
$result
=
$this
->
tar
->
addModify
(
array
(
$tmpBase
.
$path
),
''
,
$tmpBase
);
rmdir
(
$tmpBase
.
$path
);
$this
->
fileList
=
false
;
$this
->
cachedHeaders
=
false
;
return
$result
;
}
/**
...
...
@@ -95,6 +97,7 @@ class OC_Archive_TAR extends OC_Archive{
$result
=
$this
->
tar
->
addString
(
$path
,
$source
);
}
$this
->
fileList
=
false
;
$this
->
cachedHeaders
=
false
;
return
$result
;
}
...
...
@@ -115,12 +118,15 @@ class OC_Archive_TAR extends OC_Archive{
$this
->
tar
=
new
Archive_Tar
(
$this
->
path
,
$types
[
self
::
getTarType
(
$this
->
path
)]);
$this
->
tar
->
createModify
(
array
(
$tmp
),
''
,
$tmp
.
'/'
);
$this
->
fileList
=
false
;
$this
->
cachedHeaders
=
false
;
return
true
;
}
private
function
getHeader
(
$file
)
{
$headers
=
$this
->
tar
->
listContent
();
foreach
(
$headers
as
$header
)
{
if
(
!
$this
->
cachedHeaders
)
{
$this
->
cachedHeaders
=
$this
->
tar
->
listContent
();
}
foreach
(
$this
->
cachedHeaders
as
$header
)
{
if
(
$file
==
$header
[
'filename'
]
or
$file
.
'/'
==
$header
[
'filename'
]
or
'/'
.
$file
.
'/'
==
$header
[
'filename'
]
or
'/'
.
$file
==
$header
[
'filename'
])
{
return
$header
;
}
...
...
@@ -180,9 +186,11 @@ class OC_Archive_TAR extends OC_Archive{
if
(
$this
->
fileList
)
{
return
$this
->
fileList
;
}
$headers
=
$this
->
tar
->
listContent
();
if
(
!
$this
->
cachedHeaders
)
{
$this
->
cachedHeaders
=
$this
->
tar
->
listContent
();
}
$files
=
array
();
foreach
(
$
h
eaders
as
$header
)
{
foreach
(
$
this
->
cachedH
eaders
as
$header
)
{
$files
[]
=
$header
[
'filename'
];
}
$this
->
fileList
=
$files
;
...
...
@@ -265,6 +273,7 @@ class OC_Archive_TAR extends OC_Archive{
return
false
;
}
$this
->
fileList
=
false
;
$this
->
cachedHeaders
=
false
;
//no proper way to delete, extract entire archive, delete file and remake archive
$tmp
=
OCP\Files
::
tmpFolder
();
$this
->
tar
->
extract
(
$tmp
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment