4

We have a client who was adding content to a separated dev server, the dev server is whitelisted only and doesn't allow incoming/outgoing connections to a lot of services.

The client was adding videos with the video embed field module, which automatically generates a static file on our server.

The firewall config means that this error was produced

Warning: file_put_contents(temporary://fileTjnJTX): failed to open stream:      "DrupalTemporaryStreamWrapper::stream_open" call failed in      file_unmanaged_save_data() (line 1898 of /var/www/user/includes/file.inc).
The file could not be created.

When editing and saving the content drupal tries to regenerate the image if none is available Our sysadmin is working the firewall configuration to allow the connections, but we was wondering if there is any easy way/drush commands/mysql statment to update all content,

3

You can take a look inside the module Drush Entity because in this module you have the command entity-update:

drush @drupal.d7 entity-update node 53 --fields=title

If you want to improve the command to work in all nodes you can read this post:

How to adapt the name of a custom Drush command?

EDIT:

If you want to learn about Drush alias (@drupal.d7) you can go to: Drush Aliases: What, Why and How

  • 1
    Didn't know Drush can do this, that's cool. – No Sssweat Jul 13 '16 at 4:16
  • What does the @drupal.d7 refer to? And how can adapting the name of a cmd result in "work in all nodes"? – Pierre.Vriens Jul 13 '16 at 18:57
  • @Pierre.Vriens I don't know about the drupal.d7. I just copy the command from the module page, without drupal.d7 works fine. To work in all nodes just iterate trougth all the nodes ;-) – Adrian Cid Almaguer Jul 13 '16 at 19:04
  • hm, that @drupal.d7 must be a Drush Aliases (feel free to enhance your answer with it if you want). Though I (still) wonder how such "iteration" should look ... – Pierre.Vriens Jul 13 '16 at 19:39
  • @Pierre.Vriens I will edit after. To iterate make a query to retrive all the nodes and then edit the title and save. Do you get the point? – Adrian Cid Almaguer Jul 14 '16 at 15:43
1

Probably won't be a drush command for this but you can always create your own plugin for it since the actual code is fairly easy. Essentially what you want to do is to trigger 'node_save()' for all items matching your criteria which should trigger whatever follow-on actions, rules, etc. are associated with that content. The range of options listed in this question for bulk delete give you a number of code snippets to use but this is the one I would use (modified for your specific case:

Create a file with below code in root of drupal installation and execute the file.

<?php
  require_once './includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  $aquery= db_query("SELECT nid FROM {node} AS n WHERE n.type = 'video'");
  while ($row = db_fetch_object($aquery)) {
    node_save($row->nid);
  }
?>

If you don't want to create php files, the Views Bulk Operations module offers a 'Node Save' action that can be just as simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.