]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix Avatar-unlink plus better logging in TwitterImport
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 5 Oct 2013 09:32:43 +0000 (11:32 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 5 Oct 2013 09:32:43 +0000 (11:32 +0200)
classes/Avatar.php
plugins/TwitterBridge/daemons/twitterstatusfetcher.php
plugins/TwitterBridge/lib/twitterimport.php

index 01d42f7406d65314f5dc981faa091e588735f4a2..3eada14c97f15014bbf11771a9ac4c84a187af87 100644 (file)
@@ -54,7 +54,7 @@ class Avatar extends Managed_DataObject
     function delete()
     {
         $filename = $this->filename;
-        if (parent::delete()) {
+        if (parent::delete() && file_exists(Avatar::path($filename))) {
             @unlink(Avatar::path($filename));
         }
     }
index 771544fcce1c0fb3147e99749c12ca5962592dba..b4b78dc80af3fee43a0179b2904712c0ba3be90f 100755 (executable)
@@ -23,7 +23,7 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
 // Tune number of processes and how often to poll Twitter
 // XXX: Should these things be in config.php?
 define('MAXCHILDREN', 2);
-define('POLL_INTERVAL', 60); // in seconds
+define('POLL_INTERVAL', 70); // in seconds, Twitter API v1.1 says 15 calls every 15 mins
 
 $shortoptions = 'di::';
 $longoptions = array('id::', 'debug');
index d8b9f7a6bb6cb2ef0ee5347bd4986f0934aba221..710aa7330ac8537c5ea73d9938a6bb3fdf86eb38 100644 (file)
@@ -317,17 +317,19 @@ class TwitterImport
             if ($avatar->filename === $filename) {
                 return null;
             }
+            common_debug(__METHOD__ . " - Updating profile avatar (profile_id={$profile->id}) " .
+                       "from {$avatar->filename} to {$filename}");
             // else we continue with creating a new avatar
         } catch (Exception $e) {
             // Avatar was not found. We can catch NoResultException or FileNotFoundException
             // but generally we just want to continue creating a new avatar.
+            common_debug(__METHOD__ . " - No avatar found for (profile_id={$profile->id})");
         }
         
         $url        = "{$path_parts['dirname']}/{$img_root}_{$this->avatarsizename}{$ext}";
         $mediatype  = $this->getMediatype(mb_substr($ext, 1));
 
         try {
-            common_debug(__METHOD__ . " - Updating profile avatar (profile_id={$profile->id} to {$filename}");
             $this->newAvatar($profile, $url, $filename, $mediatype);
         } catch (Exception $e) {
             if (file_exists(Avatar::path($filename))) {