Skip to content

Commit 1feff7a

Browse files
authored
Merge pull request #1477 from owncloud/fix_orphans
Remove and fix all orphaned files in admin and dev docs
2 parents 4b8fea4 + 66a6ab6 commit 1feff7a

File tree

224 files changed

+25
-24232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+25
-24232
lines changed

ext-antora/find-orphaned-files.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
/**
44
* Find Orphaned Files Extension.
5-
* Version 1.0.0
5+
* Version 1.0.1
66
*
77
* @param {Object} config configuration object - Configuration provided by site.yml
88
* @param {Bool} config.printavailable - Print available components/versions first
9-
* @param {Bool} config.printavailable - Print available components/versions first
109
* @param {String} config.stopafterfind - Stop build process after extension has run
10+
* @param {String} config.falsepositives - Ignore files collected in a file, 'modules/...'
1111
* @param {Array<string>} [config.excludeextension] - Extensions to exclude from detection ['.png', ...]
1212
* @param {Array<string>} [config.pathfilter] - Strings to exclude from detection ['modules/ROOT', ...]
1313
* @param {Array<string>} [config.excludecomponents]- Components to exclude from detection ['my_comp', ...]
@@ -98,6 +98,9 @@ module.exports.register = function ({config}) {
9898
console.log('\n')
9999
console.log('# ' + component, version, '\n')
100100

101+
// get ALL files from the content catalog, which is a list of files that Antora
102+
// identifies on the filesystem to be considered for the docs build process
103+
// remove those files we do not want to be part of
101104
const allFiles = get_all_files (contentCatalog, extensionToIgnore, pathsToIgnore)
102105
// allFiles.forEach(element => console.log(element))
103106

@@ -118,12 +121,14 @@ module.exports.register = function ({config}) {
118121
const navFiles = get_all_nav_files (nav)
119122
// navFiles.forEach(element => console.log(element))
120123

124+
// this are all unique files that get referenced by authors inside docs
121125
// collect all references into an array to sort before adding to the set
122126
const coll = []
123127
pageReferences.forEach((element) => coll.push(element))
124128
partialReferences.forEach((element) => coll.push(element))
125129
navReferences.forEach((element) => coll.push(element))
126130
// coll.sort().forEach(element => console.log(element))
131+
127132
const allUniqueReferences = new Set(coll.sort())
128133
// allUniqueReferences.forEach(element => console.log(element))
129134

@@ -136,6 +141,8 @@ module.exports.register = function ({config}) {
136141
// allFilesNoNavNoFalsePositives.forEach(element => console.log(element))
137142

138143
// remove found unique references from allFilesNoNavNoFalsePositives list
144+
// the list of (a) allFilesNoNavNoFalsePositives is the base we substract (b) allUniqueReferences from
145+
// ideally, this lists are equal and no remaining elements are found
139146
const orphandArray = setDifference(allFilesNoNavNoFalsePositives, allUniqueReferences)
140147
// orphandArray.forEach(element => console.log(element))
141148

@@ -163,8 +170,8 @@ module.exports.register = function ({config}) {
163170
* we could make it shorter, but the we cant debug it
164171
*
165172
* @param {set} a_set the first set
166-
* @param {set} b_set the secon set
167-
* @return {set} d_set the difference between a and b
173+
* @param {set} b_set the second set
174+
* @return {set} d_set the difference between a and b (a_minus_b)
168175
*/
169176
function setDifference(a_set, b_set) {
170177
const d_set = new Set(Array.from(a_set).filter(x => {
@@ -245,7 +252,7 @@ function get_all_files (contentCatalog, extensionToIgnore, pathsToIgnore) {
245252
return item.includes(str) // return and exit some if true
246253
})
247254
if (!found && item != 'undefined') { // only if found and not the string 'undefined'
248-
ex_files.push(item)
255+
ex_files.push(item.trim())
249256
}
250257
})
251258

@@ -395,7 +402,7 @@ function get_path_objects (pages, rg, fam_dir_arr, dir_sep, x) {
395402

396403
// the path is on the last location, see splice
397404
for (let i=0; i < objectReferences.length; i++) {
398-
uniqueObjectRefernces.add(objectReferences[i][2])
405+
uniqueObjectRefernces.add(objectReferences[i][2].trim())
399406
}
400407

401408
return uniqueObjectRefernces

false-positives.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33

44
modules/admin_manual/examples/configuration/ldap/Multi-AD.slapd.conf
55
modules/admin_manual/examples/configuration/ldap/single.slapd.conf
6-
modules/admin_manual/images/configuration/files/create_public_share-10.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-5.4 KB
Binary file not shown.
-34.5 KB
Binary file not shown.

modules/admin_manual/images/configuration/files/external_storage/google_drive/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)