<?php
function _drupal_bootstrap($phase) {
global $conf;
switch ($phase) {
case DRUPAL_BOOTSTRAP_CONFIGURATION:
drupal_unset_globals();
// Start a page timer:
timer_start('page');
// Initialize the configuration
conf_init();
break;
case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
// Allow specifying special cache handlers in settings.php, like
// using memcached or files for storing cache information.
require_once variable_get('cache_inc', './includes/cache.inc');
// If the page_cache_fastpath is set to TRUE in settings.php and
// page_cache_fastpath (implemented in the special implementation of
// cache.inc) printed the page and indicated this with a returned TRUE
// then we are done.
if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) {
exit;
}
break;
?>
Ở Drupal 6, quá trình bootstrap được chia thành 9 bước và bước 2 là bước sẽ kiểm tra hệ thống cache trước khi kết nối CSDL. Khi biến page_cache_fastpath được gán giá trị TRUE thì hàm page_cache_fastpath() sẽ được gọi và trả về kết quả request cho trình duyệt. Vậy khi set page_cache_fastpath thành TRUE thì điều gì sẽ xãy ra.
Fatal error: Call to undefined function page_cache_fastpath() in /var/www/sandbox/drupal-6.16/includes/bootstrap.inc on line 1014
Ở Drupal 6 việc đưa thêm điều kiện kiểm tra page_cache_fastpath là để cho các developer khác có thể implement những cache khác, một số xử lý riêng ngoài cache mặc định của Drupal. Nghĩa là những ai muốn đưa cache riêng của mình, hoặc thêm một số xử lý có thể định nghĩa thêm ở hàm page_cache_fastpath() và set biến page_cache_fastpath trở thành TRUE.
Hàm page_cache_fastpath() có thể xử lý gì đó tùy thích:
<?php
function page_cache_fastpath() {
// làm gì tùy thích
}
?>
Xem thêm module http://drupal.org/project/cacherouter về cách implement page_cache_fastpath.
Add your comment