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
54f4c056
Commit
54f4c056
authored
19 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
backlinks now use the new index based search
darcs-hash:20050912141042-7ad00-5ef43525c9fd7ba44206720c54bb566450f93250.gz
parent
6793fe33
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inc/fulltext.php
+42
-0
42 additions, 0 deletions
inc/fulltext.php
inc/html.php
+4
-14
4 additions, 14 deletions
inc/html.php
inc/search.php
+1
-0
1 addition, 0 deletions
inc/search.php
with
47 additions
and
14 deletions
inc/fulltext.php
+
42
−
0
View file @
54f4c056
...
...
@@ -76,6 +76,48 @@ function ft_pageSearch($query,&$poswords){
return
$docs
;
}
/**
* Returns the backlinks for a given page
*
* Does a quick lookup with the fulltext index, then
* evaluates the instructions of the found pages
*/
function
ft_backlinks
(
$id
){
global
$conf
;
$result
=
array
();
// quick lookup of the pagename
$page
=
noNS
(
$id
);
$matches
=
idx_lookup
(
array
(
$page
));
if
(
!
count
(
$matches
))
return
$result
;
require_once
(
DOKU_INC
.
'inc/parserutils.php'
);
// check instructions for matching links
foreach
(
array_keys
(
$matches
[
$page
])
as
$match
){
$instructions
=
p_cached_instructions
(
wikiFN
(
$match
),
true
);
if
(
is_null
(
$instructions
))
continue
;
$match_ns
=
getNS
(
$match
);
foreach
(
$instructions
as
$ins
){
if
(
$ins
[
0
]
==
'internallink'
||
(
$conf
[
'camelcase'
]
&&
$ins
[
0
]
==
'camelcaselink'
)
){
$link
=
$ins
[
1
][
0
];
resolve_pageid
(
$match_ns
,
$link
,
$exists
);
//exists is not used
if
(
$link
==
$id
){
//we have a match - finish
$result
[]
=
$match
;
break
;
}
}
}
}
sort
(
$result
);
return
$result
;
}
/**
* Quicksearch for pagenames
*
...
...
This diff is collapsed.
Click to expand it.
inc/html.php
+
4
−
14
View file @
54f4c056
...
...
@@ -668,28 +668,18 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function
html_backlinks
(){
require_once
(
DOKU_INC
.
'inc/
search
.php'
);
require_once
(
DOKU_INC
.
'inc/
fulltext
.php'
);
global
$ID
;
global
$conf
;
if
(
preg_match
(
'#^(.*):(.*)$#'
,
$ID
,
$matches
)){
$opts
[
'ns'
]
=
$matches
[
1
];
$opts
[
'name'
]
=
$matches
[
2
];
}
else
{
$opts
[
'ns'
]
=
''
;
$opts
[
'name'
]
=
$ID
;
}
print
p_locale_xhtml
(
'backlinks'
);
$data
=
array
();
search
(
$data
,
$conf
[
'datadir'
],
'search_backlinks'
,
$opts
);
sort
(
$data
);
$data
=
ft_backlinks
(
$ID
);
print
'<ul class="idx">'
;
foreach
(
$data
as
$
row
){
foreach
(
$data
as
$
blink
){
print
'<li>'
;
print
html_wikilink
(
':'
.
$
row
[
'id'
]
,
$conf
[
'useheading'
]
?
NULL
:
$
row
[
'id'
]
);
print
html_wikilink
(
':'
.
$
blink
,
$conf
[
'useheading'
]
?
NULL
:
$
blink
);
print
'</li>'
;
}
print
'</ul>'
;
...
...
This diff is collapsed.
Click to expand it.
inc/search.php
+
1
−
0
View file @
54f4c056
...
...
@@ -252,6 +252,7 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
* $opts['name'] name of the page without namespace
*
* @author Andreas Gohr <andi@splitbrain.org>
* @deprecated Replaced by ft_backlinks()
*/
function
search_backlinks
(
&
$data
,
$base
,
$file
,
$type
,
$lvl
,
$opts
){
//we do nothing with directories
...
...
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