mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Extract lastmodified from handler.
This commit is contained in:
parent
2797c2fc5b
commit
d6d4178dbc
1 changed files with 45 additions and 37 deletions
|
@ -78,43 +78,11 @@ function _handle(req, res, jsFilename, jsFiles) {
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
//find out the highest modification date
|
//find out the highest modification date
|
||||||
function(callback)
|
function (callback) {
|
||||||
{
|
lastModifiedDate(function (date) {
|
||||||
var folders2check = [CSS_DIR, JS_DIR];
|
latestModification = date;
|
||||||
|
callback()
|
||||||
//go trough this two folders
|
});
|
||||||
async.forEach(folders2check, function(path, callback)
|
|
||||||
{
|
|
||||||
//read the files in the folder
|
|
||||||
fs.readdir(path, function(err, files)
|
|
||||||
{
|
|
||||||
if(ERR(err, callback)) return;
|
|
||||||
|
|
||||||
//we wanna check the directory itself for changes too
|
|
||||||
files.push(".");
|
|
||||||
|
|
||||||
//go trough all files in this folder
|
|
||||||
async.forEach(files, function(filename, callback)
|
|
||||||
{
|
|
||||||
//get the stat data of this file
|
|
||||||
fs.stat(path + "/" + filename, function(err, stats)
|
|
||||||
{
|
|
||||||
if(ERR(err, callback)) return;
|
|
||||||
|
|
||||||
//get the modification time
|
|
||||||
var modificationTime = stats.mtime.getTime();
|
|
||||||
|
|
||||||
//compare the modification time to the highest found
|
|
||||||
if(modificationTime > latestModification)
|
|
||||||
{
|
|
||||||
latestModification = modificationTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}, callback);
|
|
||||||
});
|
|
||||||
}, callback);
|
|
||||||
},
|
},
|
||||||
function(callback)
|
function(callback)
|
||||||
{
|
{
|
||||||
|
@ -280,6 +248,46 @@ function getAceFile(callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lastModifiedDate(callback) {
|
||||||
|
var folders2check = [CSS_DIR, JS_DIR];
|
||||||
|
var latestModification = 0;
|
||||||
|
//go trough this two folders
|
||||||
|
async.forEach(folders2check, function(path, callback)
|
||||||
|
{
|
||||||
|
//read the files in the folder
|
||||||
|
fs.readdir(path, function(err, files)
|
||||||
|
{
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
|
//we wanna check the directory itself for changes too
|
||||||
|
files.push(".");
|
||||||
|
|
||||||
|
//go trough all files in this folder
|
||||||
|
async.forEach(files, function(filename, callback)
|
||||||
|
{
|
||||||
|
//get the stat data of this file
|
||||||
|
fs.stat(path + "/" + filename, function(err, stats)
|
||||||
|
{
|
||||||
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
|
//get the modification time
|
||||||
|
var modificationTime = stats.mtime.getTime();
|
||||||
|
|
||||||
|
//compare the modification time to the highest found
|
||||||
|
if(modificationTime > latestModification)
|
||||||
|
{
|
||||||
|
latestModification = modificationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}, callback);
|
||||||
|
});
|
||||||
|
}, function () {
|
||||||
|
callback(latestModification);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
exports.requireDefinition = requireDefinition;
|
exports.requireDefinition = requireDefinition;
|
||||||
function requireDefinition() {
|
function requireDefinition() {
|
||||||
return 'var require = ' + RequireKernel.kernelSource + ';\n';
|
return 'var require = ' + RequireKernel.kernelSource + ';\n';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue