code

Drupal_bootstrap: Connect to Drupal from an External PHP Script

For testing purposes, or for executing Drupal-related operations but from a PHP script that runs outside of Drupal, I often create independent PHP files that are not meant to be Drupal modules but still require access to Drupal’s database, functions and modules.

Using the function drupal_bootstrap, located within includes/bootstrap.inc, your script can load Drupal and make all of Drupal’s functionality accessible to your script.

Simple and flexible PHP execution-time tracking

This is a simple function that always comes in very handy in debugging and logging PHP code. ExecTime() keeps track of one or more processes, and can round the result up to your desired level of decimal point precision.

ExecTime() starts counting the first time you call it, and from that point on it returns the elapsed time every time you call it again.

Syndicate content