Skip to content

Instantly share code, notes, and snippets.

@efpapado
Last active May 6, 2019 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efpapado/83b0e338b9bfaf05f7036276498240d6 to your computer and use it in GitHub Desktop.
Save efpapado/83b0e338b9bfaf05f7036276498240d6 to your computer and use it in GitHub Desktop.
book_helper_mute_hook_node_update
diff --git a/book_helper.module b/book_helper.module
index f3ffd45..fc21bf0 100755
--- a/book_helper.module
+++ b/book_helper.module
@@ -152,6 +152,21 @@ function book_helper_node_insert($node) {
* Implements hook_node_update().
*/
function book_helper_node_update($node) {
+ // Stathis 06/05/2019
+ // During the implementation of a massive node update, with Marlon's drush-node-update
+ // script, in order to change the urls from `sites/all/files` to `sites/default/files`
+ // (@see task https://teamwork.ramsalt.com/index.cfm#tasks/13052304)
+ // there were some exceptions thrown on hook implementation book_helper_node_update,
+ // because of data integrity problems: `PDOException: SQLSTATE[23000]: Integrity
+ // constraint violation: 1048 Column 'link_title' cannot be null in
+ // /Users/efpapado/www/kriseportalen.no-std/web/includes/database/database.inc:2227 [error]`
+ // Because of urgency, there is no time to properly fix it, so a rough patch is
+ // implemented that will mute this hook.
+ $book_helper_mute_hook_node_update = variable_get('book_helper_mute_hook_node_update', FALSE);
+ if ($book_helper_mute_hook_node_update) {
+ return;
+ }
+
// Get link title sync and custom from the book.module's array().
if (isset($node->book['book_helper_link_title_sync'])) {
$node->book_helper['link_title_sync'] = $node->book['book_helper_link_title_sync'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment