|
@@ -33,6 +33,7 @@ var Redownload = function() {
|
|
|
function recheckAllFiles(data) {
|
|
|
var startTime = Date.now();
|
|
|
debug('Redownload started');
|
|
|
+
|
|
|
var deferred = Q.defer();
|
|
|
|
|
|
var requestsOffenders = data.toolsResults.phantomas.offenders.requests;
|
|
@@ -43,6 +44,9 @@ var Redownload = function() {
|
|
|
|
|
|
var requestsList = mergeOffenders(requestsOffenders, gzipOffenders, postOffenders, notFoundOffenders, redirectOffenders);
|
|
|
|
|
|
+ var totalCount = requestsList.length;
|
|
|
+ var doneCount = 0;
|
|
|
+
|
|
|
var httpAuth = null;
|
|
|
if (data.params && data.params.options && data.params.options.authUser && data.params.options.authPass) {
|
|
|
httpAuth = {
|
|
@@ -89,6 +93,11 @@ var Redownload = function() {
|
|
|
|
|
|
.then(function(newEntry) {
|
|
|
debug('File %s - Redownloaded, optimized, minified, compressed, analyzed: done', entry.url);
|
|
|
+
|
|
|
+ // For the progress bar
|
|
|
+ doneCount ++;
|
|
|
+ deferred.notify(doneCount/totalCount);
|
|
|
+
|
|
|
callback(null, newEntry);
|
|
|
})
|
|
|
|
|
@@ -745,9 +754,9 @@ var Redownload = function() {
|
|
|
|
|
|
function detectWordPress(requests) {
|
|
|
// Check the first file only
|
|
|
- if (requests[0].isHTML
|
|
|
- && requests[0].weightCheck.bodyBuffer
|
|
|
- && requests[0].weightCheck.bodyBuffer.indexOf('/wp-content/') > 0) {
|
|
|
+ if (requests[0].isHTML &&
|
|
|
+ requests[0].weightCheck.bodyBuffer &&
|
|
|
+ requests[0].weightCheck.bodyBuffer.indexOf('/wp-content/') > 0) {
|
|
|
|
|
|
return true;
|
|
|
}
|