From 85eba953eab36d80a014f8e61ac50c89506f6904 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 8 Jul 2014 20:05:42 +0200 Subject: [PATCH] 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. --- .../plugin/OptionPackageInstallationPlugin.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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; -- 2.20.1