Commit 30cbf391 authored by yched's avatar yched

optimization : move .inc file inclusions outside of global scope

parent 3d53cebe
......@@ -20,7 +20,7 @@ General
- 79887 Default field theming does not display label on empty fields.
- 88135 Views handling of multiple fields : allow option to group multiple fields together.
- 107208 make db tables storage-agnostic (remove MyISAM enforcement)
- Slightly optimized .inc files include
- Optimized additional .inc files inclusion
- Misc code cleanup
Field / widget modules
......
......@@ -146,8 +146,8 @@ function content_update_4() {
function content_update_5() {
$ret = array();
include_once(drupal_get_path('module', 'content') .'/content.module');
include_once(drupal_get_path('module', 'content') .'/content_admin.inc');
include_once('./'.drupal_get_path('module', 'content') .'/content.module');
include_once('./'.drupal_get_path('module', 'content') .'/content_admin.inc');
$result = db_query('SELECT nf.field_name FROM {node_field} nf LEFT JOIN {node_field_instance} nfi ON nfi.field_name = nf.field_name WHERE nf.multiple = 0 AND nf.db_storage = 0 GROUP BY nfi.field_name HAVING COUNT(*) = 1');
......
......@@ -8,14 +8,6 @@
define('CONTENT_DB_STORAGE_PER_FIELD', 0);
define('CONTENT_DB_STORAGE_PER_CONTENT_TYPE', 1);
if (module_exist('views')) {
include_once('./'. drupal_get_path('module', 'content') .'/content_views.inc');
}
if (module_exist('pathauto')) {
include_once('./'. drupal_get_path('module', 'content') .'/content_pathauto.inc');
}
include_once('./'.drupal_get_path('module', 'content') .'/content_crud.inc');
/**
* Implementation of hook_help().
*/
......@@ -51,18 +43,39 @@ function content_perm() {
return $perms;
}
/**
* Implementation of hook_init().
*/
function content_init() {
// ensure we are not serving a cached page
if (function_exists('drupal_set_content')) {
// we don't do this in hook_menu to ensure the files are already included when
// views_menu is executed
if (module_exist('views')) {
include_once('./'. drupal_get_path('module', 'content') .'/content_views.inc');
}
// according to http://drupal.org/node/60526, this should not go in hook_menu
if (module_exist('pathauto')) {
include_once('./'. drupal_get_path('module', 'content') .'/content_pathauto.inc');
}
}
}
/**
* Implementation of hook_menu().
*/
function content_menu($may_cache) {
if (!$may_cache) {
// Only include administrative callbacks if we are viewing an admin page.
if (arg(0) == 'admin') {
include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
}
theme_add_style(drupal_get_path('module', 'content') .'/content.css');
}
$items = array();
$access = user_access('administer content types');
// Only include administrative callbacks if we are viewing an admin page.
if (arg(0) == 'admin') {
include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
}
if ($may_cache) {
$items[] = array(
'path' => 'admin/node/types',
......@@ -101,9 +114,6 @@ function content_menu($may_cache) {
}
}
else {
theme_add_style(drupal_get_path('module', 'content') .'/content.css');
if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'types' && arg(3)) {
$type = content_types(arg(3));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment