Removing Any Cached Files Needed For Rendering The PDF
@param params
@param cb
@private
760298
function removeCachedFiles(params, cb) {
  //Cleaning Up Any Files Cached To Render The Submission.
  logger.debug("cacheFiles: mergeSubmissionFiles Removing Cached Files For PDF Generation: ", params.submissionFiles);
  async.eachSeries(params.submissionFiles || [], function(submissionFileDetails, cb) {
    logger.debug("Removing Cached File: ", submissionFileDetails);
    fs.unlink(submissionFileDetails.url, function(err) {
      if (err) {
        logger.error('Error Removing File At' + submissionFileDetails.url);
      }

      return cb();
    });
  }, cb);
}
433698
function middleware(filename, options, cb) {
  var self = this;
  var cache = self.cache;
  var handlebars = self.handlebars;

  self.async = async();

  // grab extension from filename
  // if we need a layout, we will look for one matching out extension
  var extension = path.extname(filename);

  // If passing the locals as data, create the handlebars options object now
  var handlebarsOpts = (self.__localsAsData) ? { data: options._locals } : undefined;

  // render the original file
  // cb(err, str)
  function render_file(locals, cb) {
    // cached?
    var template = cache[filename];
    if (template) {
      return cb(null, template(locals, handlebarsOpts));
    }

    fs.readFile(filename, 'utf8', function(err, str){
      if (err) {
        return cb(err);
      }

      var template = handlebars.compile(str);
      if (locals.cache) {
        cache[filename] = template;
      }

      try {
        var res = template(locals, handlebarsOpts);
        self.async.done(function(values) {
          Object.keys(values).forEach(function(id) {
            res = res.replace(id, values[id]);
          });

          cb(null, res);
        });
      } catch (err) {
        err.message = filename + ': ' + err.message;
        cb(err);
      }
    });
  }

  // render with a layout
  function render_with_layout(template, locals, cb) {
    render_file(locals, function(err, str) {
      if (err) {
        return cb(err);
      }

      locals.body = str;

      var res = template(locals, handlebarsOpts);
      self.async.done(function(values) {
        Object.keys(values).forEach(function(id) {
          res = res.replace(id, values[id]);
        });

        cb(null, res);
      });
    });
  }

  var layout = options.layout;

  // user did not specify a layout in the locals
  // check global layout state
  if (layout === undefined && options.settings && options.settings['view options']) {
    layout = options.settings['view options'].layout;
  }

  // user explicitly request no layout
  // either by specifying false for layout: false in locals
  // or by settings the false view options
  if (layout !== undefined && !layout) {
    return render_file(options, cb);
  }

  var view_dirs = options.settings.views;

  var layout_filename = [].concat(view_dirs).map(function (view_dir) {
    var view_path = path.join(view_dir, layout || 'layout');

    if (!path.extname(view_path)) {
      view_path += extension;
    }

    return view_path;
  });

  var layout_template = layout_filename.reduce(function (cached, filename) {
    if (cached) {
      return cached;
    }

    var cached_file = cache[filename];

    if (cached_file) {
      return cache[filename];
    }

    return undefined;
  }, undefined);

  if (layout_template) {
    return render_with_layout(layout_template, options, cb);
  }

  // TODO check if layout path has .hbs extension

  function cacheAndCompile(filename, str) {
    var layout_template = handlebars.compile(str);
    if (options.cache) {
      cache[filename] = layout_template;
    }

    render_with_layout(layout_template, options, cb);
  }

  function tryReadFileAndCache(templates) {
    var template = templates.shift();

    fs.readFile(template, 'utf8', function(err, str) {
      if (err) {
        if (layout && templates.length === 0) {
          // Only return error if user explicitly asked for layout.
          return cb(err);
        }

        if (templates.length > 0) {
          return tryReadFileAndCache(templates);
        }

        return render_file(options, cb);
      }

      cacheAndCompile(template, str);
    });
  }

  tryReadFileAndCache(layout_filename);
}
227338
function (i, res, files, cb) {
        if (!files.length || files.length == 0) {
            cb(false)
        } else {
            if ( fs.existsSync(files[i].target) ) new _(files[i].target).rmSync();

            var sourceStream = fs.createReadStream(files[i].source);
            var destinationStream = fs.createWriteStream(files[i].target);

            sourceStream
                .pipe(destinationStream)
                .on('error', function () {
                    var err = 'Error on SuperController::copyFile(...): Not found ' + files[i].source + ' or ' + files[i].target;
                    cb(err)
                })
                .on('close', function () {

                    try {
                        fs.unlinkSync(files[i].source);
                        files.splice(i, 1);
                    } catch (err) {
                        cb(err)
                    }

                    movefiles(i, res, files, cb)
                })
        }
    }
