Skip to content

Instantly share code, notes, and snippets.

@marktriggs
Created September 2, 2014 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marktriggs/53f589d1eaf7b0a18254 to your computer and use it in GitHub Desktop.
Save marktriggs/53f589d1eaf7b0a18254 to your computer and use it in GitHub Desktop.
diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java
index 24b75f2..d4d5d66 100644
--- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java
+++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java
@@ -913,8 +913,13 @@ SiteContentAdvisorProvider, SiteContentAdvisorTypeRegistry, EntityTransferrerRef
m_bodyPathDeleted = null;
}
}
+ } else {
+ if (m_bodyPath != null) {
+ M_log.info("m_bodyPathDeleted is not set as a property. Please set with the property: bodyPathDeleted@org.sakaiproject.content.api.ContentHostingService if you want to allow for deletion of resources");
+ }
}
+
StringBuilder buf = new StringBuilder();
if (m_bodyVolumes != null)
{
diff --git a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java
index 3fa0713..3549264 100644
--- a/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java
+++ b/kernel/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java
@@ -1885,6 +1885,7 @@ public class DbContentService extends BaseContentService
// if we have been configured to use an external file system
if (m_bodyPath != null)
{
+ if (m_bodyPathDeleted != null) {
// form the file name
File file = new File(externalResourceFileName(m_bodyPathDeleted, edit));
@@ -1894,6 +1895,7 @@ public class DbContentService extends BaseContentService
file.delete();
}
}
+ }
// otherwise use the database
else
@@ -1967,6 +1969,10 @@ public class DbContentService extends BaseContentService
*/
public void commitDeletedResource(ContentResourceEdit edit, String uuid) throws ServerOverloadException
{
+
+ if (m_bodyPathDeleted == null) {
+ return;
+ }
boolean goin = in();
try
{
@@ -2453,7 +2459,7 @@ public class DbContentService extends BaseContentService
// write the file
out = new FileOutputStream(file);
- int byteCount = 0;
+ long byteCount = 0;
// chunk
byte[] chunk = new byte[STREAM_BUFFER_SIZE];
int lenRead;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment