Hi,

I am just struck with the problem that I important a ton of content into my drupal 4.7,
taxonomy works, node works, everything...
(the import was done via a bunch of sql scripts)

- but now I enabled the excerpt module and want to autogenerate the excerpts that are usually
generate with the "edit" function

- also I'd like to apply another input filter (textile) to all the nodes

How can I trigger a reprocessing of all nodes???

thanks in advance, help is much appreciated!

Christoph

Comments

Christoph C. Cemper’s picture

I just figured that the node api could help

the node_save function ( http://api.drupal.org/api/4.7/function/node_save )
would probably allow to run thru all the filters, plugins etc...

So all I need is probably a script that does this:

- loop over all nodes that I specify (how?)
---> node_load (nid)
(maybe set teaser to NULL first)
---> node_save(nid)
- end loop

that should do it, or?

anyone got such a script? can't believe I am the first one

christoph

Christoph C. Cemper’s picture

just found the same issue - without soltion - from 1 month ago here

http://drupal.org/node/62954

Christoph C. Cemper’s picture

fetching the devel.module gives you an update-teaser.php script ... 2 years old

throws an error

Fatal error: Call to undefined function: db_query() in ...

Christoph C. Cemper’s picture

ok - this stoneage code did nothing but fail

here's some code I just got running for updating all teasers (reprocessing all nodes and generating the excerpts required)

// $Id: update-teaser.php,v 1.2 2004/03/04 22:58:04 killes Exp $
#include "includes/bootstrap.inc";
include_once './includes/bootstrap.inc';
include "./includes/common.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  

$result = db_query("SELECT n.nid,body,teaser FROM node n, node_revisions r where r.nid=n.nid and teaser =''");
#$result = db_query("SELECT n.nid,body,teaser FROM node n, node_revisions r where r.nid=n.nid and n.nid>30221 limit 10
#");

while ($nodesql = db_fetch_object($result)) {
  
  
  $node = node_load( $nodesql->nid );
  $node->teaser = node_teaser($node->body);

#  $node->body .= ' updated by CCC ';

  print_r ($node);
  
#  print ( "\n---------\n Update node ".$node->nid );
#  print ( "\n teaser: ".$node->teaser);
 
  node_save( $node );

#return;  
#  db_query("UPDATE node SET teaser = '%s' WHERE nid = %d", $teaser, $node->nid);

}