Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
24271cf9
Commit
24271cf9
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #21216 from owncloud/fopen-statcache
Clear SMB statcache after fopen
parents
eb509bcb
667d7383
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_external/lib/smb.php
+7
-2
7 additions, 2 deletions
apps/files_external/lib/smb.php
tests/lib/files/storage/storage.php
+13
-0
13 additions, 0 deletions
tests/lib/files/storage/storage.php
with
20 additions
and
2 deletions
apps/files_external/lib/smb.php
+
7
−
2
View file @
24271cf9
...
@@ -33,6 +33,7 @@ use Icewind\SMB\Exception\Exception;
...
@@ -33,6 +33,7 @@ use Icewind\SMB\Exception\Exception;
use
Icewind\SMB\Exception\NotFoundException
;
use
Icewind\SMB\Exception\NotFoundException
;
use
Icewind\SMB\NativeServer
;
use
Icewind\SMB\NativeServer
;
use
Icewind\SMB\Server
;
use
Icewind\SMB\Server
;
use
Icewind\Streams\CallbackWrapper
;
use
Icewind\Streams\IteratorDirectory
;
use
Icewind\Streams\IteratorDirectory
;
use
OC\Files\Filesystem
;
use
OC\Files\Filesystem
;
...
@@ -189,7 +190,10 @@ class SMB extends Common {
...
@@ -189,7 +190,10 @@ class SMB extends Common {
return
$this
->
share
->
read
(
$fullPath
);
return
$this
->
share
->
read
(
$fullPath
);
case
'w'
:
case
'w'
:
case
'wb'
:
case
'wb'
:
return
$this
->
share
->
write
(
$fullPath
);
$source
=
$this
->
share
->
write
(
$fullPath
);
return
CallBackWrapper
::
wrap
(
$source
,
null
,
null
,
function
()
use
(
$fullPath
)
{
unset
(
$this
->
statCache
[
$fullPath
]);
});
case
'a'
:
case
'a'
:
case
'ab'
:
case
'ab'
:
case
'r+'
:
case
'r+'
:
...
@@ -219,7 +223,8 @@ class SMB extends Common {
...
@@ -219,7 +223,8 @@ class SMB extends Common {
}
}
$source
=
fopen
(
$tmpFile
,
$mode
);
$source
=
fopen
(
$tmpFile
,
$mode
);
$share
=
$this
->
share
;
$share
=
$this
->
share
;
return
CallBackWrapper
::
wrap
(
$source
,
null
,
null
,
function
()
use
(
$tmpFile
,
$fullPath
,
$share
)
{
return
CallbackWrapper
::
wrap
(
$source
,
null
,
null
,
function
()
use
(
$tmpFile
,
$fullPath
,
$share
)
{
unset
(
$this
->
statCache
[
$fullPath
]);
$share
->
put
(
$tmpFile
,
$fullPath
);
$share
->
put
(
$tmpFile
,
$fullPath
);
unlink
(
$tmpFile
);
unlink
(
$tmpFile
);
});
});
...
...
This diff is collapsed.
Click to expand it.
tests/lib/files/storage/storage.php
+
13
−
0
View file @
24271cf9
...
@@ -598,4 +598,17 @@ abstract class Storage extends \Test\TestCase {
...
@@ -598,4 +598,17 @@ abstract class Storage extends \Test\TestCase {
$this
->
instance
->
mkdir
(
'source'
);
$this
->
instance
->
mkdir
(
'source'
);
$this
->
assertTrue
(
$this
->
instance
->
isSharable
(
'source'
));
$this
->
assertTrue
(
$this
->
instance
->
isSharable
(
'source'
));
}
}
public
function
testStatAfterWrite
()
{
$this
->
instance
->
file_put_contents
(
'foo.txt'
,
'bar'
);
$stat
=
$this
->
instance
->
stat
(
'foo.txt'
);
$this
->
assertEquals
(
3
,
$stat
[
'size'
]);
$fh
=
$this
->
instance
->
fopen
(
'foo.txt'
,
'w'
);
fwrite
(
$fh
,
'qwerty'
);
fclose
(
$fh
);
$stat
=
$this
->
instance
->
stat
(
'foo.txt'
);
$this
->
assertEquals
(
6
,
$stat
[
'size'
]);
}
}
}
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