[support] Cron and clearing caches to update field data..

Christian Lopez clopez at emergya.com
Wed Oct 3 13:59:02 UTC 2012


On Wed, Oct 3, 2012 at 2:39 PM, Earnie Boyd <earnie at users.sourceforge.net>wrote:

> On Tue, Oct 2, 2012 at 4:30 PM, Wipe_Out wrote:
> > On 2 October 2012 19:57, Earnie Boyd <earnie at users.sourceforge.net>
> wrote:
> >>
> >> On Tue, Oct 2, 2012 at 2:23 PM, Wipe_Out <
> wipe_out at users.sourceforge.net>
> >> wrote:
> >> > On 2 October 2012 17:59, Michael Prasuhn <mike at mikeyp.net> wrote:
> >> >>
> >> >> How are you updating the field?
> >> >> __________________
> >> >> Michael Prasuhn
> >> >> http://mikeyp.net
> >> >>
> >> >
> >> > Directly in the database..
> >> >
> >> > I know its bad and it means none of the Drupal hooks run but its the
> >> > only
> >> > way we could do this one particular update easily and in testing other
> >> > than
> >> > it not displaying immediately it doesn't seem to have any adverse
> >> > effects..
> >>
> >> By directly do you mean using SQL or node_load/node_save?  You should
> >> never use SQL to directly update the node.  You may programmatically
> >> update it using node_load, modify object parameter then follow with
> >> node_save.  This allows all the other node hooks to operate properly.
> >
> > Yes I know but in this case we didn't have a choice so had to try it..
> Its
> > just updating a datetime field with a new value.. The testing we did
> didn't
> > reveal any issues other than the fact that the cache needs to be cleared
> for
> > the new values to show in Drupal..
> >
> > Originally we tried updating with a CSV through the feeds module but
> there
> > is a timezone bug in feeds that stops this working..
>
> The node_save() would DTRT with the cache record.
>
> --
> Earnie
> -- https://sites.google.com/site/earnieboyd
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>

If you can do a bootstrap and assuming you know the nid, you can use

    entity_get_controller
<http://api.drupal.org/api/drupal/includes%21common.inc/function/entity_get_controller/7>('node')->resetCache
<http://api.drupal.org/api/search/7/resetCache>(array($node->nid
<http://api.drupal.org/api/search/7/nid>));

or

  cache_clear_all <http://api.drupal.org/api/search/6/cache_clear_all>();

if you're using Drupal 6.

-- 
Christian López Espínola
Área de Proyectos

Emergya Consultoría
Tfno: +34 954 51 75 77
Fax: +34 954 51 64 73
www.emergya.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20121003/1c5ce2f3/attachment.html 


More information about the support mailing list