Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | auto_nodetitle.drush_.inc_.gz | 877 bytes | msielski |
#6 | auto_nodetitle.drush_.inc_.gz | 911 bytes | christowm |
#5 | auto_nodetitle.drush_.inc_.gz | 910 bytes | asciikewl |
#3 | auto_nodetitle.drush_.inc_.txt | 2.01 KB | asciikewl |
auto_nodetitle.drush_.inc_.gz | 908 bytes | asciikewl |
Comments
Comment #1
asciikewl CreditAttribution: asciikewl commentedDrat. It seems to be suffering from the problems with token replacement :(
Comment #2
skizzo CreditAttribution: skizzo commentedSubscribing (see also http://drupal.org/node/360359#comment-1460918 )
Comment #3
asciikewl CreditAttribution: asciikewl commentedSeems 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
Comment #4
xamanu CreditAttribution: xamanu commentedtested #3 with a specific content type. Works like a charm. Thank you! :-)
Comment #5
asciikewl CreditAttribution: asciikewl commentedHere is a _very_ quick re-write for d7.
Comment #6
christowm CreditAttribution: christowm commentedI 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.
Comment #7
msielskiThe 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.
Comment #8
manish-31 CreditAttribution: manish-31 at OpenSense Labs commentedI added this file into my module and ran drush commands. Commands worked fine, therefore marking it as RTBC.
Comment #9
manish-31 CreditAttribution: manish-31 at OpenSense Labs commentedI added this file into my module and ran drush commands, commands work properly. Hence marking it as RTBC.
Comment #11
gaurav.kapoor CreditAttribution: gaurav.kapoor commented