Theme Options
COLORS SKINS PAGE COLOR BACKGROUND BODY

Error message

  • Deprecated function: Array and string offset access syntax with curly braces is deprecated in include_once() (line 20 of /home/royalcreations/public_html/shivamroy.com/includes/file.phar.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6609 of /home/royalcreations/public_html/shivamroy.com/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6609 of /home/royalcreations/public_html/shivamroy.com/includes/common.inc).
  • Notice: Trying to access array offset on value of type int in element_children() (line 6609 of /home/royalcreations/public_html/shivamroy.com/includes/common.inc).
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home/royalcreations/public_html/shivamroy.com/includes/common.inc).

How Drupal 7 Works

When a request for a page is sent by a browser , this request is received by the server hosting a drupal site. Suppose a request is sent for the page http://drupal.org/user/1 this request is received by drupal installation directory as URL user/1.
We have an .htaccess file inside drupal installation directory which is read on every request.
There is a rule ( RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] ) written almost at the bottom of this file which redirects the coming request to index.php file with URL request as a parameter. which is q=user/1 is this case.
NOTE: This request is available with in drupal in $_GET['q'] variable.
If you open index.php file you find a file bootsrap.inc being included and some other functions written. From here actual drupal exection starts.

In index.php file drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL) fuction is called which is defined inside includes/bootstrap.inc file. Drupal bootstraps process is executed on every request by going through various bootstrap phases. These phases are explained in bootstrap.inc file.

DRUPAL_BOOTSTRAP_CONFIGURATION : This phase Initializes internal configuration array and establishes the base URL ($base_url) of the site.
DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: This phase returns the requested page if the page has been already cached . once the page is returned the further execution is terminated. Mostly for the anonymous users we can have some static pages which can be cached for the better performance.
DRUPAL_BOOTSTRAP_DATABASE : This phase Initializes the default database.
DRUPAL_BOOTSTRAP_ACCESS :In Access control phase drupal denies access to hosts which were banned.
DRUPAL_BOOTSTRAP_SESSION: Sessions are initialized or reestablished in the session phase. The global $user object representing the current user is also initialized here.
DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE : In this phase drupal goes through a lot of execution unlike DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE phase to determine whether to serve the request from page cache or not. This includes merging settings from the database into the array that was created during the initialize configuration phase and loading or parsing module code. If the session indicates that the request was issued by an anonymous user and page caching is enabled, the page is returned from the cache and execution stops.

DRUPAL_BOOTSTRAP_LANGUAGE : Drupal’s multilingual support is initialized and a decision is made as to which language will be used to serve the current page based on site and user settings. Drupal supports several alternatives for determining language support, such as path prefix and domain-level language negotiation.

DRUPAL_BOOTSTRAP_PATH : At the path phase, code that handles paths and path aliasing is loaded. This phase enables human-readable URLs to be resolved and handles internal Drupal path caching and lookups.

DRUPAL_BOOTSTRAP_FULL: This phase completes the bootstrap process by loading a library of common functions, theme support, and support for callback mapping, file handling, Unicode, PHP image toolkits, form creation and processing, mail handling, automatically sortable tables, and result set paging.
Drupal’s custom error handler is set, and all enabled modules are loaded. Finally, Drupal fires the init hook, so that modules have an opportunity to be notified before official processing of the request begins.
Once Drupal has completed bootstrapping, all components of the framework are avail-
able. It is time to take the browser’s request and hand it off to the PHP function that will
handle it. The mapping between URLs and functions that handle them is accomplished using a callback registry that takes care of both URL mapping and access control. Modules register their callbacks using the menu hook.
When Drupal has determined that there exists a callback to which the URL of the browser request successfully maps and that the user has permission to access that callback, control is handed to the callback function.
After the bootstrap process is completed code for returning the requested data is executed depending on the requested url.
In index.php there's a function $return = menu_execute_active_handler();
menu_execute_active_handler() function Execute the page callback associated with the current path.

For example if request for "http://drupal.org/user/1" is received. In user.module file on line 1051 drupal6.12 we have an menu item defined ,

$items['user/%user_uid_optional'] = array(
'title' => 'My account',
'title callback' => 'user_page_title',
'title arguments' => array(1),
'page callback' => 'user_view',
'page arguments' => array(1),
'access callback' => 'user_view_access',
'access arguments' => array(1),
'parent' => '',
'file' => 'user.pages.inc',
);

The requested url (user/1)is mapped to "user/%user_uid_optional". Access callback function user_view_access() checks if the requested path is accessible to current user or not and page callback function user_view() defined in user.pages.inc file returns the requested data.

1. Start (Browser's request is received)
2. Drupal bootstrap Phases completed includes DB connection, session setup, language setup, library function loading, Enabled modules loading etc is done.
3. menu_execute_active_handler function is called.
4. If site is offline, drupal_site_offline() is returned and exit
5. If requested URL not found, drupal_not_found() returned and exit
6. If requested url is not accessible to the current user, drupal_access_denied() is returned and exit
7. Page callback fuction is called mapped to requested URL which returns requested data .

A few people might be thinking why this URL has been taken as an example. http://drupal.org/user/1 is a user page of drupal founder Dries Buytaert on drupal.org 

Comments (0)

The content of this field is kept private and will not be shown publicly.