Commit 0a6860a9 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1503103: Making sure the correct quota is set



behatnotneeded

Change-Id: I1aa52a076843ff0dc4dcaf86a01e76b9673885b5
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5dc7fb73
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1581,6 +1581,9 @@ class LiveUser extends User {
     * should be occasionally reloaded into the session.
     */
    public function reload_background_fields() {
        if ($this->id == '0') {
            return;
        }
        $reload = array(
            'active', 'deleted', 'expiry', 'expirymailsent', 'inactivemailsent', 'suspendedctime', 'suspendedreason',
            'suspendedcusr', 'quota', 'unread',
+11 −4
Original line number Diff line number Diff line
@@ -2342,6 +2342,12 @@ function addfriend_submit(Pieform $form, $values) {
function create_user($user, $profile=array(), $institution=null, $remoteauth=null, $remotename=null, $accountprefs=array(), $quickhash=false) {
    db_begin();

    if (!empty($institution)) {
        if (is_string($institution)) {
            $institution = new Institution($institution);
        }
    }

    if ($user instanceof User) {
        $user->create();
        $user->quota_init();
@@ -2356,7 +2362,11 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
            $user->urlid = get_new_profile_urlid($user->urlid);
        }
        if (empty($user->quota)) {
            $user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
            $quota = get_config_plugin('artefact', 'file', 'defaultquota');
            if (!empty($institution) && !empty($institution->quota)) {
                $quota = min($quota, $institution->quota);
            }
            $user->quota = $quota;
        }
        if (get_config('defaultaccountlifetime')) {
            // we need to set the user expiry to the site default one
@@ -2382,9 +2392,6 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
    }

    if (!empty($institution)) {
        if (is_string($institution)) {
            $institution = new Institution($institution);
        }
        if ($institution->name != 'mahara') {
            $institution->addUserAsMember($user); // uses $user->newuser
            if (empty($accountprefs['licensedefault'])) {