Added SQL update
authorAlexander Ebert <ebert@woltlab.com>
Thu, 11 Jul 2013 11:56:25 +0000 (13:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 11 Jul 2013 11:56:25 +0000 (13:56 +0200)
com.woltlab.wcf/update_b5.sql
wcfsetup/install/files/acp/update_b5.php [new file with mode: 0644]

index 06527d414631f655bf16049f162f6c16403523d1..da099a3253af3d6e69f014ac354a783fb562c4dc 100644 (file)
@@ -1,2 +1,6 @@
 /* 83689a3 */
 ALTER TABLE wcf1_user_group_option DROP COLUMN adminDefaultValue;
+
+/* a16ee11 */
+DROP TABLE wcf1_user_activity_point_event;
+ALTER TABLE wcf1_user_activity_point ADD items INT(10) NOT NULL DEFAULT '0';
\ No newline at end of file
diff --git a/wcfsetup/install/files/acp/update_b5.php b/wcfsetup/install/files/acp/update_b5.php
new file mode 100644 (file)
index 0000000..739ba8c
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\WCF;
+
+$sql = "UPDATE wcf".WCF_N."_user_activity_point
+       SET     items = FLOOR(activityPoints / ?)
+       WHERE   objectTypeID = ?";
+$statement = WCF::getDB()->prepareStatement($sql);
+
+foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.activityPointEvent') as $objectType) {
+       // prevent division by zero
+       if (!$objectType->points) {
+               continue;
+       }
+       
+       $statement->execute(array(
+               $objectType->points,
+               $objectType->objectTypeID
+       ));
+}