Displaying notice for available updates
authorAlexander Ebert <ebert@woltlab.com>
Thu, 1 Aug 2013 14:19:37 +0000 (16:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 1 Aug 2013 14:19:37 +0000 (16:19 +0200)
com.woltlab.wcf/templates/userNotice.tpl
wcfsetup/install/files/acp/templates/index.tpl
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 9f6dfb80df2ecb8dd05f7468d7111bf92181f115..8e0b6d20fe6d63f7a220a90cb3398a49bfe88ce3 100644 (file)
@@ -6,6 +6,10 @@
                </div>
        {/if}
        
+       {if $__wcf->session->getPermission('admin.system.package.canUpdatePackage') && $__wcf->getAvailableUpdates()}
+               <p class="info">{lang}wcf.global.availableUpdates{/lang}</p>
+       {/if}
+       
        <noscript>
                <p class="warning">{lang}wcf.page.javascriptDisabled{/lang}</p>
        </noscript>
index 05fe6a9e28aa6a40d3b3c387bc5d8ed3c5c1f696..d5080988b02ebce42f8cf1d41f1235fee3f93cc2 100644 (file)
        <p style="background-color: rgb(255, 153, 153); border: 2px solid rgb(255, 0, 0); padding: 1em;">{lang}wcf.acp.index.inRescueMode{/lang}</p>
 {/if}
 
+{if $__wcf->session->getPermission('admin.system.package.canUpdatePackage') && $__wcf->getAvailableUpdates()}
+       <p class="info">{lang}wcf.global.availableUpdates{/lang}</p>
+{/if}
+
 {if $usersAwaitingApproval}
        <p class="info">{lang}wcf.acp.user.usersAwaitingApprovalInfo{/lang}</p>
 {/if}
index 44e6bcf58eaa93565c4f4b80f8a968b8a0cf5b1b..bf3c8723042e28c41ee8af3e73b3d8c9724fcb49 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 namespace wcf\system;
+use wcf\system\cache\builder\PackageUpdateCacheBuilder;
+
 use wcf\data\application\Application;
 use wcf\data\option\OptionEditor;
 use wcf\data\package\Package;
@@ -721,6 +723,16 @@ class WCF {
                return StyleHandler::getInstance();
        }
        
+       /**
+        * Returns number of available updates.
+        * 
+        * @return      integer
+        */
+       public function getAvailableUpdates() {
+               $data = PackageUpdateCacheBuilder::getInstance()->getData();
+               return $data['updates'];
+       }
+       
        /**
         * Initialises the cronjobs.
         */
diff --git a/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php
new file mode 100644 (file)
index 0000000..8e958ca
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\system\package\PackageUpdateDispatcher;
+
+/**
+ * Caches the number of outstanding updates.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category   Community Framework
+ */
+class PackageUpdateCacheBuilder extends AbstractCacheBuilder {
+       /**
+        * @see wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
+        */
+       public function rebuild(array $parameters) {
+               PackageUpdateDispatcher::getInstance()->refreshPackageDatabase();
+               $updates = PackageUpdateDispatcher::getInstance()->getAvailableUpdates();
+               
+               return array('updates' => count($updates));
+       }
+}
index 6b21babcd146c2c4ce94c0a52ce8e41f60a145f4..dc494b7d193b619c24474e613bf09e8954bf8411 100644 (file)
@@ -1593,6 +1593,7 @@ Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getAllowedExtensions()
        </category>
        
        <category name="wcf.global">
+               <item name="wcf.global.availableUpdates"><![CDATA[Es sind <a href="{link controller='PackageUpdate' isACP=true}{/link}">Aktualisierungen für installierte Pakete</a> verfügbar.]]></item>
                <item name="wcf.global.button.add"><![CDATA[Hinzufügen]]></item>
                <item name="wcf.global.button.back"><![CDATA[&laquo; Zurück]]></item>
                <item name="wcf.global.button.cancel"><![CDATA[Abbrechen]]></item>
index 41bedbf947c307c0aedff269d4b7c77366b391dd..e5e469a4f35fc3a82d61439990632ca6f5346c80 100644 (file)
@@ -1591,6 +1591,7 @@ Allowed extensions: {', '|implode:$attachmentHandler->getAllowedExtensions()}]]>
        </category>
        
        <category name="wcf.global">
+               <item name="wcf.global.availableUpdates"><![CDATA[There are <a href="{link controller='PackageUpdate' isACP=true}{/link}">updates available</a> for installed packages.]]></item>
                <item name="wcf.global.button.add"><![CDATA[Add]]></item>
                <item name="wcf.global.button.back"><![CDATA[&laquo; Back]]></item>
                <item name="wcf.global.button.cancel"><![CDATA[Cancel]]></item>