Last active
May 21, 2016 20:30
-
-
Save svendahlstrand/5d2660a5b79a0bdf52d0 to your computer and use it in GitHub Desktop.
Ta bort gamla filer ur SiteVisions filarkiv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals sitevisionUtils, jcrSession, node, java, out*/ | |
(function () { | |
var settings = { | |
date: '2010-01-28' | |
}; | |
var nodeTypeUtil = sitevisionUtils.getNodeTypeUtil(); | |
var file = jcrSession.getNodeByIdentifier(node.toString()); | |
if (nodeTypeUtil.isFile(file)) { | |
var propertyUtil = sitevisionUtils.getPropertyUtil(); | |
var lastModified = propertyUtil.getCalendar(file, 'lastModifiedDate'); | |
if (lastModified) { | |
var instanceCreatorUtil = sitevisionUtils.getInstanceCreatorUtil(); | |
var reference = java.util.Calendar.getInstance(); | |
var sdf = instanceCreatorUtil.getDefaultInstance('java.text.SimpleDateFormat'); | |
sdf.applyPattern('yyyy-MM-dd'); | |
reference.setTime(sdf.parse(settings.date)); | |
if (lastModified.before(reference)) { | |
out.println('Would remove "' + propertyUtil.getString(file, 'displayName') + '" (' + propertyUtil.getString(file, 'lastModifiedDate') + ').'); | |
} | |
} | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment