Created
May 8, 2018 00:19
-
-
Save phette23/5ded48ef3df4d677a1355e3e5abd70a5 to your computer and use it in GitHub Desktop.
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
// check if an item's staging directory contains the same files as its persistent storage does | |
function log(msg) { | |
logger.log(currentItem.getUuid() + "/" + currentItem.getVersion() + " LOGGER: " + msg); | |
} | |
// use staging API to check those files | |
if (staging.isAvailable()) { | |
var stagingFilesAndDirs = staging.listFiles("", "**"); | |
for(var i = 0; i < stagingFilesAndDirs.size(); i++) { | |
log(stagingFilesAndDirs.get(i)); | |
} | |
} else { | |
log('ERROR, staging not available') | |
} | |
var filestore = "/mnt/equelladata01/Institutions/cca2012/Attachments/" | |
// List the files in the persistent folder | |
log("Listing the item's persistent files:") | |
var hash = currentItem.getUuid().hashCode() & 127 | |
var persistentStoragePath = filestore + hash + "/" + currentItem.getUuid() + "/" + currentItem.getVersion() | |
var cmd = system.execute("ls", [persistentStoragePath]) | |
var stderr = cmd.getErrorOutput() | |
var stdout = cmd.getStandardOutput() | |
if (stderr != '') log('ERROR - ' + stderr) | |
if (stdout != '') log('Files - ' + stdout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment