]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix error in domainstatusnetworkinstaller that cleared tags table
authorEvan Prodromou <evan@status.net>
Tue, 3 May 2011 01:51:09 +0000 (18:51 -0700)
committerEvan Prodromou <evan@status.net>
Tue, 3 May 2011 01:51:09 +0000 (18:51 -0700)
An error in the domainstatusnetworkinstaller cleared the tags table,
losing any information about sites on the service. (We discovered this
in production on StatusNet OnDemand). Conjunction of these factors: 1)
the installer code was using an insert()'ed object with an
auto-incrementing key, which because the statusnet.ini was incorrect,
wasn't getting updated. 2) It then called setTag() on that object,
which deletes all tags matching the id, then adds in the new ones. 3)
Because the ID was null, DB_DataObject deleted all rows in the table.

I've made a work-around that re-fetches the status_network object
based on its (unique) nickname, which gets the correct ID, which
should work for tags. Confirmed that it works. Still need to fix the
underlying problems, however.

plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php

index ea8220056cf0b2eb4f7e0b5ef2aa644cf30b0d8b..c871c2328e34757c68beaf0e51cab879f4520612 100644 (file)
@@ -177,10 +177,17 @@ class DomainStatusNetworkInstaller extends Installer
             throw new ServerException("Could not create status_network: " . print_r($sn, true));
         }
 
+        // Re-fetch; stupid auto-increment integer isn't working
+
+        $sn = Status_network::staticGet('nickname', $sn->nickname);
+
+        if (empty($sn)) {
+            throw new ServerException("Created {$this->nickname} status_network and could not find it again.");
+        }
+
         $sn->setTags(array('domain='.$this->domain));
 
         $this->sn = $sn;
-
     }
 
     function checkSchema()