Révision 6ff32cea
Ajouté par Florent Torregrosa il y a environ 9 ans
drupal7/includes/bootstrap.inc | ||
---|---|---|
8 | 8 |
/** |
9 | 9 |
* The current system version. |
10 | 10 |
*/ |
11 |
define('VERSION', '7.35');
|
|
11 |
define('VERSION', '7.36');
|
|
12 | 12 |
|
13 | 13 |
/** |
14 | 14 |
* Core API compatibility. |
... | ... | |
529 | 529 |
* Returns the appropriate configuration directory. |
530 | 530 |
* |
531 | 531 |
* Returns the configuration path based on the site's hostname, port, and |
532 |
* pathname. Uses find_conf_path() to find the current configuration directory. |
|
533 |
* See default.settings.php for examples on how the URL is converted to a |
|
534 |
* directory. |
|
532 |
* pathname. See default.settings.php for examples on how the URL is converted |
|
533 |
* to a directory. |
|
535 | 534 |
* |
536 | 535 |
* @param bool $require_settings |
537 | 536 |
* Only configuration directories with an existing settings.php file |
... | ... | |
1246 | 1245 |
* fresh page on every request. This prevents authenticated users from seeing |
1247 | 1246 |
* locally cached pages. |
1248 | 1247 |
* |
1249 |
* Also give each page a unique ETag. This will force clients to include both |
|
1250 |
* an If-Modified-Since header and an If-None-Match header when doing |
|
1251 |
* conditional requests for the page (required by RFC 2616, section 13.3.4), |
|
1252 |
* making the validation more robust. This is a workaround for a bug in Mozilla |
|
1253 |
* Firefox that is triggered when Drupal's caching is enabled and the user |
|
1254 |
* accesses Drupal via an HTTP proxy (see |
|
1255 |
* https://bugzilla.mozilla.org/show_bug.cgi?id=269303): When an authenticated |
|
1256 |
* user requests a page, and then logs out and requests the same page again, |
|
1257 |
* Firefox may send a conditional request based on the page that was cached |
|
1258 |
* locally when the user was logged in. If this page did not have an ETag |
|
1259 |
* header, the request only contains an If-Modified-Since header. The date will |
|
1260 |
* be recent, because with authenticated users the Last-Modified header always |
|
1261 |
* refers to the time of the request. If the user accesses Drupal via a proxy |
|
1262 |
* server, and the proxy already has a cached copy of the anonymous page with an |
|
1263 |
* older Last-Modified date, the proxy may respond with 304 Not Modified, making |
|
1264 |
* the client think that the anonymous and authenticated pageviews are |
|
1265 |
* identical. |
|
1248 |
* ETag and Last-Modified headers are not set per default for authenticated |
|
1249 |
* users so that browsers do not send If-Modified-Since headers from |
|
1250 |
* authenticated user pages. drupal_serve_page_from_cache() will set appropriate |
|
1251 |
* ETag and Last-Modified headers for cached pages. |
|
1266 | 1252 |
* |
1267 | 1253 |
* @see drupal_page_set_cache() |
1268 | 1254 |
*/ |
... | ... | |
1275 | 1261 |
|
1276 | 1262 |
$default_headers = array( |
1277 | 1263 |
'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT', |
1278 |
'Last-Modified' => gmdate(DATE_RFC7231, REQUEST_TIME), |
|
1279 | 1264 |
'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', |
1280 |
'ETag' => '"' . REQUEST_TIME . '"', |
|
1281 | 1265 |
); |
1282 | 1266 |
drupal_send_headers($default_headers); |
1283 | 1267 |
} |
... | ... | |
1659 | 1643 |
* information about the passed-in exception is used. |
1660 | 1644 |
* @param $variables |
1661 | 1645 |
* Array of variables to replace in the message on display. Defaults to the |
1662 |
* return value of drupal_decode_exception(). |
|
1646 |
* return value of _drupal_decode_exception().
|
|
1663 | 1647 |
* @param $severity |
1664 | 1648 |
* The severity of the message, as per RFC 3164. |
1665 | 1649 |
* @param $link |
1666 | 1650 |
* A link to associate with the message. |
1667 | 1651 |
* |
1668 | 1652 |
* @see watchdog() |
1669 |
* @see drupal_decode_exception() |
|
1653 |
* @see _drupal_decode_exception()
|
|
1670 | 1654 |
*/ |
1671 | 1655 |
function watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $severity = WATCHDOG_ERROR, $link = NULL) { |
1672 | 1656 |
|
... | ... | |
2653 | 2637 |
* |
2654 | 2638 |
* This would include implementations of hook_install(), which could run |
2655 | 2639 |
* during the Drupal installation phase, and might also be run during |
2656 |
* non-installation time, such as while installing the module from the the
|
|
2640 |
* non-installation time, such as while installing the module from the |
|
2657 | 2641 |
* module administration page. |
2658 | 2642 |
* |
2659 | 2643 |
* Example usage: |
... | ... | |
3182 | 3166 |
// This function may get called when the default database is not active, but |
3183 | 3167 |
// there is no reason we'd ever want to not use the default database for |
3184 | 3168 |
// this query. |
3185 |
$file = Database::getConnection('default', 'default')->query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array( |
|
3186 |
':name' => $name, |
|
3187 |
':type' => $type, |
|
3188 |
)) |
|
3169 |
$file = Database::getConnection('default', 'default') |
|
3170 |
->select('registry', 'r', array('target' => 'default')) |
|
3171 |
->fields('r', array('filename')) |
|
3172 |
// Use LIKE here to make the query case-insensitive. |
|
3173 |
->condition('r.name', db_like($name), 'LIKE') |
|
3174 |
->condition('r.type', $type) |
|
3175 |
->execute() |
|
3189 | 3176 |
->fetchField(); |
3190 | 3177 |
|
3191 | 3178 |
// Flag that we've run a lookup query and need to update the cache. |
... | ... | |
3523 | 3510 |
// - The memory limit is greater than the memory required for the operation. |
3524 | 3511 |
return ((!$memory_limit) || ($memory_limit == -1) || (parse_size($memory_limit) >= parse_size($required))); |
3525 | 3512 |
} |
3513 |
|
|
3514 |
/** |
|
3515 |
* Invalidates a PHP file from any active opcode caches. |
|
3516 |
* |
|
3517 |
* If the opcode cache does not support the invalidation of individual files, |
|
3518 |
* the entire cache will be flushed. |
|
3519 |
* |
|
3520 |
* @param string $filepath |
|
3521 |
* The absolute path of the PHP file to invalidate. |
|
3522 |
*/ |
|
3523 |
function drupal_clear_opcode_cache($filepath) { |
|
3524 |
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) { |
|
3525 |
// Below PHP 5.3, clearstatcache does not accept any function parameters. |
|
3526 |
clearstatcache(); |
|
3527 |
} |
|
3528 |
else { |
|
3529 |
clearstatcache(TRUE, $filepath); |
|
3530 |
} |
|
3531 |
|
|
3532 |
// Zend OPcache. |
|
3533 |
if (function_exists('opcache_invalidate')) { |
|
3534 |
opcache_invalidate($filepath, TRUE); |
|
3535 |
} |
|
3536 |
// APC. |
|
3537 |
if (function_exists('apc_delete_file')) { |
|
3538 |
// apc_delete_file() throws a PHP warning in case the specified file was |
|
3539 |
// not compiled yet. |
|
3540 |
// @see http://php.net/apc-delete-file |
|
3541 |
@apc_delete_file($filepath); |
|
3542 |
} |
|
3543 |
} |
Formats disponibles : Unified diff
Update core to 7.36