refactor: global namespace + admin pages UI
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
const Promise = require('bluebird')
|
||||
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||
@@ -10,7 +10,7 @@ const path = require('path')
|
||||
const entryHelper = require('../helpers/entry')
|
||||
|
||||
module.exports = (job) => {
|
||||
return wiki.git.resync().then(() => {
|
||||
return WIKI.git.resync().then(() => {
|
||||
// -> Stream all documents
|
||||
|
||||
let cacheJobs = []
|
||||
@@ -19,7 +19,7 @@ module.exports = (job) => {
|
||||
jobCbStreamDocsResolve = resolve
|
||||
})
|
||||
|
||||
klaw(wiki.REPOPATH).on('data', function (item) {
|
||||
klaw(WIKI.REPOPATH).on('data', function (item) {
|
||||
if (path.extname(item.path) === '.md' && path.basename(item.path) !== 'README.md') {
|
||||
let entryPath = entryHelper.parsePath(entryHelper.getEntryPathFromFullPath(item.path))
|
||||
let cachePath = entryHelper.getCachePath(entryPath)
|
||||
@@ -62,7 +62,7 @@ module.exports = (job) => {
|
||||
|
||||
return jobCbStreamDocs
|
||||
}).then(() => {
|
||||
wiki.logger.info('Git remote repository sync: DONE')
|
||||
WIKI.logger.info('Git remote repository sync: DONE')
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
const Promise = require('bluebird')
|
||||
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||
@@ -8,22 +8,22 @@ const moment = require('moment')
|
||||
const path = require('path')
|
||||
|
||||
module.exports = (job) => {
|
||||
return fs.readdirAsync(wiki.UPLTEMPPATH).then((ls) => {
|
||||
return fs.readdirAsync(WIKI.UPLTEMPPATH).then((ls) => {
|
||||
let fifteenAgo = moment().subtract(15, 'minutes')
|
||||
|
||||
return Promise.map(ls, (f) => {
|
||||
return fs.statAsync(path.join(wiki.UPLTEMPPATH, f)).then((s) => { return { filename: f, stat: s } })
|
||||
return fs.statAsync(path.join(WIKI.UPLTEMPPATH, f)).then((s) => { return { filename: f, stat: s } })
|
||||
}).filter((s) => { return s.stat.isFile() }).then((arrFiles) => {
|
||||
return Promise.map(arrFiles, (f) => {
|
||||
if (moment(f.stat.ctime).isBefore(fifteenAgo, 'minute')) {
|
||||
return fs.unlinkAsync(path.join(wiki.UPLTEMPPATH, f.filename))
|
||||
return fs.unlinkAsync(path.join(WIKI.UPLTEMPPATH, f.filename))
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
})
|
||||
}).then(() => {
|
||||
wiki.logger.info('Purging temporary upload files: DONE')
|
||||
WIKI.logger.info('Purging temporary upload files: DONE')
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user