From: Matthias Schmidt Date: Tue, 8 Jul 2014 18:05:42 +0000 (+0200) Subject: Automatically set the application install date option value X-Git-Tag: 2.1.0_Alpha_1~602^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85eba953eab36d80a014f8e61ac50c89506f6904;p=GitHub%2FWoltLab%2FWCF.git Automatically set the application install date option value Hidden integer options of an application with name "app_install_date" will automatically get the current timestamp as option value. --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php index 57be733201..d6ee129ce3 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php @@ -2,6 +2,7 @@ namespace wcf\system\package\plugin; use wcf\data\option\Option; use wcf\data\option\OptionEditor; +use wcf\data\package\Package; use wcf\system\exception\SystemException; use wcf\system\WCF; @@ -85,6 +86,14 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP // result was 'false' thus create a new item if (!$row) { + // set the value of 'app_install_date' to the current timestamp + if ($hidden && $optionType == 'integer' && $this->installation->getPackage()->isApplication) { + $abbreviation = Package::getAbbreviation($this->installation->getPackage()->package); + if ($optionName == $abbreviation.'_install_date') { + $defaultValue = TIME_NOW; + } + } + $data['optionName'] = $optionName; $data['packageID'] = $this->installation->getPackageID(); $data['optionValue'] = $defaultValue;