Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 1183... Línea 1183...
1183
 * Purges the cache areas specified.  By default, this will purge all caches but can selectively purge specific
1183
 * Purges the cache areas specified.  By default, this will purge all caches but can selectively purge specific
1184
 * areas alone or in combination.
1184
 * areas alone or in combination.
1185
 *
1185
 *
1186
 * @param bool[] $options Specific parts of the cache to purge. Valid options are:
1186
 * @param bool[] $options Specific parts of the cache to purge. Valid options are:
1187
 *        'muc'    Purge MUC caches?
1187
 *        'muc'    Purge MUC caches?
-
 
1188
 *        'courses' Purge all course caches, or specific course caches (CLI only)
1188
 *        'theme'  Purge theme cache?
1189
 *        'theme'  Purge theme cache?
1189
 *        'lang'   Purge language string cache?
1190
 *        'lang'   Purge language string cache?
1190
 *        'js'     Purge javascript cache?
1191
 *        'js'     Purge javascript cache?
1191
 *        'filter' Purge text filter cache?
1192
 *        'filter' Purge text filter cache?
1192
 *        'other'  Purge all other caches?
1193
 *        'other'  Purge all other caches?
Línea 1198... Línea 1199...
1198
    } else {
1199
    } else {
1199
        $options = array_merge($defaults, array_intersect_key($options, $defaults)); // Override defaults with specified options.
1200
        $options = array_merge($defaults, array_intersect_key($options, $defaults)); // Override defaults with specified options.
1200
    }
1201
    }
1201
    if ($options['muc']) {
1202
    if ($options['muc']) {
1202
        cache_helper::purge_all();
1203
        cache_helper::purge_all();
1203
    }
-
 
1204
    if ($options['courses']) {
1204
    } else if ($options['courses']) {
1205
        if ($options['courses'] === true) {
1205
        if ($options['courses'] === true) {
1206
            $courseids = [];
1206
            $courseids = [];
1207
        } else {
1207
        } else {
1208
            $courseids = preg_split('/\s*,\s*/', $options['courses'], -1, PREG_SPLIT_NO_EMPTY);
1208
            $courseids = preg_split('/\s*,\s*/', $options['courses'], -1, PREG_SPLIT_NO_EMPTY);
1209
        }
1209
        }
Línea 1260... Línea 1260...
1260
    // This is the only place where we purge local caches, we are only adding files there.
1260
    // This is the only place where we purge local caches, we are only adding files there.
1261
    // The $CFG->localcachedirpurged flag forces local directories to be purged on cluster nodes.
1261
    // The $CFG->localcachedirpurged flag forces local directories to be purged on cluster nodes.
1262
    remove_dir($CFG->localcachedir, true);
1262
    remove_dir($CFG->localcachedir, true);
1263
    set_config('localcachedirpurged', time());
1263
    set_config('localcachedirpurged', time());
1264
    make_localcache_directory('', true);
1264
    make_localcache_directory('', true);
-
 
1265
 
-
 
1266
    // Rewarm the bootstrap.php files so the siteid is always present after a purge.
-
 
1267
    initialise_local_config_cache();
1265
    \core\task\manager::clear_static_caches();
1268
    \core\task\manager::clear_static_caches();
1266
}
1269
}
Línea 1267... Línea 1270...
1267
 
1270
 
1268
/**
1271
/**
Línea 4354... Línea 4357...
4354
 * Updating the password will modify the $user object and the database
4357
 * Updating the password will modify the $user object and the database
4355
 * record to use the current hashing algorithm.
4358
 * record to use the current hashing algorithm.
4356
 * It will remove Web Services user tokens too.
4359
 * It will remove Web Services user tokens too.
4357
 *
4360
 *
4358
 * @param stdClass $user User object (password property may be updated).
4361
 * @param stdClass $user User object (password property may be updated).
4359
 * @param string $password Plain text password.
4362
 * @param string|null $password Plain text password.
4360
 * @param bool $fasthash If true, use a low cost factor when generating the hash
4363
 * @param bool $fasthash If true, use a low cost factor when generating the hash
4361
 *                       This is much faster to generate but makes the hash
4364
 *                       This is much faster to generate but makes the hash
4362
 *                       less secure. It is used when lots of hashes need to
4365
 *                       less secure. It is used when lots of hashes need to
4363
 *                       be generated quickly.
4366
 *                       be generated quickly.
4364
 * @return bool Always returns true.
4367
 * @return bool Always returns true.
4365
 */
4368
 */
4366
function update_internal_user_password(
4369
function update_internal_user_password(
4367
        stdClass $user,
4370
        stdClass $user,
4368
        #[\SensitiveParameter] string $password,
4371
        #[\SensitiveParameter] ?string $password,
4369
        bool $fasthash = false
4372
        bool $fasthash = false
4370
): bool {
4373
): bool {
4371
    global $CFG, $DB;
4374
    global $CFG, $DB;
Línea 4372... Línea 4375...
4372
 
4375