I just got really tired today of updating node titles via the site for pages of nodes, so I wrote this auto_nodetitle.drush.inc

drush ant sometype anothertype
or
drush ant all

It doesn't use batch api (yet).

Compressed attachment due to upload issues.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

asciikewl’s picture

Drat. It seems to be suffering from the problems with token replacement :(

skizzo’s picture

asciikewl’s picture

Seems I have it working. It was failing to update the node titles because drush runs as UID0. So by adding:

--- a/modules/auto_nodetitle/auto_nodetitle.drush.inc
+++ b/modules/auto_nodetitle/auto_nodetitle.drush.inc
@@ -32,6 +32,8 @@ function auto_nodetitle_drush_help($section) {
* Drush callback to perform actual auto_nodetitle preset flush.
*/
function drush_auto_nodetitle_drush_update() {
+ global $user;
+ $user = user_load(1);
$args = func_get_args();
if (empty($args)) {
drush_set_error(dt('You must specify a node type name to recreate or specify "all".'.

It seems to fix it.

Rename attached file to auto_nodetitle.drush.inc

xamanu’s picture

Status: Needs review » Reviewed & tested by the community

tested #3 with a specific content type. Works like a charm. Thank you! :-)

asciikewl’s picture

Version: 6.x-1.2 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
FileSize
910 bytes

Here is a _very_ quick re-write for d7.

christowm’s picture

FileSize
911 bytes

I tested out the D7 version of this drush command and it still had a D6 function call in it. Replaced the function call with the appropriate D7 version and it works like a charm now.

msielski’s picture

Issue summary: View changes
FileSize
877 bytes

The code from #6 works for the most part, but there were a few bugs which prevented the last block of nodes from ever being updated. I fixed that and cleaned up a few other minor points. This is for D7.

manish-31’s picture

I added this file into my module and ran drush commands. Commands worked fine, therefore marking it as RTBC.

manish-31’s picture

Status: Needs review » Reviewed & tested by the community

I added this file into my module and ran drush commands, commands work properly. Hence marking it as RTBC.

  • gaurav.kapoor committed c986f80 on 7.x-1.x
    Issue #971416 by asciikewl, christowm, msielski: Drush function for re-...
gaurav.kapoor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.