protected function _executeAdminister($wgFarmer)
 {
     global $wgOut, $wgUser, $wgRequest;
     $currentWiki = MediaWikiFarmer_Wiki::factory($wgFarmer->getActiveWiki());
     $action = $this->getTitle('admin')->escapeLocalURL();
     if (!(MediaWikiFarmer::userIsFarmerAdmin($wgUser) || $currentWiki->userIsAdmin($wgUser))) {
         $wgOut->wrapWikiMsg('== $1 ==', 'farmer-permissiondenied');
         $wgOut->addWikiMsg('farmer-permissiondenied-text1');
         return;
     }
     $wgOut->wrapWikiMsg('== $1 ==', 'farmer-basic-title');
     $wiki = $wgFarmer->getActiveWiki();
     if ($title = $wgRequest->getVal('wikiTitle')) {
         $wiki->title = MediaWikiFarmer_Wiki::sanitizeTitle($title);
         $wiki->save();
         $wgFarmer->updateFarmList();
     }
     if ($description = $wgRequest->getVal('wikiDescription')) {
         $wiki->description = $description;
         $wiki->save();
         $wgFarmer->updateFarmList();
     }
     if (!$wiki->title) {
         $wgOut->wrapWikiMsg('=== $1 ===', 'farmer-basic-title1');
         $wgOut->addWikiMsg('farmer-basic-title1-text');
         $wgOut->addHTML('<form method="post" name="wikiTitle" action="' . $action . '">' . '<input name="wikiTitle" size="30" value="' . $wiki->title . '" />' . '<input type="submit" name="submit" value="' . wfMsgHtml('farmer-button-submit') . '" />' . '</form>');
     }
     $wgOut->wrapWikiMsg('=== $1 ===', 'farmer-basic-description');
     $wgOut->addWikiMsg('farmer-basic-description-text');
     $wgOut->addHTML('<form method="post" name="wikiDescription" action="' . $action . '">' . '<textarea name="wikiDescription" rows="5" cols="30">' . htmlspecialchars($wiki->description) . '</textarea>' . '<input type="submit" name="submit" value="' . wfMsgHtml('farmer-button-submit') . '" />' . '</form>');
     # Permissions stuff
     if (wfRunHooks('FarmerAdminPermissions', array($wgFarmer))) {
         # Import
         if ($wgRequest->wasPosted() && ($permissions = $wgRequest->getArray('permission'))) {
             foreach ($permissions['*'] as $k => $v) {
                 $wiki->setPermissionForAll($k, $v);
             }
             foreach ($permissions['user'] as $k => $v) {
                 $wiki->setPermissionForUsers($k, $v);
             }
             $wiki->save();
         }
         # Form
         $wgOut->wrapWikiMsg('== $1 ==', 'farmer-basic-permission');
         $wgOut->addWikiMsg('farmer-basic-permission-text');
         $wgOut->addHTML('<form method="post" name="permissions" action="' . $action . '">');
         $wgOut->wrapWikiMsg('=== $1 ===', 'farmer-basic-permission-visitor');
         $wgOut->addWikiMsg('farmer-basic-permission-visitor-text');
         $doArray = array(array('read', wfMsg('right-read')), array('edit', wfMsg('right-edit')), array('createpage', wfMsg('right-createpage')), array('createtalk', wfMsg('right-createtalk')));
         foreach ($doArray as $arr) {
             $this->_doPermissionInput($wgOut, $wiki, '*', $arr[0], $arr[1]);
         }
         $wgOut->wrapWikiMsg('=== $1 ===', 'farmer-basic-permission-user');
         $wgOut->addWikiMsg('farmer-basic-permission-user-text');
         $doArray = array(array('read', wfMsg('right-read')), array('edit', wfMsg('right-edit')), array('createpage', wfMsg('right-createpage')), array('createtalk', wfMsg('right-createtalk')), array('move', wfMsg('right-move')), array('upload', wfMsg('right-upload')), array('reupload', wfMsg('right-reupload')), array('minoredit', wfMsg('right-minoredit')));
         foreach ($doArray as $arr) {
             $this->_doPermissionInput($wgOut, $wiki, 'user', $arr[0], $arr[1]);
         }
         $wgOut->addHTML('<input type="submit" name="setPermissions" value="' . wfMsg('farmer-setpermission') . '" />');
         $wgOut->addHTML("</form>\n\n\n");
     }
     # Default skin
     if (wfRunHooks('FarmerAdminSkin', array($wgFarmer))) {
         # Import
         if ($wgRequest->wasPosted() && ($newSkin = $wgRequest->getVal('defaultSkin'))) {
             $wiki->wgDefaultSkin = $newSkin;
             $wiki->save();
         }
         # Form
         $wgOut->wrapWikiMsg('== $1 ==', 'farmer-defaultskin');
         $defaultSkin = $wgFarmer->getActiveWiki()->wgDefaultSkin;
         if (!$defaultSkin) {
             $defaultSkin = 'MonoBook';
         }
         $skins = Skin::getSkinNames();
         global $wgSkipSkins;
         foreach ($wgSkipSkins as $skin) {
             if (array_key_exists($skin, $skins)) {
                 unset($skins[$skin]);
             }
         }
         $wgOut->addHTML('<form method="post" name="formDefaultSkin" action="' . $action . '">');
         foreach ($skins as $k => $skin) {
             $toAdd = '<input type="radio" name="defaultSkin" value="' . $k . '"';
             if ($k == $defaultSkin) {
                 $toAdd .= ' checked="checked" ';
             }
             $toAdd .= '/>' . $skin;
             $wgOut->addHTML($toAdd . "<br />\n");
         }
         $wgOut->addHTML('<input type="submit" name="submitDefaultSkin" value="' . wfMsgHtml('farmer-defaultskin-button') . '" />');
         $wgOut->addHTML('</form>');
     }
     # Manage active extensions
     if (wfRunHooks('FarmerAdminExtensions', array($wgFarmer))) {
         $extensions = $wgFarmer->getExtensions();
         // if we post a list of new extensions, wipe the old list from the wiki
         if ($wgRequest->wasPosted() && $wgRequest->getCheck('submitExtension')) {
             $wiki->extensions = array();
             // go through all posted extensions and add the appropriate ones
             foreach ((array) $wgRequest->getArray('extension') as $k => $e) {
                 if (array_key_exists($k, $extensions)) {
                     $wiki->addExtension($extensions[$k]);
                 }
             }
             $wiki->save();
         }
         # Form
         $wgOut->wrapWikiMsg('== $1 ==', 'farmer-extensions');
         $wgOut->addHTML('<form method="post" name="formActiveExtensions" action="' . $action . '">');
         foreach ($extensions as $extension) {
             $toAdd = '<input type="checkbox" name="extension[' . $extension->name . ']" ';
             if ($wiki->hasExtension($extension)) {
                 $toAdd .= 'checked="checked" ';
             }
             $toAdd .= ' /><strong>' . htmlspecialchars($extension->name) . '</strong> - ' . htmlspecialchars($extension->description) . "<br />\n";
             $wgOut->addHTML($toAdd);
         }
         $wgOut->addHTML('<input type="submit" name="submitExtension" value="' . wfMsgHtml('farmer-extensions-button') . '" />');
         $wgOut->addHTML('</form>');
     }
 }
 /**
  * Update the interwiki table for links to the wikis in the farm
  */
 public function updateInterwikiTable()
 {
     $wikis = $this->getFarmList();
     $dbw = wfGetDB(DB_MASTER);
     $replacements = array();
     foreach ($wikis as $key => $stuff) {
         $wiki = MediaWikiFarmer_Wiki::factory($key);
         $replacements[] = array('iw_prefix' => $wiki->name, 'iw_url' => $wiki->getUrl(), 'iw_local' => 1);
     }
     $dbw->replace('interwiki', 'iw_prefix', $replacements, __METHOD__);
 }