From e0cc89a3705ef08d8e257f419e2a3b98443e9715 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Mon, 27 Jun 2011 22:01:34 +0000
Subject: [PATCH] [gh-158] Merging from testing into staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@774 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/modules/unl/unl_migration.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sites/all/modules/unl/unl_migration.php b/sites/all/modules/unl/unl_migration.php
index d90f5351..48deb3b0 100644
--- a/sites/all/modules/unl/unl_migration.php
+++ b/sites/all/modules/unl/unl_migration.php
@@ -361,6 +361,10 @@ class Unl_Migration_Tool
                     continue;
                 }
                 $childLinkNode = $childLinkLiNode->getElementsByTagName('a')->item(0);
+                // If somebody left this menu item empty, skip it.  Liferay, I'm looking at you!
+                if (!$childLinkNode || !$childLinkNode->hasAttribute('href')) {
+                    continue;
+                }
                 $childMenu[] = array('text' => trim($childLinkNode->textContent),
                                      'href' => $this->_makeLinkAbsolute($childLinkNode->getAttribute('href'), ''));
             }
@@ -547,7 +551,11 @@ class Unl_Migration_Tool
             if (!mb_check_encoding($path, 'UTF-8')) {
                 $path = iconv('ISO-8859-1', 'UTF-8', $path); 
             }
-            $file = file_save_data($data['content'], 'public://' . urldecode($path), FILE_EXISTS_REPLACE);
+            try {
+              $file = file_save_data($data['content'], 'public://' . urldecode($path), FILE_EXISTS_REPLACE);
+            } catch (Exception $e) {
+              $this->_log('Could not migrate file "' . $path . '"! File name too long?');
+            }
             $this->_hrefTransformFiles[$path] = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . $path;
             return;
         }
-- 
GitLab