Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 53... Línea 53...
53
    /**
53
    /**
54
     * Constructor for the expired_contexts_manager.
54
     * Constructor for the expired_contexts_manager.
55
     *
55
     *
56
     * @param   \progress_trace $trace
56
     * @param   \progress_trace $trace
57
     */
57
     */
58
    public function __construct(\progress_trace $trace = null) {
58
    public function __construct(?\progress_trace $trace = null) {
59
        if (null === $trace) {
59
        if (null === $trace) {
60
            $trace = new \null_progress_trace();
60
            $trace = new \null_progress_trace();
61
        }
61
        }
Línea 62... Línea 62...
62
 
62
 
Línea 121... Línea 121...
121
        $orphaned = $DB->get_recordset_sql($sql);
121
        $orphaned = $DB->get_recordset_sql($sql);
122
        foreach ($orphaned as $orphan) {
122
        foreach ($orphaned as $orphan) {
123
            $expiredcontext = new expired_context(0, $orphan);
123
            $expiredcontext = new expired_context(0, $orphan);
124
            $expiredcontext->delete();
124
            $expiredcontext->delete();
125
        }
125
        }
-
 
126
        $orphaned->close();
Línea 126... Línea 127...
126
 
127
 
127
        // Delete any child of a user context.
128
        // Delete any child of a user context.
128
        $parentpath = $DB->sql_concat('ctxuser.path', "'/%'");
129
        $parentpath = $DB->sql_concat('ctxuser.path', "'/%'");
129
        $params = [
130
        $params = [
Línea 141... Línea 142...
141
        $userchildren = $DB->get_recordset_sql($sql, $params);
142
        $userchildren = $DB->get_recordset_sql($sql, $params);
142
        foreach ($userchildren as $child) {
143
        foreach ($userchildren as $child) {
143
            $expiredcontext = new expired_context(0, $child);
144
            $expiredcontext = new expired_context(0, $child);
144
            $expiredcontext->delete();
145
            $expiredcontext->delete();
145
        }
146
        }
-
 
147
        $userchildren->close();
146
    }
148
    }
Línea 147... Línea 149...
147
 
149
 
148
    /**
150
    /**
149
     * Get the full nested set of expiry data relating to all contexts.
151
     * Get the full nested set of expiry data relating to all contexts.