Пример #1
0
 function execute()
 {
     global $IP, $wgTitle;
     $siteName = isset($this->mArgs[0]) ? $this->mArgs[0] : "Don't care";
     // Will not be set if used with --env-checks
     $adminName = isset($this->mArgs[1]) ? $this->mArgs[1] : null;
     $wgTitle = Title::newFromText('Installer script');
     $dbpassfile = $this->getOption('dbpassfile', false);
     if ($dbpassfile !== false) {
         wfSuppressWarnings();
         $dbpass = file_get_contents($dbpassfile);
         wfRestoreWarnings();
         if ($dbpass === false) {
             $this->error("Couldn't open {$dbpassfile}", true);
         }
         $this->mOptions['dbpass'] = trim($dbpass, "\r\n");
     }
     $installer = new CliInstaller($siteName, $adminName, $this->mOptions);
     $status = $installer->doEnvironmentChecks();
     if ($status->isGood()) {
         $installer->showMessage('config-env-good');
     } else {
         $installer->showStatusMessage($status);
         return;
     }
     if (!$this->hasOption('env-checks')) {
         $installer->execute();
         $installer->writeConfigurationFile($this->getOption('confpath', $IP));
     }
 }
Пример #2
0
 function execute()
 {
     global $IP, $wgTitle;
     $siteName = isset($this->mArgs[0]) ? $this->mArgs[0] : "Don't care";
     // Will not be set if used with --env-checks
     $adminName = isset($this->mArgs[1]) ? $this->mArgs[1] : null;
     $wgTitle = Title::newFromText('Installer script');
     $installer = new CliInstaller($siteName, $adminName, $this->mOptions);
     $status = $installer->doEnvironmentChecks();
     if ($status->isGood()) {
         $installer->showMessage('config-env-good');
     } else {
         $installer->showStatusMessage($status);
         return;
     }
     if (!$this->hasOption('env-checks')) {
         $installer->execute();
         $installer->writeConfigurationFile($this->getOption('confpath', $IP));
     }
 }
Пример #3
0
END_HELP;
    }
    function warning($message, $submessage = '')
    {
        print $this->html2text($message) . "\n";
        if ($submessage != '') {
            print "  " . $this->html2text($submessage) . "\n";
        }
        print "\n";
    }
    function updateStatus($status, $error = false)
    {
        if ($this->verbose || $error) {
            if ($error) {
                print "ERROR: ";
            }
            print $this->html2text($status);
            print "\n";
        }
    }
    private function html2text($html)
    {
        // break out any links for text legibility
        $breakout = preg_replace('/<a[^>+]\\bhref="(.*)"[^>]*>(.*)<\\/a>/', '\\2 &lt;\\1&gt;', $html);
        return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
    }
}
$installer = new CliInstaller();
$ok = $installer->main();
exit($ok ? 0 : 1);