Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-1036

Copy course with coursefolder quota

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 9.3.3
    • Fix Version/s: 9.4.0
    • Component/s: Course
    • Labels:
      None

      Description

      When copying a course whose coursefolder is larger than the default quota, the author has to contact an administrator for adjusting the quota. This patch enhances the copy routine by copying the quota of the source course also.

      diff -r 8d9b24c8bd51 src/main/java/org/olat/course/CourseFactory.java
      --- a/src/main/java/org/olat/course/CourseFactory.java	Fri Feb 28 16:00:47 2014 +0100
      +++ b/src/main/java/org/olat/course/CourseFactory.java	Fri Mar 21 15:13:46 2014 +0100
      @@ -41,6 +41,7 @@
       import java.util.zip.ZipOutputStream;
       
       import org.apache.poi.util.IOUtils;
      +import org.olat.admin.quota.QuotaConstants;
       import org.olat.basesecurity.BaseSecurity;
       import org.olat.basesecurity.BaseSecurityManager;
       import org.olat.basesecurity.Constants;
      @@ -94,8 +95,11 @@
       import org.olat.core.util.resource.OresHelper;
       import org.olat.core.util.tree.TreeVisitor;
       import org.olat.core.util.tree.Visitor;
      +import org.olat.core.util.vfs.Quota;
      +import org.olat.core.util.vfs.QuotaManager;
       import org.olat.core.util.vfs.VFSConstants;
       import org.olat.core.util.vfs.VFSContainer;
      +import org.olat.core.util.vfs.VFSManager;
       import org.olat.core.util.vfs.VFSStatus;
       import org.olat.core.util.xml.XStreamHelper;
       import org.olat.course.archiver.ScoreAccountingHelper;
      @@ -522,6 +526,17 @@
       					DBFactory.getInstance(false).intermediateCommit();
       				}
       			}
      +			
      +			// set quotas
      +			Quota sourceQuota = VFSManager.isTopLevelQuotaContainer(sourceCourse.getCourseFolderContainer());
      +			Quota targetQuota = VFSManager.isTopLevelQuotaContainer(targetCourse.getCourseFolderContainer());
      +			if (sourceQuota != null && targetQuota != null) {
      +				QuotaManager qm = QuotaManager.getInstance();
      +				if (sourceQuota.getQuotaKB() != qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE).getQuotaKB()) {
      +					targetQuota = qm.createQuota(targetQuota.getPath(), sourceQuota.getQuotaKB(), sourceQuota.getUlLimitKB());
      +					qm.setCustomQuotaKB(targetQuota);
      +				}
      +			}
       		}
       		return targetRes;			
       	}
      

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Tester:
            Kirsten Scherer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m