MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / backupIndexFile

Function backupIndexFile

bin/lib/invalidUsernames.mjs:36–48  ·  view source on GitHub ↗
(username, accountManager, invalidUsernameTemplate, dateOfRemoval, supportEmail)

Source from the content-addressed store, hash-verified

34}
35
36function backupIndexFile (username, accountManager, invalidUsernameTemplate, dateOfRemoval, supportEmail) {
37 const userDirectory = accountManager.accountDirFor(username)
38 const currentIndex = path.join(userDirectory, 'index.html')
39 const currentIndexExists = fs.existsSync(currentIndex)
40 const backupIndex = path.join(userDirectory, 'index.backup.html')
41 const backupIndexExists = fs.existsSync(backupIndex)
42 if (currentIndexExists && !backupIndexExists) {
43 fs.renameSync(currentIndex, backupIndex)
44 createNewIndexAcl(userDirectory)
45 createNewIndex(username, invalidUsernameTemplate, dateOfRemoval, supportEmail, currentIndex)
46 console.info(`index.html updated for user ${username}`)
47 }
48}
49
50function createNewIndex (username, invalidUsernameTemplate, dateOfRemoval, supportEmail, currentIndex) {
51 const newIndexSource = invalidUsernameTemplate({

Callers 1

updateIndexFilesFunction · 0.85

Calls 3

createNewIndexAclFunction · 0.85
createNewIndexFunction · 0.85
accountDirForMethod · 0.80

Tested by

no test coverage detected