Remove unused language server system
authorMatthias Schmidt <gravatronics@live.com>
Thu, 7 Apr 2016 14:17:31 +0000 (16:17 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 7 Apr 2016 14:17:31 +0000 (16:17 +0200)
12 files changed:
CHANGELOG.md
wcfsetup/install/files/acp/templates/languageServerAdd.tpl [deleted file]
wcfsetup/install/files/acp/templates/languageServerList.tpl [deleted file]
wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php [deleted file]
wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php [deleted file]
wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php [deleted file]
wcfsetup/install/files/lib/data/language/server/LanguageServer.class.php [deleted file]
wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php [deleted file]
wcfsetup/install/files/lib/data/language/server/LanguageServerEditor.class.php [deleted file]
wcfsetup/install/files/lib/data/language/server/LanguageServerList.class.php [deleted file]
wcfsetup/install/files/lib/system/language/LanguageServerProcessor.class.php [deleted file]
wcfsetup/setup/db/install.sql

index 45c829267a0fa606b7db534ad629303f5a8f39e6..b8a88ed7b19d78a867684118955018a55bcd4f4d 100644 (file)
@@ -61,6 +61,7 @@
 * `wcf\action\AJAXProxyAction::getData()` removed.
 * Version system removed.
 * Support for query string based sessions in Frontend removed.
+* Language server system removed.
 
 #### Documentation
 
diff --git a/wcfsetup/install/files/acp/templates/languageServerAdd.tpl b/wcfsetup/install/files/acp/templates/languageServerAdd.tpl
deleted file mode 100644 (file)
index a6ea772..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-{include file='header' pageTitle='wcf.acp.languageServer.'|concat:$action}
-
-<header class="contentHeader">
-       <h1 class="contentTitle">{lang}wcf.acp.languageServer.{$action}{/lang}</h1>
-</header>
-
-{include file='formError'}
-
-{if $success|isset}
-       <p class="success">{lang}wcf.acp.languageServer.{$action}.success{/lang}</p>
-{/if}
-
-<div class="contentNavigation">
-       <nav>
-               <ul>
-                       <li><a href="{link controller='LanguageServerList'}{/link}" class="button"><span class="icon icon16 fa-list"></span> <span>{lang}wcf.acp.menu.link.language.server.list{/lang}</span></a></li>
-                               
-                       {event name='contentNavigationButtons'}
-               </ul>
-       </nav>
-</div>
-
-<form method="post" action="{if $action == 'add'}{link controller='LanguageServerAdd'}{/link}{else}{link controller='LanguageServerEdit' id=$languageServerID}{/link}{/if}">
-       <section class="section">
-               <h2 class="sectionTitle">{lang}wcf.acp.languageServer.data{/lang}</h2>
-               
-               <dl{if $errorField == 'server'} class="formError"{/if}>
-                       <dt><label for="server">{lang}wcf.acp.languageServer.server{/lang}</label></dt>
-                       <dd>
-                               <input type="text" name="server" id="server" value="{$server}" autofocus="autofocus" class="long" />
-                               {if $errorField == 'server'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}{lang}wcf.global.form.error.empty{/lang}{/if}
-                                               {if $errorType == 'notValid'}{lang}wcf.acp.languageServer.server.error.notValid{/lang}{/if}
-                                       </small>
-                               {/if}
-                               <small>{lang}wcf.acp.languageServer.server.description{/lang}</small>
-                       </dd>
-               </dl>
-               
-               {event name='dataFields'}
-       </section>
-       
-       {event name='sections'}
-       
-       <div class="formSubmit">
-               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
-               {@SECURITY_TOKEN_INPUT_TAG}
-       </div>
-</form>
-
-{include file='footer'}
diff --git a/wcfsetup/install/files/acp/templates/languageServerList.tpl b/wcfsetup/install/files/acp/templates/languageServerList.tpl
deleted file mode 100644 (file)
index 6f838b5..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-{include file='header' pageTitle='wcf.acp.languageServer.list'}
-
-<script data-relocate="true">
-       //<![CDATA[
-       $(function() {
-               new WCF.Action.Delete('wcf\\data\\language\\server\\LanguageServerAction', '.jsLanguageServerRow');
-               new WCF.Action.Toggle('wcf\\data\\language\\server\\LanguageServerAction', '.jsLanguageServerRow');
-       });
-       //]]>
-</script>
-
-<header class="contentHeader">
-       <h1 class="contentTitle">{lang}wcf.acp.languageServer.list{/lang}</h1>
-</header>
-
-<div class="contentNavigation">
-       {pages print=true assign=pagesLinks controller='LanguageServerList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
-       
-       <nav>
-               <ul>
-                       <li><a href="{link controller='LanguageServerAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.languageServer.add{/lang}</span></a></li>
-                       
-                       {event name='contentNavigationButtonsTop'}
-               </ul>
-       </nav>
-</div>
-
-{if !$languageServers|count}
-       <p class="info">{lang}wcf.global.noItems{/lang}</p>
-{else}
-       <div class="section tabularBox">
-               <table class="table">
-                       <thead>
-                               <tr>
-                                       <th class="columnID columnLanguageServerID{if $sortField == 'languageServerID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='LanguageServerList'}pageNo={@$pageNo}&sortField=languageServerID&sortOrder={if $sortField == 'languageServerID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
-                                       <th class="columnTitle columnServerURL{if $sortField == 'serverURL'} active {@$sortOrder}{/if}"><a href="{link controller='LanguageServerList'}pageNo={@$pageNo}&sortField=serverURL&sortOrder={if $sortField == 'serverURL' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.languageServer.serverURL{/lang}</a></th>
-                                       
-                                       {event name='columnHeads'}
-                               </tr>
-                       </thead>
-                       <tbody>
-                               {foreach from=$languageServers item=languageServer}
-                                       <tr class="jsLanguageServerRow">
-                                               <td class="columnIcon">
-                                                       <span class="icon icon16 fa-{if !$languageServer->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$languageServer->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$languageServer->languageServerID}"></span>
-                                                       <a href="{link controller='LanguageServerEdit' id=$languageServer->languageServerID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
-                                                       
-                                                       <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$languageServer->languageServerID}" data-confirm-message="{lang}wcf.acp.languageServer.delete.sure{/lang}"></span>
-                                                       
-                                                       {event name='rowButtons'}
-                                               </td>
-                                               <td class="columnID columnLanguageServerID">{@$languageServer->languageServerID}</td>
-                                               <td class="columnTitle columnServerURL">
-                                                       <a href="{link controller='LanguageServerEdit' id=$languageServer->languageServerID}{/link}">{$languageServer->serverURL}</a>
-                                               </td>
-                                               
-                                               {event name='columns'}
-                                       </tr>
-                               {/foreach}
-                       </tbody>
-               </table>
-       </div>
-       
-       <div class="contentNavigation">
-               {@$pagesLinks}
-               
-               <nav>
-                       <ul>
-                               <li><a href="{link controller='LanguageServerAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.languageServer.add{/lang}</span></a></li>
-                               
-                               {event name='contentNavigationButtonsBottom'}
-                       </ul>
-               </nav>
-       </div>
-{/if}
-
-{include file='footer'}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php
deleted file mode 100644 (file)
index 6dd5ca3..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-namespace wcf\acp\form;
-use wcf\data\language\server\LanguageServerAction;
-use wcf\data\package\update\server\PackageUpdateServer;
-use wcf\form\AbstractForm;
-use wcf\system\exception\UserInputException;
-use wcf\system\WCF;
-use wcf\system\WCFACP;
-use wcf\util\StringUtil;
-
-/**
- * Shows the language server add form.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage acp.form
- * @category   Community Framework
- */
-class LanguageServerAddForm extends AbstractForm {
-       /**
-        * @see \wcf\page\AbstractPage::$activeMenuItem
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.language.server.add';
-       
-       /**
-        * @see \wcf\page\AbstractPage::$neededPermissions
-        */
-       public $neededPermissions = array('admin.language.canManageLanguage');
-       
-       /**
-        * server url
-        * @var string
-        */
-       public $server = '';
-       
-       /**
-        * @see \wcf\form\IForm::readFormParameters()
-        */
-       public function readFormParameters() {
-               parent::readFormParameters();
-               
-               if (isset($_POST['server'])) $this->server = StringUtil::trim($_POST['server']);
-       }
-       
-       /**
-        * @see \wcf\form\IForm::validate()
-        */
-       public function validate() {
-               parent::validate();
-               
-               if (empty($this->server)) {
-                       throw new UserInputException('server');
-               }
-               
-               if (!PackageUpdateServer::isValidServerURL($this->server)) {
-                       throw new UserInputException('server', 'notValid');
-               }
-       }
-       
-       /**
-        * @see \wcf\form\IForm::save()
-        */
-       public function save() {
-               parent::save();
-               
-               // save server
-               $this->objectAction = new LanguageServerAction(array(), 'create', array('data' => array_merge($this->additionalFields, array(
-                       'serverURL' => $this->server
-               ))));
-               $this->objectAction->executeAction();
-               $this->saved();
-               
-               // reset values
-               $this->server = '';
-               
-               // show success message
-               WCF::getTPL()->assign('success', true);
-       }
-       
-       /**
-        * @see \wcf\page\IPage::assignVariables()
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign(array(
-                       'server' => $this->server,
-                       'action' => 'add'
-               ));
-       }
-       
-       /**
-        * @see \wcf\page\IPage::assignVariables()
-        */
-       public function show() {
-               // check master password
-               WCFACP::checkMasterPassword();
-               
-               parent::show();
-       }
-}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php
deleted file mode 100644 (file)
index 3212508..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-namespace wcf\acp\form;
-use wcf\data\language\server\LanguageServer;
-use wcf\data\language\server\LanguageServerAction;
-use wcf\form\AbstractForm;
-use wcf\system\exception\IllegalLinkException;
-use wcf\system\WCF;
-
-/**
- * Shows the language server edit form.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage acp.form
- * @category   Community Framework
- */
-class LanguageServerEditForm extends LanguageServerAddForm {
-       /**
-        * @see \wcf\page\AbstractPage::$activeMenuItem
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.language.server';
-       
-       /**
-        * language server id
-        * @var integer
-        */
-       public $languageServerID = 0;
-       
-       /**
-        * active language server
-        * @var \wcf\data\language\server\LanguageServer
-        */
-       public $languageServer = null;
-       
-       /**
-        * @see \wcf\page\IPage::readParameters()
-        */
-       public function readParameters() {
-               parent::readParameters();
-               
-               if (isset($_REQUEST['id'])) $this->languageServerID = intval($_REQUEST['id']);
-               $this->languageServer = new LanguageServer($this->languageServerID);
-               if (!$this->languageServer->languageServerID) {
-                       throw new IllegalLinkException();
-               }
-       }
-       
-       /**
-        * @see \wcf\form\IForm::save()
-        */
-       public function save() {
-               AbstractForm::save();
-               
-               // save server
-               $this->objectAction = new LanguageServerAction(array($this->languageServerID), 'update', array('data' => array_merge($this->additionalFields, array(
-                       'serverURL' => $this->server
-               ))));
-               $this->objectAction->executeAction();
-               $this->saved();
-               
-               // show success message
-               WCF::getTPL()->assign('success', true);
-       }
-       
-       /**
-        * @see \wcf\page\IPage::readData()
-        */
-       public function readData() {
-               parent::readData();
-               
-               if (empty($_POST)) {
-                       $this->server = $this->languageServer->serverURL;
-               }
-       }
-       
-       /**
-        * @see \wcf\page\IPage::assignVariables()
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-                       
-               WCF::getTPL()->assign(array(
-                       'languageServerID' => $this->languageServerID,
-                       'languageServer' => $this->languageServer,
-                       'action' => 'edit'
-               ));
-       }
-}
diff --git a/wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php b/wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php
deleted file mode 100644 (file)
index 03549f6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-namespace wcf\acp\page;
-use wcf\page\SortablePage;
-use wcf\system\WCF;
-
-/**
- * Shows information about available language servers.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage acp.page
- * @category   Community Framework
- */
-class LanguageServerListPage extends SortablePage {
-       /**
-        * @see \wcf\page\AbstractPage::$activeMenuItem
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.language.server.list';
-       
-       /**
-        * @see \wcf\page\SortablePage::$defaultSortField
-        */
-       public $defaultSortField = 'serverURL';
-       
-       /**
-        * @see \wcf\page\AbstractPage::$neededPermissions
-        */
-       public $neededPermissions = array('admin.language.canManageLanguage');
-       
-       /**
-        * @see \wcf\page\MultipleLinkPage::$objectListClassName
-        */
-       public $objectListClassName = 'wcf\data\language\server\LanguageServerList';
-       
-       /**
-        * @see \wcf\page\SortablePage::$validSortFields
-        */
-       public $validSortFields = array('languageServerID', 'serverURL');
-       
-       /**
-        * @see \wcf\page\IPage::assignVariables()
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign(array(
-                       'languageServers' => $this->objectList->getObjects()
-               ));
-       }
-}
diff --git a/wcfsetup/install/files/lib/data/language/server/LanguageServer.class.php b/wcfsetup/install/files/lib/data/language/server/LanguageServer.class.php
deleted file mode 100644 (file)
index bc0ef23..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-namespace wcf\data\language\server;
-use wcf\data\DatabaseObject;
-
-/**
- * Represents a language server.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.language.server
- * @category   Community Framework
- *
- * @property-read      integer         $languageServerID
- * @property-read      string          $serverURL
- * @property-read      integer         $isDisabled
- */
-class LanguageServer extends DatabaseObject {
-       /**
-        * @see \wcf\data\DatabaseObject::$databaseTableName
-        */
-       protected static $databaseTableName = 'language_server';
-       
-       /**
-        * @see \wcf\data\DatabaseObject::$databaseTableIndexName
-        */
-       protected static $databaseTableIndexName = 'languageServerID';
-}
diff --git a/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php b/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php
deleted file mode 100644 (file)
index d41714e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-namespace wcf\data\language\server;
-use wcf\data\AbstractDatabaseObjectAction;
-use wcf\data\IToggleAction;
-
-/**
- * Executes language server-related actions.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.language.server
- * @category   Community Framework
- */
-class LanguageServerAction extends AbstractDatabaseObjectAction implements IToggleAction {
-       /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$className
-        */
-       protected $className = 'wcf\data\language\server\LanguageServerEditor';
-       
-       /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate
-        */
-       protected $permissionsCreate = array('admin.language.canManageLanguage');
-       
-       /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
-        */
-       protected $permissionsDelete = array('admin.language.canManageLanguage');
-       
-       /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
-        */
-       protected $permissionsUpdate = array('admin.language.canManageLanguage');
-       
-       /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP
-        */
-       protected $requireACP = array('create', 'delete', 'toggle', 'update');
-       
-       /**
-        * @see \wcf\data\IToggleAction::toggle()
-        */
-       public function toggle() {
-               foreach ($this->objects as $serverEditor) {
-                       $serverEditor->update(array(
-                               'isDisabled' => $serverEditor->isDisabled ? 0 : 1
-                       ));
-               }
-       }
-       
-       /**
-        * @see \wcf\data\IToggleAction::validateToggle()
-        */
-       public function validateToggle() {
-               $this->validateUpdate();
-       }
-}
diff --git a/wcfsetup/install/files/lib/data/language/server/LanguageServerEditor.class.php b/wcfsetup/install/files/lib/data/language/server/LanguageServerEditor.class.php
deleted file mode 100644 (file)
index 8d8e895..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\language\server;
-use wcf\data\DatabaseObjectEditor;
-
-/**
- * Provides functions to edit language servers.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.language.server
- * @category   Community Framework
- */
-class LanguageServerEditor extends DatabaseObjectEditor {
-       /**
-        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
-        */
-       protected static $baseClass = 'wcf\data\language\server\LanguageServer';
-}
diff --git a/wcfsetup/install/files/lib/data/language/server/LanguageServerList.class.php b/wcfsetup/install/files/lib/data/language/server/LanguageServerList.class.php
deleted file mode 100644 (file)
index b650d48..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-namespace wcf\data\language\server;
-use wcf\data\DatabaseObjectList;
-
-/**
- * Represents a list of language servers.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage data.language.server
- * @category   Community Framework
- */
-class LanguageServerList extends DatabaseObjectList {
-       /**
-        * @see \wcf\data\DatabaseObjectList::$className
-        */
-       public $className = 'wcf\data\language\server\LanguageServer';
-}
diff --git a/wcfsetup/install/files/lib/system/language/LanguageServerProcessor.class.php b/wcfsetup/install/files/lib/system/language/LanguageServerProcessor.class.php
deleted file mode 100644 (file)
index 4184c3a..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-<?php
-namespace wcf\system\language;
-use wcf\data\language\server\LanguageServer;
-use wcf\data\language\Language;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\exception\SystemException;
-use wcf\system\io\RemoteFile;
-use wcf\system\SingletonFactory;
-use wcf\system\WCF;
-use wcf\util\XML;
-
-/**
- * Processes language item import from language servers.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.language
- * @category   Community Framework
- */
-class LanguageServerProcessor extends SingletonFactory {
-       /**
-        * language object
-        * @var \wcf\data\language\Language
-        */
-       protected $language = null;
-       
-       /**
-        * Imports language variables for a language from given language servers.
-        * 
-        * @param       \wcf\data\language\Language     $language
-        * @param       LanguageServer[]                $languageServers
-        */
-       public function import(Language $language, array $languageServers) {
-               if (empty($languageServers)) return;
-               $this->language = $language;
-               
-               // get package list
-               $packageList = $this->getPackageList();
-               
-               foreach ($languageServers as $languageServer) {
-                       $this->importLanguageFile($languageServer->serverURL, $packageList);
-               }
-       }
-       
-       /**
-        * Returns list of installed packages and their associated version.
-        * 
-        * @return      string[]
-        */
-       protected function getPackageList() {
-               $sql = "SELECT  package, packageVersion
-                       FROM    wcf".WCF_N."_package";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute();
-               
-               $packages = array();
-               while ($row = $statement->fetchArray()) {
-                       $packages[$row['package']] = $row['packageVersion'];
-               }
-               
-               return $packages;
-       }
-       
-       /**
-        * Downloads and imports a language file from a language server.
-        * 
-        * @param       string          $location
-        * @param       string[]        $packageList
-        * @throws      SystemException
-        */
-       protected function importLanguageFile($location, array $packageList) {
-               // get proxy
-               $options = array();
-               if (PROXY_SERVER_HTTP) {
-                       $options['http']['proxy'] = PROXY_SERVER_HTTP;
-                       $options['http']['request_fulluri'] = true;
-               }
-               
-               // parse url
-               $parsedURL = parse_url($location);
-               $port = ($parsedURL['scheme'] == 'https' ? 443 : 80);
-               $host = $parsedURL['host'];
-               $path = (isset($parsedURL['path']) ? $parsedURL['path'] : '/');
-               
-               $remoteFile = new RemoteFile(($parsedURL['scheme'] == 'https' ? 'ssl://' : '').$host, $port, 30, $options); // the file to read.
-               if (!isset($remoteFile)) {
-                       throw new SystemException("cannot connect to http host '".$host."'");
-               }
-               
-               // build and send the http request
-               $request = "POST ".$path." HTTP/1.0\r\n";
-               $request .= "User-Agent: HTTP.PHP (LanguageServerProcessor.class.php; WoltLab Community Framework/".WCF_VERSION."; ".WCF::getLanguage()->languageCode.")\r\n";
-               $request .= "Accept: */*\r\n";
-               $request .= "Accept-Language: ".WCF::getLanguage()->languageCode."\r\n";
-               $request .= "Host: ".$host."\r\n";
-               
-               // build post string
-               $postString = 'languageCode='.$this->language->languageCode;
-               foreach ($packageList as $package => $packageVersion) {
-                       $postString .= '&packages['.urlencode($package).']='.urlencode($packageVersion);
-               }
-               
-               // send content type and length
-               $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
-               $request .= "Content-Length: ".strlen($postString)."\r\n";
-               // if it is a POST request, there MUST be a blank line before the POST data, but there MUST NOT be
-               // another blank line before, and of course there must be another blank line at the end of the request!
-               $request .= "\r\n";
-               if (!empty($postString)) $request .= $postString."\r\n";
-               // send close
-               $request .= "Connection: Close\r\n\r\n";
-               
-               // send request
-               $remoteFile->puts($request);
-               
-               // define response vars
-               $header = $content = '';
-               
-               // fetch the response.
-               while (!$remoteFile->eof()) {
-                       $line = $remoteFile->gets();
-                       if (rtrim($line) != '') {
-                               $header .= $line;
-                       } else {
-                               break;
-                       }
-               }
-               while (!$remoteFile->eof()) {
-                       $content .= $remoteFile->gets();
-               }
-               
-               // clean up and return the server's response.
-               $remoteFile->close();
-               
-               // get http status code / line
-               $httpStatusCode = 0;
-               $httpStatusLine = '';
-               if (preg_match('%http/\d\.\d (\d{3})[^\n]*%i', $header, $match)) {
-                       $httpStatusLine = trim($match[0]);
-                       $httpStatusCode = $match[1];
-               }
-               
-               // catch http 301 Moved Permanently
-               // catch http 302 Found
-               // catch http 303 See Other
-               if ($httpStatusCode == 301 || $httpStatusCode == 302 || $httpStatusCode == 303) {
-                       // find location
-                       if (preg_match('/location:([^\n]*)/i', $header, $match)) {
-                               $newLocation = trim($match[1]);
-                               if ($newLocation != $location) {
-                                       $this->importLanguageFile($location, $packageList);
-                                       return;
-                               }
-                       }
-               }
-               
-               $this->parseResponse($content);
-       }
-       
-       /**
-        * Parses XML response from language server.
-        * 
-        * @param       string          $xmlResponse
-        */
-       protected function parseResponse($xmlResponse) {
-               // parse xml
-               $xml = new XML();
-               $xml->loadXML('languageServerResponse.xml', $xmlResponse);
-               $xpath = $xml->xpath();
-               
-               // parse variables
-               $variables = array();
-               $packages = $xpath->query('/ns:language/ns:package');
-               foreach ($packages as $package) {
-                       $packageName = $package->getAttribute('name');
-                       $variables[$packageName] = array();
-                       
-                       $categories = $xpath->query('child::ns:category', $package);
-                       foreach ($categories as $category) {
-                               $categoryName = $category->getAttribute('name');
-                               $variables[$packageName][$categoryName] = array();
-                               
-                               $items = $xpath->query('child::ns:item', $category);
-                               foreach ($items as $item) {
-                                       $variables[$packageName][$categoryName][$item->getAttribute('name')] = $item->nodeValue;
-                               }
-                       }
-               }
-               
-               // try to resolve packages
-               $conditions = new PreparedStatementConditionBuilder();
-               $conditions->add("package IN (?)", array(array_keys($variables)));
-               
-               $sql = "SELECT  packageID, package
-                       FROM    wcf".WCF_N."_package
-                       ".$conditions;
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute($conditions->getParameters());
-               $packages = array();
-               while ($row = $statement->fetchArray()) {
-                       $packages[$row['package']] = $row['packageID'];
-               }
-               
-               // ignore variables if no package is known
-               if (empty($packages)) return;
-               
-               $this->importVariables($variables, $packages);
-       }
-       
-       /**
-        * Imports language variables and categories.
-        * 
-        * @param       array           $variables
-        * @param       integer[]       $packages
-        */
-       protected function importVariables(array $variables, array $packages) {
-               $categories = $this->importCategories($variables);
-               
-               $createItems = $updateItems = array();
-               foreach ($packages as $package => $packageID) {
-                       foreach ($variables[$package] as $category => $items) {
-                               // get existing items
-                               $conditions = new PreparedStatementConditionBuilder();
-                               $conditions->add("languageID = ?", array($this->language->languageID));
-                               $conditions->add("packageID = ?", array($packageID));
-                               $conditions->add("languageCategoryID = ?", array($categories[$category]));
-                               $conditions->add("languageItem IN (?)", array(array_keys($items)));
-                                       
-                               $sql = "SELECT  languageItemID, languageItem
-                                       FROM    wcf".WCF_N."_language_item
-                                       ".$conditions;
-                               $statement = WCF::getDB()->prepareStatement($sql);
-                               $statement->execute($conditions->getParameters());
-                               
-                               $existingItemIDs = array();
-                               while ($row = $statement->fetchArray()) {
-                                       $existingItemIDs[$row['languageItem']] = $row['languageItemID'];
-                               }
-                               
-                               foreach ($items as $itemName => $itemValue) {
-                                       if (isset($existingItemIDs[$itemName])) {
-                                               $updateItems[$existingItemIDs[$itemName]] = $itemValue;
-                                       }
-                                       else {
-                                               $createItems[] = array(
-                                                       'languageID' => $this->language->languageID,
-                                                       'languageItem' => $itemName,
-                                                       'languageItemValue'=> $itemValue,
-                                                       'languageItemOriginIsSystem' => 1,
-                                                       'languageCategoryID' => $categories[$category],
-                                                       'packageID' => $packageID
-                                               );
-                                       }
-                               }
-                       }
-               }
-               
-               // create items
-               if (!empty($createItems)) {
-                       $sql = "INSERT INTO     wcf".WCF_N."_language_item
-                                               (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)
-                               VALUES          (?, ?, ?, ?, ?, ?)";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       
-                       foreach ($createItems as $item) {
-                               $statement->execute(array(
-                                       $item['languageID'],
-                                       $item['languageItem'],
-                                       $item['languageItemValue'],
-                                       $item['languageItemOriginIsSystem'],
-                                       $item['languageCategoryID'],
-                                       $item['packageID']
-                               ));
-                       }
-               }
-               
-               // update items
-               if (!empty($updateItems)) {
-                       $sql = "UPDATE  wcf".WCF_N."_language_item
-                               SET     languageItemValue = ?
-                               WHERE   languageItemID = ?";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       
-                       foreach ($updateItems as $languageItemID => $languageItemValue) {
-                               $statement->execute(array($languageItemID, $languageItemValue));
-                       }
-               }
-       }
-       
-       /**
-        * Imports new langage categories.
-        * 
-        * @param       array           $variables
-        * @return      array
-        */
-       protected function importCategories(array $variables) {
-               // get categories
-               $categoryNames = array();
-               foreach ($variables as $package => $dummy) {
-                       $categoryNames = array_merge($categoryNames, array_keys($variables[$package]));
-               }
-               
-               // fetch existing categories
-               $conditions = new PreparedStatementConditionBuilder();
-               $conditions->add("languageCategory IN (?)", array($categoryNames));
-               
-               $sql = "SELECT  languageCategoryID, languageCategory
-                       FROM    wcf".WCF_N."_language_category
-                       ".$conditions;
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute($conditions->getParameters());
-               
-               $existingCategories = array();
-               while ($row = $statement->fetchArray()) {
-                       $existingCategories[$row['languageCategory']] = $row['languageCategoryID'];
-               }
-               
-               // create non-existing categories
-               $createCategories = array_diff($categoryNames, array_keys($existingCategories));
-               if (!empty($createCategories)) {
-                       // use raw queries for better performance
-                       $sql = "INSERT INTO     wcf".WCF_N."_language_category
-                                               (languageCategory)
-                               VALUES          (?)";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       foreach ($createCategories as $category) {
-                               $statement->execute(array($category));
-                       }
-                       
-                       // get ids for created categories
-                       $conditions = new PreparedStatementConditionBuilder();
-                       $conditions->add("languageCategory IN (?)", array($createCategories));
-                       
-                       $sql = "SELECT  languageCategoryID, languageCategory
-                               FROM    wcf".WCF_N."_language_category
-                               ".$conditions;
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute($conditions->getParameters());
-                       
-                       while ($row = $statement->fetchArray()) {
-                               $existingCategories[$row['languageCategory']] = $row['languageCategoryID'];
-                       }
-               }
-               
-               return $existingCategories;
-       }
-}
index b47681c659de40d4bb95459d991cad067a816262..b0d106d2d05899672124af4ea189e563147237b7 100644 (file)
@@ -513,13 +513,6 @@ CREATE TABLE wcf1_language_item (
        KEY languageItemOriginIsSystem (languageItemOriginIsSystem)
 );
 
-DROP TABLE IF EXISTS wcf1_language_server;
-CREATE TABLE wcf1_language_server (
-       languageServerID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-       serverURL VARCHAR(255) NOT NULL DEFAULT '',
-       isDisabled TINYINT(1) NOT NULL DEFAULT 0
-);
-
 DROP TABLE IF EXISTS wcf1_like;
 CREATE TABLE wcf1_like (
        likeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,