X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProjectInserter.java;h=b328527f5079a7a8dc6759862a02d0002c0f61e5;hb=e47e15fdbb7515f5a3757c3f5df8c1d0950aee8e;hp=f447eedfa470ff930ea6672b474566ccbbaa277e;hpb=711bb81416f6055a66f8aa9d49e140225ee8352b;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/ProjectInserter.java b/src/de/todesbaum/jsite/application/ProjectInserter.java index f447eed..b328527 100644 --- a/src/de/todesbaum/jsite/application/ProjectInserter.java +++ b/src/de/todesbaum/jsite/application/ProjectInserter.java @@ -1,5 +1,5 @@ /* - * jSite - ProjectInserter.java - Copyright © 2006–2011 David Roden + * jSite - ProjectInserter.java - Copyright © 2006–2012 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,8 +28,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -280,13 +280,13 @@ public class ProjectInserter implements FileScannerListener, Runnable { String filename = file.getFilename(); FileOption fileOption = project.getFileOption(filename); if (fileOption.isInsert()) { + fileOption.setCurrentHash(file.getHash()); /* check if file was modified. */ - if (file.getHash().equals(fileOption.getLastInsertHash())) { + if (!fileOption.isForceInsert() && file.getHash().equals(fileOption.getLastInsertHash())) { /* only insert a redirect. */ logger.log(Level.FINE, String.format("Inserting redirect to edition %d for %s.", fileOption.getLastInsertEdition(), filename)); return new RedirectFileEntry(filename, fileOption.getMimeType(), "SSK@" + project.getRequestURI() + "/" + project.getPath() + "-" + fileOption.getLastInsertEdition() + "/" + filename); } - fileOption.setCurrentHash(file.getHash()); try { long[] fileLength = new long[1]; InputStream fileEntryInputStream = createFileInputStream(filename, fileOption, edition, fileLength); @@ -297,8 +297,6 @@ public class ProjectInserter implements FileScannerListener, Runnable { } else { if (fileOption.isInsertRedirect()) { fileEntry = new RedirectFileEntry(filename, fileOption.getMimeType(), fileOption.getCustomKey()); - } else { - fileOption.setLastInsertHash(""); } } return fileEntry; @@ -466,7 +464,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { int newEdition = Integer.parseInt(editionPart); project.setEdition(newEdition); project.setLastInsertionTime(System.currentTimeMillis()); - project.copyHashes(); + project.onSuccessfulInsert(); } fireProjectInsertFinished(success, cancelled ? new AbortedException() : (disconnected ? new IOException("Connection terminated") : null)); }