Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
BRIC
dokuwiki
Commits
cbe26ad6
Commit
cbe26ad6
authored
13 years ago
by
Kate Arzamastseva
Browse files
Options
Downloads
Patches
Plain Diff
media version saving fix
parent
8d56551e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
data/media_attic/_dummy
+0
-0
0 additions, 0 deletions
data/media_attic/_dummy
data/media_meta/_dummy
+0
-0
0 additions, 0 deletions
data/media_meta/_dummy
inc/media.php
+13
-7
13 additions, 7 deletions
inc/media.php
inc/pageutils.php
+5
-5
5 additions, 5 deletions
inc/pageutils.php
with
18 additions
and
12 deletions
data/media_attic/_dummy
0 → 100644
+
0
−
0
View file @
cbe26ad6
This diff is collapsed.
Click to expand it.
data/media_meta/_dummy
0 → 100644
+
0
−
0
View file @
cbe26ad6
This diff is collapsed.
Click to expand it.
inc/media.php
+
13
−
7
View file @
cbe26ad6
...
...
@@ -341,16 +341,18 @@ function _media_upload_action($data) {
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Michael Klier <chi@chimeric.de>
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function
media_upload_finish
(
$fn_tmp
,
$fn
,
$id
,
$imime
,
$overwrite
,
$move
=
'move_uploaded_file'
)
{
global
$conf
;
global
$lang
;
$old
=
@
filemtime
(
$fn
);
//
if
(
!@
file_exists
(
mediaFN
(
$id
,
$old
))
&&
@
file_exists
(
$fn
))
{
$oldRev
=
getRevisions
(
$id
,
-
1
,
1
,
1024
,
true
);
// from changelog
$oldRev
=
(
int
)(
empty
(
$oldRev
)
?
0
:
$oldRev
[
0
]);
if
(
!@
file_exists
(
mediaFN
(
$id
,
$old
))
&&
@
file_exists
(
$fn
)
&&
$old
>=
$oldRev
)
{
// add old revision to the attic if missing
saveOld
Media
Revision
(
$id
);
media_
saveOldRevision
(
$id
);
}
// prepare directory
...
...
@@ -376,17 +378,21 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov
}
/**
* moves the current version to the media_attic and returns its
* revision date
* Moves the current version of media file to the media_attic
* directory
*
* @author Kate Arzamastseva <pshns@ukr.net>
* @param string $id
* @return int - revision date
*/
function
saveOld
Media
Revision
(
$id
,
$move
=
'copy'
){
function
media_
saveOldRevision
(
$id
){
global
$conf
;
$oldf
=
mediaFN
(
$id
);
if
(
!@
file_exists
(
$oldf
))
return
''
;
$date
=
filemtime
(
$oldf
);
$newf
=
mediaFN
(
$id
,
$date
);
io_makeFileDir
(
$newf
);
if
(
$move
(
$oldf
,
$newf
))
{
if
(
copy
(
$oldf
,
$newf
))
{
// Set the correct permission here.
// Always chmod media because they may be saved with different permissions than expected from the php umask.
// (Should normally chmod to $conf['fperm'] only if $conf['fperm'] is set.)
...
...
This diff is collapsed.
Click to expand it.
inc/pageutils.php
+
5
−
5
View file @
cbe26ad6
...
...
@@ -295,8 +295,6 @@ function wikiLockFN($id) {
/**
* returns the full path to the meta file specified by ID and extension
*
* The filename is URL encoded to protect Unicode chars
*
* @author Steven Danz <steven-danz@kc.rr.com>
*/
function
metaFN
(
$id
,
$ext
){
...
...
@@ -310,7 +308,7 @@ function metaFN($id,$ext){
/**
* returns the full path to the media's meta file specified by ID and extension
*
*
The filename is URL encoded to protect Unicode chars
*
@author Kate Arzamastseva <pshns@ukr.net>
*/
function
mediaMetaFN
(
$id
,
$ext
){
global
$conf
;
...
...
@@ -339,6 +337,7 @@ function metaFiles($id){
* The filename is URL encoded to protect Unicode chars
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function
mediaFN
(
$id
,
$rev
=
''
){
global
$conf
;
...
...
@@ -347,8 +346,9 @@ function mediaFN($id, $rev=''){
if
(
empty
(
$rev
)){
$fn
=
$conf
[
'mediadir'
]
.
'/'
.
utf8_encodeFN
(
$id
);
}
else
{
list
(
$name
,
$ext
)
=
explode
(
"."
,
$id
);
$fn
=
$conf
[
'mediaolddir'
]
.
'/'
.
utf8_encodeFN
(
$name
)
.
'.'
.
$rev
.
'.'
.
utf8_encodeFN
(
$ext
);
$ext
=
mimetype
(
$id
);
$name
=
substr
(
$id
,
0
,
strrpos
(
$id
,
'.'
));
$fn
=
$conf
[
'mediaolddir'
]
.
'/'
.
utf8_encodeFN
(
$name
)
.
'.'
.
(
int
)
$rev
.
'.'
.
utf8_encodeFN
(
$ext
[
0
]);
}
return
$fn
;
}
...
...
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