This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into vortex
# Conflicts: # package.xml # update.sql # update126.sql
- Loading branch information
Showing
2 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use wcf\data\object\type\ObjectType; | ||
use wcf\data\todo\ToDoEditor; | ||
use wcf\data\todo\ToDoList; | ||
use wcf\system\comment\CommentHandler; | ||
use wcf\system\WCF; | ||
|
||
/** | ||
* @author Florian Gail | ||
* @copyright 2014-2016 Florian Gail <https://www.mysterycode.de/> | ||
* @license Kostenlose Plugins <https://downloads.mysterycode.de/license/6-kostenlose-plugins/> | ||
* @package de.mysterycode.wcf.toDo | ||
*/ | ||
$package = $this->installation->getPackage(); | ||
|
||
$sql = "SELECT otype.objectTypeID | ||
FROM wcf" . WCF_N . "_object_type otype, | ||
wcf" . WCF_N . "_object_type_definition odef | ||
WHERE otype.objectType = ? | ||
AND odef.definitionName = ? | ||
AND otype.definitionID = odef.definitionID"; | ||
$statement = WCF::getDB()->prepareStatement($sql); | ||
$statement->execute(['de.mysterycode.wcf.toDo.toDoComment', 'com.woltlab.wcf.comment.commentableContent']); | ||
$objectTypeID = $statement->fetchSingleRow(PDO::FETCH_COLUMN); | ||
|
||
if ($objectTypeID !== false || !($objectTypeID > 0)) { | ||
$objectType = new ObjectType($objectTypeID); | ||
$commentManager = $objectType->getProcessor(); | ||
|
||
$todoList = new ToDoList(); | ||
$todoList->readObjects(); | ||
|
||
foreach ($todoList->getObjects() as $todo) { | ||
$commentList = CommentHandler::getInstance()->getCommentList($commentManager, $objectTypeID, $todo->todoID); | ||
$todoEditor = new ToDoEditor($todo); | ||
$todoEditor->update([ | ||
'comments' => $commentList->countObjects() | ||
]); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters