[development] Alternative to drupal_bootstrap when we want to access Drupal data from other application?
Chris Skene
chris at xtfer.com
Sun Feb 13 03:23:36 UTC 2011
Alternatively, consider using a service (xmlrpc, rest) or pulling the data off a view using xml or similar. If you cache the data at the Drupal end the relative performance hit will be minimal.
chris
On 13/02/2011, at 2:10 PM, Gordon Heydon wrote:
> Hi,
>
> You could just bootstrap the database, but not all the modules will be loaded, and you may not get back the same results, as you would in drupal.
>
> What the other problem could be that it is doing a lot in hook_init() which you could skip by defining MAINTENANCE_MODE as update.
>
> see http://api.drupalecommerce.org/api/drupal/drupal--includes--common.inc/function/_drupal_bootstrap_full/6.x
>
> Gordon.
>
> On 13/02/2011, at 2:06 PM, Ryan Chan wrote:
>
>> Hello,
>>
>> I want to use some Drupal7 functions such as node_load,
>> taxonomy_term_load in my custom written PHP applications.
>>
>> I managed to use them by running a full drupal bootstrap, function is okay,
>>
>> i.e.
>>
>> drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
>> $node = node_load(123);
>>
>> However, when profiling the code using Xdebug, I found
>> drupal_bootstrap is just too heavy, i.e. used 80% of my application
>> CPU time even I am doing simple query such as node_load.
>>
>> Of course, I can direct query the Drupal DB but I don't want to
>> reinvent the wheel, but now seems it is too much overhead.
>>
>> Any suggestion when outside application want to access Drupal data,
>> for the above basic query (read only)?
>>
>> Thanks.
>
More information about the development
mailing list