Skip to content

Commit 8e9f51d

Browse files
committed
install updateserver on installation
1 parent 823cbec commit 8e9f51d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

files/acp/install_de.codequake.cms.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
use wcf\data\category\CategoryEditor;
33
use wcf\data\object\type\ObjectTypeCache;
4+
use wcf\data\package\update\server\PackageUpdateServerAction;
45
use wcf\system\WCF;
56

67
/**
@@ -25,3 +26,22 @@
2526
'title' => 'Default Category',
2627
'time' => TIME_NOW
2728
));
29+
30+
// add codequake update server
31+
if (isset($this->instruction['attributes']['installupdateserver']) && $this->instruction['attributes']['installupdateserver'] == 1) {
32+
$serverURL = 'http://codequake.de/packages/typhoon/';
33+
34+
// check if update server already exists
35+
$sql = "SELECT packageUpdateServerID
36+
FROM wcf".WCF_N."_package_update_server
37+
WHERE serverURL = ?";
38+
$statement = WCF::getDB()->prepareStatement($sql);
39+
$statement->execute(array($serverURL));
40+
$row = $statement->fetchArray();
41+
if ($row === false) {
42+
$objectAction = new PackageUpdateServerAction(array(), 'create', array('data' => array(
43+
'serverURL' => $serverURL
44+
)));
45+
$objectAction->executeAction();
46+
}
47+
}

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<instruction type="userNotificationEvent">xml/userNotificationEvent.xml</instruction>
6060

6161
<!-- scripts -->
62-
<instruction type="script">acp/install_de.codequake.cms.php</instruction>
62+
<instruction type="script" installupdateserver="1">acp/install_de.codequake.cms.php</instruction>
6363
</instructions>
6464

6565
<instructions type="update" fromversion="2.0.0 RC 1">

0 commit comments

Comments
 (0)