]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/DomainStatusNetwork/lib/domainstatusnetworkinstaller.php
HubSub now remembers recent failures and counts them
[quix0rs-gnu-social.git] / plugins / DomainStatusNetwork / lib / domainstatusnetworkinstaller.php
index b2042abe947630542cd227665526dde0183ece42..877319be759d95875b0b1547bcd1d82319639248 100644 (file)
@@ -117,15 +117,22 @@ class DomainStatusNetworkInstaller extends Installer
 
         $this->rootname = $config['ADMIN'];
         $this->rootpass = $config['ADMINPASS'];
-        $this->sitehost = $config['DBHOST'];
+        $this->sitehost = $config['SITEDBHOSTNAME'];
         $this->sitedb   = $config['SITEDB'];
 
+        $tagstr = $config['TAGS'];
+
+        if (!empty($tagstr)) {
+            $this->tags = preg_split('/[\s,]+/', $tagstr);
+        } else {
+            $this->tags = array();
+        }
+
         // Explicitly empty
 
         $this->adminNick    = null;
         $this->adminPass    = null;
         $this->adminEmail   = null;
-        $this->adminUpdates = null;
 
         /** Should we skip writing the configuration file? */
         $this->skipConfig = true;
@@ -170,6 +177,7 @@ class DomainStatusNetworkInstaller extends Installer
         $sn->dbpass   = $this->password;
         $sn->dbname   = $this->database;
         $sn->sitename = $this->sitename;
+        $sn->created  = common_sql_now();
 
         $result = $sn->insert();
 
@@ -179,13 +187,21 @@ class DomainStatusNetworkInstaller extends Installer
 
         // Re-fetch; stupid auto-increment integer isn't working
 
-        $sn = Status_network::staticGet('nickname', $sn->nickname);
+        $sn = Status_network::getKV('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));
+        // Set default tags
+
+        $tags = $this->tags;
+
+        // Add domain tag
+
+        $tags[] = 'domain='.$this->domain;
+
+        $sn->setTags($tags);
 
         $this->sn = $sn;
     }
@@ -196,7 +212,22 @@ class DomainStatusNetworkInstaller extends Installer
 
         Status_network::$wildcard = $config['WILDCARD'];
 
-        StatusNet::switchSite($this->nickname);
+        GNUsocial::switchSite($this->nickname);
+
+        // We need to initialize the schema_version stuff to make later setup easier
+
+        $schema = array();
+        require INSTALLDIR.'/db/core.php';
+        $tableDefs = $schema;
+
+        $schema = Schema::get();
+        $schemaUpdater = new SchemaUpdater($schema);
+
+        foreach ($tableDefs as $table => $def) {
+            $schemaUpdater->register($table, $def);
+        }
+
+        $schemaUpdater->checkSchema();
 
         Event::handle('CheckSchema');
     }
@@ -235,6 +266,9 @@ class DomainStatusNetworkInstaller extends Installer
     function createDatabase()
     {
         // Create the New DB
+        /* FIXME
+         * Extension 'mysql_' is deprecated since PHP 5.5 - use mysqli instead.
+         */
         $res = mysql_connect($this->host, $this->rootname, $this->rootpass);
         if (!$res) {
             throw new ServerException("Cannot connect to {$this->host} as {$this->rootname}.");
@@ -307,7 +341,7 @@ class DomainStatusNetworkInstaller extends Installer
         $breakout = preg_replace('/<a[^>+]\bhref="(.*)"[^>]*>(.*)<\/a>/',
                                  '\2 &lt;\1&gt;',
                                  $html);
-        return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
+        return common_strip_html($breakout);
     }
 
     function databaseize($nickname)