/**
  * Get our input parameters...
  * @return boolean success
  */
 function prepare()
 {
     $config = $this->getConfig();
     $this->nickname = DomainStatusNetworkPlugin::nicknameForDomain($this->domain);
     // XXX make this configurable
     $this->sitename = sprintf('The %s Status Network', $this->domain);
     $this->server = $this->nickname . '.' . $config['WILDCARD'];
     $this->path = null;
     $this->fancy = true;
     $datanick = $this->databaseize($this->nickname);
     $this->host = $config['DBHOSTNAME'];
     $this->database = $datanick . $config['DBBASE'];
     $this->dbtype = 'mysql';
     // XXX: support others... someday
     $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'];
     $password = `{$pwgen}`;
     $this->password = trim($password);
     // For setting up the database
     $this->rootname = $config['ADMIN'];
     $this->rootpass = $config['ADMINPASS'];
     $this->sitehost = $config['DBHOST'];
     $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;
     if (!$this->validateDb()) {
         return false;
     }
     return true;
 }
 *
 * Script to print out current version of the software
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain>
Prints site information for the domain given

END_OF_SITEFORDOMAIN_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$domain = DomainStatusNetworkPlugin::toDomain($args[0]);
$nickname = DomainStatusNetworkPlugin::nicknameForDomain($domain);
if (empty($nickname)) {
    throw new ClientException('No candidate found.');
} else {
    print $nickname;
    print "\n";
}