Drupal 6.19 运行流程(从上到下依次执行)
第一步
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
设置解开层数DRUPAL_BOOTSTRAP_FULL,用drupal bootstrap的while循环逐层解开
第一层:初始化
1、 drupal_unset_globals() 清除除定义内(如$_GET)之外的所有全局变量
2、 timer_start('page'):初始化页面开始执行的时间戳
3、 conf_init():阻挡不正常$_SERVER环境访问;加载数据库配置数据;生成$base_url、$base_root、$base_path变量;生成$session_name,$cookie_domain变量
第二层:加载cache.inc定义函数
1、require_once variable_get('cache_inc', './includes/cache.inc')
第三层:数据库加载准备
1、 require_once './includes/database.inc';
2、 db_set_active():$db_url为空则跳转到安装地址,根据指定的数据库类型加载相关的数据库操作函数库并连接数据库
3、 lock_init():初始化$locks=array(); // like those using APC or memcached
4、
第四层:禁止IP
阻止被屏蔽IP的用户访问
第五层:session准备
session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc'); 改变session的存储位置到数据库中,启动session
第六层:获取页面缓存数据
1、 获取所有variable_get数据
2、 判断是否开启了页面缓存设置。A) 如果开启了:则获取页面缓存,输出(Header指定不浏览器缓存数据),然后执行module定义的exit函数并结束页面的往下执行动作,此时页面运行结束;如果没有页面缓存则继续往下执行。B) 如果没有开启,则执行所有boot接口,进入下一步;
第七层:初始化语言包
drupal_init_language();加载语言(个人设置,全局设置语言的判断加载)
第八层:分析$_GET[‘q’]路径
根据$_GET[‘q’]找到真实路径并更新$_GET[‘q’]真实值
第九层:加载公共函数和文件,载入所有开启的module文件
require_once './includes/common.inc';
require_once './includes/theme.inc';
require_once './includes/pager.inc';
require_once './includes/menu.inc';
require_once './includes/tablesort.inc';
require_once './includes/file.inc';
require_once './includes/unicode.inc';
require_once './includes/image.inc';
require_once './includes/form.inc';
require_once './includes/mail.inc';
require_once './includes/actions.inc';
set_error_handler('drupal_error_handler');
drupal_set_header('Content-Type: text/html; charset=utf-8');
载入所有Module文件
第二步
判断是否网站处理关闭状态
分析第八层更新过的$_GET[‘q’]变量并判断权限后执行。如果路径错误或者没有权限,则返回错误提示;如果正常则调用执行相关的调用数据函数获取原始数据并找到对应模板进行整合(这一步详细流程图如下)
第三步
判断是否开启页面缓存,如果开启了则把该页面数据打包存储在cache表中,给下次浏览该页面时提供页面缓存数据。
最后执行所有exit()函数
结束
搭建Drupal的过程中,需要注意哪些地方可以降低运行的时间?
a:因为模组是每次浏览都需要加载,所以模组尽可能少,文件不要划分太多个
b:如果有复杂的sql查询语句,最好把结果进行数据缓存
c:开启后台性能中的css,js压缩优化选项
Drupal内核有没有可能一些部分进行适当修改,从而增加drupal的性能?
Drupal的数据总是存储在数据库中,每次运行必然会执行很多数据库操作,影响性能
有些部分可以尝试用文件缓存、内存缓存或者sqllit代替
为何Drupal长时间不运行后首次执行的时间会较大,紧接着再次刷新时间会降低50-60%的时间?(因为没有缓存,应该不存在两次执行的时间差异这么大)
我觉得应该是多花费在打开表的动作时间里。做过几次测试:发现在大多数常用表被打开的情况下每次运行的速度都相差不到多少,过段时间表自己被关闭,打开的表个数为0或很少,这次访问就会速度明显变慢
根据devel测试的结果,主要数据库读取次数非常多的是在得到Node数据后循环逐个获取相关的数据的过程(主要动作是:node_load,drupal_lookup_path,taxonomy_node_get_terms,upload_load,_print_set_node_fields,_print_mail_set_node_fields,cache_get,statistics_get,drupal_lookup_path,templates_preprocess_node)。时间平均占用了总时间的60-80%。权限判断只用到一次操作数据库应该不会太耗性能
分享到:
相关推荐
学习的好帮手 这里是drupal-6.19.rar,下载以后很好安装,可以在iis下安装
介绍了apache2.2.14+mysql5.1.3+php5.2.9+phpmyadmin3.7.1+drupal6.19 的全部安装过程
包含:Drupal7宝典; Drupal开发指南; Using Drupal(强烈推荐) 值得你下载!
Drupal专业开发指南 不用介绍了把,你懂的
Drupal dataDrupal data
"Enterprise Drupal 8 Development: For Advanced Projects and Large Development Teams" English | ISBN: 1484202546 | 2017 | 309 pages | PDF | 9 MB Successfully architect a Drupal 8 website that scales ...
Decoupled Drupal in Practice: Architect and Implement Decoupled Drupal Architectures Across the Stack By 作者: Preston So ISBN-10 书号: 1484240715 ISBN-13 书号: 9781484240717 Edition 版本: 1st ed. ...
drupal6的安装,drupal6的安装drupal6的安装drupal6的安装
drupal7 vs drupal6 详细的列出了从drupal6升级到drupal7所做的一些改动。 从代码,配置,UI,API等全方面的诠释drupal7与drupal6 的不同之处。
drupal学习资料包 内含十五个资料 Beginning Drupal 7.pdf Drupal 6 Social Network.rar ...drupal源码分析.docx Drupal详细介绍.pdf Pro Drupal Development 2nd Edition.pdf 零起点学习Drupal教程.pdf
drupal模块开发分析,方便想要drupal模块开发的朋友
Beginning Drupal 8 teaches you how to build, maintain, and manage Drupal 8-based web sites. The book covers what Drupal is, using Drupal when building a new web site, installing and configuring Drupal...
Ideal for experienced Drupal developers, this book takes you through RWD basics and shows you how to build sites based on Aurora, Zen, and Omega—three popular base themes created by Drupal ...
Write a Drupal 8 module with custom functionality and hook into various extension points Master numerous Drupal 8 sub-systems and APIs Model, store, and manipulate data in various ways and for various...
零起点学习Drupal教程零起点学习Drupal教程零起点学习Drupal教程
Drupal 7 高级开发第三版 Drupal7专业开发指南
Drupal专业开发指南,这是drupal5版的。可能现在还有人用。
Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册
drupal-scaffold, 使用 Drupal/core更新 Drupal scaffold文件的Composer插件 ...) 插件,用于自动下载Drupal脚本文件,通过编写器使用 drupal/core 。建议在 root root的项目的标准位置放置供应商目录;但是,供应商目