From: Alexander Ebert Date: Sun, 1 Feb 2015 14:51:39 +0000 (+0100) Subject: Increased displayed comments from 10/3 to 30/5 X-Git-Tag: 2.1.0_Beta_4~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9d007b407fca905603affe5c31ff98d2cbdf6764;p=GitHub%2FWoltLab%2FWCF.git Increased displayed comments from 10/3 to 30/5 --- diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index f7ef2b9720..94b3e47602 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -86,6 +86,7 @@ userProfileMenu.xml acp/update_mqc_com.woltlab.wcf_2.1.php + acp/rebuild_comments_com.woltlab.wcf_2.1.php @@ -97,5 +98,7 @@ option.xml userMenu.xml + + acp/rebuild_comments_com.woltlab.wcf_2.1.php diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index fc56a362a8..307a5ec498 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -62,7 +62,6 @@ $(function() { var $config = { autosave: false, buttons: $buttons, - buttonSource: true, convertImageLinks: false, convertUrlLinks: false, convertVideoLinks: false, @@ -73,6 +72,7 @@ $(function() { plugins: [ 'wutil', 'wmonkeypatch', 'table', 'wbutton', 'wbbcode', 'wfontcolor', 'wfontfamily', 'wfontsize', 'wupload' ], removeEmpty: false, replaceDivs: false, + source: true, tabifier: false, toolbarFixed: false, woltlab: { diff --git a/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php b/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php new file mode 100644 index 0000000000..cbd78c3935 --- /dev/null +++ b/wcfsetup/install/files/acp/rebuild_comments_com.woltlab.wcf_2.1.php @@ -0,0 +1,88 @@ + + * @package com.woltlab.wcf + * @category Community Framework + */ +$rebuildData = WCF::getSession()->getVar('__wcfUpdateRebuildComments'); +if ($rebuildData === null) { + $sql = "SELECT COUNT(*) AS count + FROM wcf".WCF_N."_comment + WHERE responses > ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array(3)); + $row = $statement->fetchSingleRow(); + + $rebuildData = array( + 'i' => 0, + 'max' => 0 + ); + + if ($row['count']) { + $rebuildData['max'] = ceil($row['count'] / 50); + } +} + +if ($rebuildData['max']) { + $offset = $rebuildData['i'] * 50; + + // get comments + $sql = "SELECT commentID + FROM wcf".WCF_N."_comment + WHERE responses > ? + ORDER BY commentID"; + $statement = WCF::getDB()->prepareStatement($sql, 50, $offset); + $statement->execute(array(3)); + + $commentData = array(); + while ($row = $statement->fetchArray()) { + $commentData[$row['commentID']] = array(); + } + + if (empty($commentData)) { + WCF::getSession()->unregister('__wcfUpdateRebuildComments'); + } + else { + // get responses per comment + $sql = "SELECT responseID + FROM wcf".WCF_N."_comment_response + WHERE commentID = ? + ORDER BY time"; + $statement = WCF::getDB()->prepareStatement($sql, 5); + + foreach ($commentData as $commentID => &$responseIDs) { + $statement->execute(array($commentID)); + while ($row = $statement->fetchArray()) { + $responseIDs[] = $row['responseID']; + } + + $responseIDs = serialize($responseIDs); + } + + // set responseIDs per comment + $sql = "UPDATE wcf".WCF_N."_comment + SET responseIDs = ? + WHERE commentID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + WCF::getDB()->beginTransaction(); + foreach ($commentData as $commentID => $responseIDs) { + $statement->execute(array( + $responseIDs, + $commentID + )); + } + WCF::getDB()->commitTransaction(); + + $rebuildData['i']++; + WCF::getSession()->register('__wcfUpdateRebuildComments', $rebuildData); + + // call this script again + throw new SplitNodeException(); + } +} + diff --git a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php index 93e496b4ff..58f6b011a7 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@ -333,7 +333,7 @@ class CommentAction extends AbstractDatabaseObjectAction { // update response data $responseIDs = $this->comment->getResponseIDs(); - if (count($responseIDs) < 3) { + if (count($responseIDs) < 5) { $responseIDs[] = $this->createdResponse->responseID; } $responses = $this->comment->responses + 1; diff --git a/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php b/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php index e95d67830d..c4c6a57493 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentEditor.class.php @@ -7,7 +7,7 @@ use wcf\system\WCF; * Provides functions to edit comments. * * @author Alexander Ebert - * @copyright 2001-2014 WoltLab GmbH + * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.comment @@ -27,7 +27,7 @@ class CommentEditor extends DatabaseObjectEditor { FROM wcf".WCF_N."_comment_response WHERE commentID = ? ORDER BY time ASC"; - $statement = WCF::getDB()->prepareStatement($sql, 3); + $statement = WCF::getDB()->prepareStatement($sql, 5); $statement->execute(array($this->commentID)); $responseIDs = array(); while ($row = $statement->fetchArray()) { diff --git a/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php b/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php index 1e3c07a477..f8d8b9d3b6 100644 --- a/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php +++ b/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php @@ -50,7 +50,7 @@ class StructuredCommentList extends CommentList { /** * @see \wcf\data\DatabaseObjectList::$sqlLimit */ - public $sqlLimit = 10; + public $sqlLimit = 30; /** * @see \wcf\data\DatabaseObjectList::$sqlOrderBy diff --git a/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php index 73c3cfd531..1291841070 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php @@ -9,7 +9,7 @@ use wcf\system\WCF; * Default implementation for comment managers. * * @author Alexander Ebert - * @copyright 2001-2014 WoltLab GmbH + * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.comment.manager @@ -20,7 +20,7 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme * display comments per page * @var integer */ - public $commentsPerPage = 10; + public $commentsPerPage = 30; /** * permission name for comment/response creation