Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into vortex
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.xml
#	update.sql
#	update126.sql
  • Loading branch information
mutec committed Aug 3, 2017
2 parents 66c60d5 + 646045c commit 5d2d8fe
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
43 changes: 43 additions & 0 deletions files/acp/update_de.mysterycode.wcf.todo.php
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()
]);
}
}


13 changes: 7 additions & 6 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
<instruction type="file" />
<instruction type="template" />

<!-- SQL -->
<instruction type="sql">update126.sql</instruction>

<!-- XMLs -->
<instruction type="objectType">xml/objectType.xml</instruction>
<instruction type="userNotificationEvent">xml/userNotificationEvent.xml</instruction>
Expand All @@ -72,6 +69,10 @@
<instruction type="page">xml/page.xml</instruction>
<instruction type="menuItem">xml/menuItem.xml</instruction>

<!-- SQL -->
<instruction type="sql">update126.sql</instruction>
<instruction type="script">acp/update_de.mysterycode.wcf.todo.php</instruction>

<instruction type="language" />
</instructions>
<instructions type="update" fromversion="2.0.0 Beta 2">
Expand All @@ -80,9 +81,6 @@
<instruction type="file" />
<instruction type="template" />

<!-- SQL -->
<instruction type="sql">update200b2.sql</instruction>

<!-- XMLs -->
<instruction type="objectType">xml/objectType.xml</instruction>
<instruction type="userNotificationEvent">xml/userNotificationEvent.xml</instruction>
Expand All @@ -97,6 +95,9 @@
<instruction type="page">xml/page.xml</instruction>
<instruction type="menuItem">xml/menuItem.xml</instruction>

<!-- SQL -->
<instruction type="script">acp/update_de.mysterycode.wcf.todo_1.2.0.php</instruction>

<instruction type="language" />
</instructions>
</package>

0 comments on commit 5d2d8fe

Please sign in to comment.