809315
function deleteUserPolicy (params, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      const { userId, organizationId, policyId, instance } = params
      const tasks = [
        (job, next) => {
          Joi.validate({ userId, organizationId, policyId, instance }, validationRules.deleteUserPolicy, (err) => {
            if (err) return next(Boom.badRequest(err))
            next()
          })
        },
        (job, next) => {
          job.id = userId
          job.policyId = policyId
          job.organizationId = organizationId
          job.instance = instance

          next()
        },
        checkUserOrg,
        removeUserPolicy
      ]

      db.withTransaction(tasks, (err, res) => {
        if (err) return cb(err)

        userOps.readUser({ id: userId, organizationId }, cb)
      })

      return promise
    }
904730
public void clearPages(ClassLoader cl) {
	Iterator<PageSource> it = this.pageSources.values().iterator();
	PageSourceImpl entry;
	while (it.hasNext()) {
	    entry = (PageSourceImpl) it.next();
	    if (cl != null) entry.clear(cl);
	    else entry.clear();
	}
    }
1194328
private void cleanProperties(Map<String, String> props) {
        if (props != null) {
            props.remove(StorageProvider.PROPERTIES_CONTENT_MD5);
            props.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM);
            props.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED);
            props.remove(StorageProvider.PROPERTIES_CONTENT_SIZE);
            props.remove(HttpHeaders.CONTENT_LENGTH);
            props.remove(HttpHeaders.CONTENT_TYPE);
            props.remove(HttpHeaders.LAST_MODIFIED);
            props.remove(HttpHeaders.DATE);
            props.remove(HttpHeaders.ETAG);
            props.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase());
            props.remove(HttpHeaders.CONTENT_TYPE.toLowerCase());
            props.remove(HttpHeaders.LAST_MODIFIED.toLowerCase());
            props.remove(HttpHeaders.DATE.toLowerCase());
            props.remove(HttpHeaders.ETAG.toLowerCase());
        }
    }
1357840
function compileFile(locals, cb) {
    getSourceTemplate(function(err, source, template) {
      if (err) return cb(err);

      // Try to get the layout
      parseLayout(source, filename, function(err, layoutTemplates) {
        if (err) return cb(err);

        function renderIt(layoutTemplates) {
          if (self._options.beautify) {
            return render(template, locals, layoutTemplates, function(err, html) {
              if (err) return cb(err);
              loadBeautify();
              return cb(null, self.beautify(html, self.beautifyrc));
            });
          }
          return render(template, locals, layoutTemplates, cb);
        }

        // Determine which layout to use

        if (typeof options.layout !== 'undefined' && !options.layout) {
          // If options.layout is falsy, behave as if no layout should be used - suppress defaults
          renderIt(null);
        } else if (layoutTemplates) {
          // 1. Layout specified in template
          renderIt(layoutTemplates);
        } else if (typeof options.layout !== 'undefined' && options.layout) {
          // 2. Layout specified by options from render
          var layoutFile = self.layoutPath(filename, options.layout);
          self.cacheLayout(layoutFile, options.cache, function(err, layoutTemplates) {
            if (err) return cb(err);
            renderIt(layoutTemplates);
          });
        } else if (self.defaultLayoutTemplates) {
          // 3. Default layout specified when middleware was configured.
          renderIt(self.defaultLayoutTemplates);
        } else {
          // render without a template
          renderIt(null);
        }
      });
    });
  }
