Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 361... Línea 361...
361
 
361
 
362
    if (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) {
362
    if (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) {
363
        return null;
363
        return null;
Línea 364... Línea 364...
364
    }
364
    }
365
 
365
 
366
    if (!$CFG->debugdisplay) {
366
    if (empty($CFG->debugdisplay)) {
Línea 367... Línea 367...
367
        return null;
367
        return null;
368
    }
368
    }
Línea 874... Línea 874...
874
 * Only to be used only from lib/setup.php
874
 * Only to be used only from lib/setup.php
875
 */
875
 */
876
function initialise_local_config_cache() {
876
function initialise_local_config_cache() {
877
    global $CFG;
877
    global $CFG;
Línea 878... Línea 878...
878
 
878
 
-
 
879
    $bootstraplocalfile = $CFG->localcachedir . '/bootstrap.php';
Línea -... Línea 880...
-
 
880
    $bootstrapsharedfile = $CFG->cachedir . '/bootstrap.php';
-
 
881
 
-
 
882
    if (!is_readable($bootstraplocalfile) && is_readable($bootstrapsharedfile)) {
-
 
883
        // If we don't have a local cache but do have a shared cache then clone it,
-
 
884
        // for example when scaling up new front ends.
-
 
885
        make_localcache_directory('', true);
-
 
886
        copy($bootstrapsharedfile, $bootstraplocalfile);
879
    $bootstrapcachefile = $CFG->localcachedir . '/bootstrap.php';
887
    }
880
 
888
 
881
    if (!empty($CFG->siteidentifier) && !file_exists($bootstrapcachefile)) {
889
    if (!empty($CFG->siteidentifier) && !file_exists($bootstrapsharedfile) && defined('SYSCONTEXTID')) {
882
        $contents = "<?php
890
        $contents = "<?php
883
// ********** This file is generated DO NOT EDIT **********
891
// ********** This file is generated DO NOT EDIT **********
884
\$CFG->siteidentifier = " . var_export($CFG->siteidentifier, true) . ";
892
\$CFG->siteidentifier = " . var_export($CFG->siteidentifier, true) . ";
885
\$CFG->bootstraphash = " . var_export(hash_local_config_cache(), true) . ";
893
\$CFG->bootstraphash = " . var_export(hash_local_config_cache(), true) . ";
886
// Only if the file is not stale and has not been defined.
894
// Only if the file is not stale and has not been defined.
887
if (\$CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) {
895
if (\$CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) {
888
    define('SYSCONTEXTID', ".SYSCONTEXTID.");
896
    define('SYSCONTEXTID', ".SYSCONTEXTID.");
Línea -... Línea 897...
-
 
897
}
889
}
898
";
890
";
899
 
891
 
900
        // Create the central bootstrap first.
892
        $temp = $bootstrapcachefile . '.tmp' . uniqid();
901
        $temp = $bootstrapsharedfile . '.tmp' . uniqid();
-
 
902
        file_put_contents($temp, $contents);
-
 
903
        @chmod($temp, $CFG->filepermissions);
-
 
904
        rename($temp, $bootstrapsharedfile);
-
 
905
 
893
        file_put_contents($temp, $contents);
906
        // Then prewarm the local cache as well.
894
        @chmod($temp, $CFG->filepermissions);
907
        make_localcache_directory('', true);
Línea 895... Línea 908...
895
        rename($temp, $bootstrapcachefile);
908
        copy($bootstrapsharedfile, $bootstraplocalfile);
896
    }
909
    }
Línea 1920... Línea 1933...
1920
            protect_directory($CFG->localcachedir);
1933
            protect_directory($CFG->localcachedir);
1921
        }
1934
        }
1922
        touch($timestampfile);
1935
        touch($timestampfile);
1923
        @chmod($timestampfile, $CFG->filepermissions);
1936
        @chmod($timestampfile, $CFG->filepermissions);
1924
        clearstatcache();
1937
        clearstatcache();
-
 
1938
 
-
 
1939
        // Then prewarm the local boostrap.php file as well.
-
 
1940
        initialise_local_config_cache();
1925
    }
1941
    }
Línea 1926... Línea 1942...
1926
 
1942
 
1927
    if ($directory === '') {
1943
    if ($directory === '') {
1928
        return $CFG->localcachedir;
1944
        return $CFG->localcachedir;