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
29778747
Commit
29778747
authored
13 years ago
by
Kate Arzamastseva
Browse files
Options
Downloads
Patches
Plain Diff
media revisions in recent changes
parent
fc4aefb9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/changelog.php
+40
-10
40 additions, 10 deletions
inc/changelog.php
inc/common.php
+1
-0
1 addition, 0 deletions
inc/common.php
with
41 additions
and
10 deletions
inc/changelog.php
+
40
−
10
View file @
29778747
...
...
@@ -152,6 +152,7 @@ function addMediaLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='',
* RECENTS_SKIP_MINORS - don't include minor changes
* RECENTS_SKIP_SUBSPACES - don't include subspaces
* RECENTS_MEDIA_CHANGES - return media changes instead of page changes
* RECENTS_INCLUDE_MEDIA - return both media changes and page changes
*
* @param int $first number of first entry returned (for paginating
* @param int $num return $num entries
...
...
@@ -159,6 +160,7 @@ function addMediaLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='',
* @param bool $flags see above
*
* @author Ben Coburn <btcoburn@silicodon.net>
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function
getRecents
(
$first
,
$num
,
$ns
=
''
,
$flags
=
0
){
global
$conf
;
...
...
@@ -174,20 +176,46 @@ function getRecents($first,$num,$ns='',$flags=0){
}
else
{
$lines
=
@
file
(
$conf
[
'changelog'
]);
}
$lines_position
=
count
(
$lines
)
-
1
;
if
(
$flags
&
RECENTS_INCLUDE_MEDIA
)
{
$media_lines
=
@
file
(
$conf
[
'media_changelog'
]);
$media_lines_position
=
count
(
$media_lines
)
-
1
;
}
// handle lines
$seen
=
array
();
// caches seen lines, _handleRecent() skips them
for
(
$i
=
count
(
$lines
)
-
1
;
$i
>=
0
;
$i
--
){
$rec
=
_handleRecent
(
$lines
[
$i
],
$ns
,
$flags
,
$seen
);
if
(
$rec
!==
false
)
{
if
(
--
$first
>=
0
)
continue
;
// skip first entries
$recent
[]
=
$rec
;
$count
++
;
// break when we have enough entries
if
(
$count
>=
$num
){
break
;
}
// handle lines
while
(
$lines_position
>=
0
||
((
$flags
&
RECENTS_INCLUDE_MEDIA
)
&&
$media_lines_position
>=
0
))
{
if
(
empty
(
$rec
)
&&
$lines_position
>=
0
)
{
$rec
=
_handleRecent
(
@
$lines
[
$lines_position
],
$ns
,
$flags
,
$seen
);
if
(
!
$rec
)
{
$lines_position
--
;
continue
;
}
}
if
((
$flags
&
RECENTS_INCLUDE_MEDIA
)
&&
empty
(
$media_rec
)
&&
$media_lines_position
>=
0
)
{
$media_rec
=
_handleRecent
(
@
$media_lines
[
$media_lines_position
],
$ns
,
$flags
,
$seen
);
if
(
!
$media_rec
)
{
$media_lines_position
--
;
continue
;
}
}
if
((
$flags
&
RECENTS_INCLUDE_MEDIA
)
&&
@
$media_rec
[
'date'
]
>=
@
$rec
[
'date'
])
{
$media_lines_position
--
;
$x
=
$media_rec
;
$media_rec
=
false
;
}
else
{
$lines_position
--
;
$x
=
$rec
;
$rec
=
false
;
}
if
(
--
$first
>=
0
)
continue
;
// skip first entries
$recent
[]
=
$x
;
$count
++
;
// break when we have enough entries
if
(
$count
>=
$num
){
break
;
}
}
return
$recent
;
}
...
...
@@ -301,6 +329,7 @@ function _handleRecent($line,$ns,$flags,&$seen){
* requested changelog line is read.
*
* @author Ben Coburn <btcoburn@silicodon.net>
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function
getRevisionInfo
(
$id
,
$rev
,
$chunk_size
=
8192
,
$media
=
false
)
{
global
$cache_revinfo
;
...
...
@@ -402,6 +431,7 @@ function getRevisionInfo($id, $rev, $chunk_size=8192, $media=false) {
* lines are recieved.
*
* @author Ben Coburn <btcoburn@silicodon.net>
* @author Kate Arzamastseva <pshns@ukr.net>
*/
function
getRevisions
(
$id
,
$first
,
$num
,
$chunk_size
=
8192
,
$media
=
false
)
{
global
$cache_revinfo
;
...
...
This diff is collapsed.
Click to expand it.
inc/common.php
+
1
−
0
View file @
29778747
...
...
@@ -15,6 +15,7 @@ define('RECENTS_SKIP_DELETED',2);
define
(
'RECENTS_SKIP_MINORS'
,
4
);
define
(
'RECENTS_SKIP_SUBSPACES'
,
8
);
define
(
'RECENTS_MEDIA_CHANGES'
,
16
);
define
(
'RECENTS_INCLUDE_MEDIA'
,
32
);
/**
* Wrapper around htmlspecialchars()
...
...
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