597047
public final void removeAll(final String paramName) {
        final ParameterList params = getParameters(paramName);
        parameters.removeAll(params.parameters);
    }
239380
function (name, cb) {
                var cache = events[slot] = events[slot] || {};
                cache[name] = cache[name] || [];
                cache[name].push(cb);
            }
573711
@Override
	public void removeByC_C(long classNameId, long classPK) {
		for (CPAttachmentFileEntry cpAttachmentFileEntry : findByC_C(
				classNameId, classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(cpAttachmentFileEntry);
		}
	}
60700
public void processJsCacheRemove(JsCacheRemove jcr, List<String> paramNames, List<String> jsonArgs) {
		logger.debug("Process JsCacheRemove annotation : {}", jcr);
		MessageToClient messageToClient = new MessageToClient();
		messageToClient.setId(Constants.Cache.CLEANCACHE_TOPIC);
		String argpart = cacheArgumentServices.computeArgPart(jcr.keys(), jsonArgs, paramNames);
		String cachekey = computeCacheKey(jcr.cls(), jcr.methodName(), argpart);
		if (logger.isDebugEnabled()) {
			logger.debug("JsonArgs from Call : {}", Arrays.toString(jsonArgs.toArray(new String[jsonArgs.size()])));
			logger.debug("ParamName from considerated method : {}", Arrays.toString(paramNames.toArray(new String[paramNames.size()])));
			logger.debug("Computed key : {}", cachekey);
		}
		messageToClient.setResponse(cachekey);
		if (jcr.userScope()) {
			wsUserEvent.fire(messageToClient);
		} else {
			wsEvent.fire(messageToClient);
			cacheEvent.fire(cachekey);
		}
	}
848254
function deleteIt(fs, p, method, cb) {
    fs.metadata(p)
    .then(function(metadata) {
        if (!metadata.is_dir) {
            throw fs.error('ENOTDIR');
        }

        return fs.list(p)
        .then(function(list) {
            return when.all(list.map(function(metadata) {
                if (metadata.is_dir) {
                    return resolveDelete(fs, p + '/' + metadata.name, method);
                } else {
                    return fs.delete(p + '/' + metadata.name);
                }
            }));
        })
        .then(function() {
            return fs._promise(method, p);
        });
    })
    .done(cb, cb);
}
822218
function trashOrUntrashPages(cb) {
          const ids = tree.map(p => p._id);
          return self.apos.docs.db.update({ _id: { $in: ids } }, action, {
            multi: true
          }, (err, res) => {
            cb(err);
          });
        }
595089
function (str, options, cb) {
    var tmpl = this.cache(options) || this.cache(options, this.engine.compile(str, options));
    tmpl.eval(options, function(str){
      cb(null, str);
    });
  }
766755
@Override
	public void clearCache() {
		entityCache.clearCache(CPAttachmentFileEntryImpl.class);

		finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}
335288
public function clearCachePostProc(array $params, DataHandler &$pObj)
    {
        if (!isset($params['cacheCmd'])) {
            return;
        }
        switch ($params['cacheCmd']) {
            case 'dyncss':
                $pObj->clear_cacheCmd("pages");
                GeneralUtility::rmdir(
                    PATH_site.'typo3temp/Cache/Data/DynCss',
                    true
                );

                GeneralUtility::rmdir(
                    PATH_site.'typo3temp/DynCss',
                    true
                );
                break;
            default:

        }
    }
1228884
function (cb) {
        var sServoReadings = [];
        var read = setInterval(function () {
          sServoReadings.push(sonar.cm);
          if (sServoReadings.length === 10) {
            clearInterval(read);
            console.log(array.avg(sServoReadings));
            cb(null, array.avg(sServoReadings));
          }
        }, 100);
      }