This is the way I am following now. I hope my code will fix all the "broken" nodes.
2010/4/20 Steven Jones <[email protected]>: > Hi Lluís, > > You can use Drupal's Batch API to process large sets of objects like > this. Documentation for the API is here: > > http://api.drupal.org/api/group/batch > > And it includes an example for iterating over all nodes. > > Hope that helps! > > Regards > Steven Jones > ComputerMinds ltd - Perfect Drupal Websites > > Phone : 024 7666 7277 > Mobile : 07702 131 576 > Twitter : darthsteven > http://www.computerminds.co.uk > > > > On 20 April 2010 08:38:19 UTC+1, Lluís Forns <[email protected]> wrote: >> I have some modules creating nodes calling directly node_save() and >> now when trying to rebuild permissions table drupal fails at a random >> node. >> >> I think this is caused because of some bad created nodes, and I thing >> I have found a way to fix them; but it fail because of memory limit. >> Is there a way to make node_load() not store nodes in cache? (I have >> around 30k nodes) >> >> Thanks >> >> <?php >> function mymodule_update_6008() { >> $ret=array(); >> $res=db_query("SELECT nid, type FROM {node}"); >> while ($row=db_fetch_array($res)){ >> $prenode['type']=$row['type']; >> $prenode=(object)$prenode; >> $node_new=node_object_prepare($prenode); >> $node_old=node_load($row['nid']); >> foreach($node_old AS $key => $value) { >> $node_new->$key = $value; >> } >> node_save($node_new); >> } >> } >> ?> >> >> >> -- >> *Les normes hi són perquè hi pensis abans de saltar-te-les >> *La vida és com una taronja, què esperes a exprimir-la? >> *Si creus que l'educació és cara, prova la ignorància. >> *La vida és com una moneda, la pots gastar en el que vulguis però >> només una vegada. >> *Abans d'imprimir aquest missatge, pensa en el medi ambient. >> > -- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
