Jelajahi Sumber

Fix author matching for authors without an email

Jordi Boggiano 13 tahun lalu
induk
melakukan
8244e49dc4

+ 9 - 2
src/Packagist/WebBundle/Command/UpdatePackagesCommand.php

@@ -238,12 +238,19 @@ EOF
             foreach ($data['authors'] as $authorData) {
                 $author = null;
                 // skip authors with no information
-                if (!isset($authorData['email']) && !isset($authorData['name'])) {
+                if (empty($authorData['email']) && empty($authorData['name'])) {
                     continue;
                 }
 
-                if (isset($authorData['email'])) {
+                if (!empty($authorData['email'])) {
                     $author = $doctrine->getRepository('PackagistWebBundle:Author')->findOneByEmail($authorData['email']);
+
+                    if (!$author && !empty($authorData['homepage'])) {
+                        $author = $doctrine->getRepository('PackagistWebBundle:Author')->findOneBy(array(
+                            'name' => $authorData['name'],
+                            'homepage' => $authorData['homepage']
+                        ));
+                    }
                 }
 
                 if (!$author) {