<!-- /message.general -->
<!-- message.general.edit -->
+ <option name="module_edit_history">
+ <categoryname>message.general.edit</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>1</defaultvalue>
+ <enableoptions>edit_history_expiration</enableoptions>
+ </option>
<option name="edit_history_expiration">
<categoryname>message.general.edit</categoryname>
<optiontype>integer</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
<usersonly>1</usersonly>
+ <options>module_edit_history</options>
</option>
<option name="admin.content.label.canManageLabel">
* @category Community Framework
*/
class UserContentRevertChangesForm extends AbstractForm {
+ /**
+ * @see \wcf\page\AbstractPage::$neededModules
+ */
+ public $neededModules = array('MODULE_EDIT_HISTORY');
+
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
namespace wcf\data\edit\history\entry;
use wcf\data\object\type\ObjectTypeCache;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\exception\IllegalLinkException;
/**
* Executes edit history entry-related actions.
* Checks permissions to revert.
*/
public function validateRevert() {
+ if (!MODULE_EDIT_HISTORY) {
+ throw new IllegalLinkException();
+ }
+
$historyEntry = $this->getSingleObject();
$objectType = ObjectTypeCache::getInstance()->getObjectType($historyEntry->objectTypeID);
* @category Community Framework
*/
class EditHistoryPage extends AbstractPage {
+ /**
+ * @see \wcf\page\AbstractPage::$neededModules
+ */
+ public $neededModules = array('MODULE_EDIT_HISTORY');
+
/**
* DatabaseObjectList object
* @var \wcf\data\DatabaseObjectList
}
/**
- * Returns the ids of the users which can be enabled.
+ * Returns the ids of the users whose edits can be reverted.
*
* @return array<integer>
*/
- protected function validateRevertChanges() {
+ protected function validateRevertContentChanges() {
+ if (!MODULE_EDIT_HISTORY) {
+ return array();
+ }
+
// check permissions
if (!WCF::getSession()->getPermission('admin.content.canBulkRevertContentChanges')) {
return array();
));
// clean up expired edit history entries
- if (EDIT_HISTORY_EXPIRATION) {
- $sql = "DELETE FROM wcf".WCF_N."_edit_history_entry
- WHERE obsoletedAt < ?";
+ if (MODULE_EDIT_HISTORY) {
+ if (EDIT_HISTORY_EXPIRATION) {
+ $sql = "DELETE FROM wcf".WCF_N."_edit_history_entry
+ WHERE obsoletedAt < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
(TIME_NOW - 86400 * EDIT_HISTORY_EXPIRATION)
));
+ }
+ }
+ else {
+ // edit history is disabled, prune old versions
+ $sql = "DELETE FROM wcf".WCF_N."_edit_history_entry";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
}
// clean up user authentication failure log
* @param integer $obsoletedByUserID The userID of the user that forced this entry to become outdated
*/
public function add($objectType, $objectID, $message, $time, $userID, $username, $editReason, $obsoletedByUserID) {
+ // no op, if edit history is disabled
+ if (!MODULE_EDIT_HISTORY) return;
+
// save new entry
$sql = "INSERT INTO wcf".WCF_N."_edit_history_entry
(objectTypeID, objectID, message, time, obsoletedAt, userID, username, editReason, obsoletedByUserID)
<item name="wcf.acp.option.enable_share_buttons"><![CDATA[Buttons zum Teilen von Inhalten anzeigen]]></item>
<item name="wcf.acp.option.share_buttons_show_count"><![CDATA[Anzahl der Teilungen anzeigen]]></item>
<item name="wcf.acp.option.category.message.general.edit"><![CDATA[Bearbeitungen]]></item>
+ <item name="wcf.acp.option.module_edit_history"><![CDATA[Bearbeitungsverlauf aktivieren]]></item>
+ <item name="wcf.acp.option.module_edit_history.description"><![CDATA[Speichert die alten Versionen von Benutzerinhalten.]]]></item>
<item name="wcf.acp.option.edit_history_expiration"><![CDATA[Speicherzeit]]></item>
<item name="wcf.acp.option.edit_history_expiration.description"><![CDATA[Zeitraum, nachdem alte Einträge aus dem Bearbeitungsverlauf entfernt werden [Zeitraum in Tagen, 0 um die Entfernung gänzlich zu deaktivieren]]]></item>
<item name="wcf.acp.option.github_public_key"><![CDATA[GitHub Client ID]]></item>
<item name="wcf.acp.option.enable_share_buttons"><![CDATA[Show content share button]]></item>
<item name="wcf.acp.option.share_buttons_show_count"><![CDATA[Show number of shares]]></item>
<item name="wcf.acp.option.category.message.general.edit"><![CDATA[Edits]]></item>
+ <item name="wcf.acp.option.edit_history_enabled"><![CDATA[Enable Edit History]]></item>
+ <item name="wcf.acp.option.edit_history_enabled.description"><![CDATA[Stores old versions of user created items.]]]></item>
<item name="wcf.acp.option.edit_history_expiration"><![CDATA[Storage time]]></item>
<item name="wcf.acp.option.edit_history_expiration.description"><![CDATA[Items in the edit history will be discarded if they are older than the given period. [time in days, 0 to disable]]]></item>
<item name="wcf.acp.option.github_public_key"><![CDATA[GitHub Client ID]]></item>