]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
more verbose, better checks for installforemail
authorEvan Prodromou <evan@status.net>
Thu, 28 Apr 2011 22:30:59 +0000 (15:30 -0700)
committerEvan Prodromou <evan@status.net>
Thu, 28 Apr 2011 22:30:59 +0000 (15:30 -0700)
plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php
plugins/DomainStatusNetwork/scripts/installforemail.php

index 891fdd9817b97bc5cd0453f04be3dd076db710c2..c3db0c7c2b93f5e654355dc6be599e9e83102ea5 100644 (file)
@@ -53,7 +53,8 @@ class DomainStatusNetworkInstaller extends Installer
     protected $rootpass = null;
     protected $nickname = null;
     protected $sn       = null;
-    protected $verbose  = false;
+
+    public $verbose     = false;
 
     function __construct($domain)
     {
@@ -94,10 +95,18 @@ class DomainStatusNetworkInstaller extends Installer
         $this->path     = null;
         $this->fancy    = true;
 
+        $datanick = $this->databaseize($this->nickname);
+
         $this->host     = $config['DBHOSTNAME'];
-        $this->database = $this->nickname.$config['DBBASE'];
+        $this->database = $datanick.$config['DBBASE'];
         $this->dbtype   = 'mysql'; // XXX: support others... someday
-        $this->username = $this->nickname.$config['USERBASE'];
+        $this->username = $datanick.$config['USERBASE'];
+
+        // Max size for MySQL
+
+        if (strlen($this->username) > 16) {
+            $this->username = sprintf('%s%08x', substr($this->username, 0, 8), crc32($this->username));
+        }
 
         $pwgen = $config['PWDGEN'];
 
@@ -136,10 +145,14 @@ class DomainStatusNetworkInstaller extends Installer
 
     function setupDatabase()
     {
+        $this->updateStatus('Creating database...');
         $this->createDatabase();
         parent::setupDatabase();
+        $this->updateStatus('Creating file directories...');
         $this->createDirectories();
+        $this->updateStatus('Saving status network...');
         $this->saveStatusNetwork();
+        $this->updateStatus('Checking schema for plugins...');
         $this->checkSchema();
     }
 
@@ -157,6 +170,7 @@ class DomainStatusNetworkInstaller extends Installer
         $sn->dbuser   = $this->username;
         $sn->dbpass   = $this->password;
         $sn->dbname   = $this->database;
+        $sn->sitename = $this->sitename;
 
         $result = $sn->insert();
 
@@ -273,4 +287,10 @@ class DomainStatusNetworkInstaller extends Installer
                                  $html);
         return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
     }
+
+    function databaseize($nickname)
+    {
+        $nickname = str_replace('-', '_', $nickname);
+        return $nickname;
+    }
 }
index 5eb538888551171dc298e441c5362860414e6980..2c25def4e14f45bae6c97b62a656f4e6332cecaa 100644 (file)
@@ -37,6 +37,9 @@ $sn = DomainStatusNetworkPlugin::siteForDomain($domain);
 
 if (empty($sn)) {
     $installer = new DomainStatusNetworkInstaller($domain);
+
+    $installer->verbose = have_option('v', 'verbose');
+
     // Do the thing
     $installer->main();