Skip to content

Commit 6e7396f

Browse files
author
mutec
committed
ready for WSC 3.0
1 parent 344f5f6 commit 6e7396f

5 files changed

Lines changed: 36 additions & 25 deletions

File tree

files/lib/system/cronjob/MysteryCodeSpiderRefreshCronjob.class.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@
2222
class MysteryCodeSpiderRefreshCronjob implements ICronjob {
2323
/**
2424
* URLs of spiderList.xml-files
25-
* @var array
25+
* @var string[]
2626
*/
27-
public $spiderLists = array(
27+
public $spiderLists = [
2828
'https://static.mysterycode.de/spiders/list.xml',
2929
'https://assets.woltlab.com/spiderlist/typhoon/list.xml'
30-
);
30+
];
3131

3232
/**
3333
* list of spider-information fetched from the specified URLs
34-
* @var array
34+
* @var []
3535
*/
36-
public $fetchedSpiders = array();
36+
public $fetchedSpiders = [];
3737

3838
/**
39-
* @see \wcf\system\ICronjob::execute()
39+
* @inheritDoc
4040
*/
4141
public function execute(Cronjob $cronjob) {
4242
$existingSpiders = SpiderCacheBuilder::getInstance()->getData();
@@ -70,11 +70,11 @@ public function execute(Cronjob $cronjob) {
7070
$name = $xpath->query('ns:name', $spider)->item(0);
7171
$info = $xpath->query('ns:url', $spider)->item(0);
7272

73-
$this->fetchedSpiders[$identifier] = array(
73+
$this->fetchedSpiders[$identifier] = [
7474
'spiderIdentifier' => $identifier,
7575
'spiderName' => $name->nodeValue,
7676
'spiderURL' => $info ? $info->nodeValue : ''
77-
);
77+
];
7878
}
7979
}
8080

@@ -93,11 +93,11 @@ public function execute(Cronjob $cronjob) {
9393

9494
WCF::getDB()->beginTransaction();
9595
foreach ($this->fetchedSpiders as $parameters) {
96-
$statement->execute(array(
96+
$statement->execute([
9797
$parameters['spiderIdentifier'],
9898
$parameters['spiderName'],
9999
$parameters['spiderURL']
100-
));
100+
]);
101101
}
102102
WCF::getDB()->commitTransaction();
103103
}
@@ -108,7 +108,7 @@ public function execute(Cronjob $cronjob) {
108108
WCF::getDB()->beginTransaction();
109109
foreach ($existingSpiders as $spider) {
110110
if (!isset($this->fetchedSpiders[$spider->spiderIdentifier])) {
111-
$statement->execute(array($spider->spiderIdentifier));
111+
$statement->execute([$spider->spiderIdentifier]);
112112
}
113113
}
114114
WCF::getDB()->commitTransaction();

files/lib/system/event/listener/MysteryCodeSpiderRefreshUninstallListener.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
use wcf\system\WCF;
99

1010
class MysteryCodeSpiderRefreshUninstallListener implements IParameterizedEventListener {
11-
1211
/**
13-
* @see \wcf\system\event\listener\IParameterizedEventListener::execute()
12+
* @inheritDoc
1413
*/
1514
public function execute($eventObj, $className, $eventName, array &$parameters) {
1615
if (!empty($_POST['packageID'])) {

package.xml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
<packagename language="de"><![CDATA[Benutzerdefinierte Spider-Liste]]></packagename>
77
<packagedescription><![CDATA[spiders]]></packagedescription>
88
<packagedescription language="de"><![CDATA[Suchmaschinenroboter]]></packagedescription>
9-
<version>1.0.1</version>
10-
<date>2016-08-31</date>
9+
<version>1.1.0</version>
10+
<date>2016-12-15</date>
1111
</packageinformation>
1212

1313
<requiredpackages>
14-
<requiredpackage minversion="2.1.0"><![CDATA[com.woltlab.wcf]]></requiredpackage>
14+
<requiredpackage minversion="3.0.0 RC 1"><![CDATA[com.woltlab.wcf]]></requiredpackage>
1515
</requiredpackages>
1616

1717
<excludedpackages>
18-
<excludedpackage version="3.0.0 Alpha 1"><![CDATA[com.woltlab.wcf]]></excludedpackage>
18+
<excludedpackage version="3.1.0 Alpha 1"><![CDATA[com.woltlab.wcf]]></excludedpackage>
1919
</excludedpackages>
2020

2121
<authorinformation>
@@ -25,7 +25,7 @@
2525

2626
<instructions type="install">
2727
<!-- files -->
28-
<instruction type="file">files.tar</instruction>
28+
<instruction type="file" />
2929

3030
<!-- XMLs -->
3131
<instruction type="eventListener">xml/eventListener.xml</instruction>
@@ -35,13 +35,20 @@
3535
<instruction type="script">acp/install_de.mysterycode.wcf.spiders.php</instruction>
3636
</instructions>
3737

38-
<instructions type="update" fromversion="1.0.0 Beta 1">
38+
<instructions type="update" fromversion="1.0.0">
3939
<!-- files -->
40-
<instruction type="file">files.tar</instruction>
40+
<instruction type="file" />
41+
42+
<!-- XMLs -->
43+
<instruction type="eventListener">xml/eventListener.xml</instruction>
44+
<instruction type="cronjob">xml/cronjob.xml</instruction>
4145
</instructions>
42-
43-
<instructions type="update" fromversion="1.0.0">
46+
<instructions type="update" fromversion="1.0.1">
4447
<!-- files -->
45-
<instruction type="file">files.tar</instruction>
48+
<instruction type="file" />
49+
50+
<!-- XMLs -->
51+
<instruction type="eventListener">xml/eventListener.xml</instruction>
52+
<instruction type="cronjob">xml/cronjob.xml</instruction>
4653
</instructions>
4754
</package>

xml/cronjob.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE xml>
33
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com https://mysterycode.de/XSD/cronjob.xsd">
44
<import>
5-
<cronjob>
5+
<cronjob name="de.mysterycode.wcf.spiders.refreshSpiders">
66
<classname>wcf\system\cronjob\MysteryCodeSpiderRefreshCronjob</classname>
77
<description><![CDATA[Refreshes list of search robots with custom sources (replaces WoltLabs cronjob)]]></description>
88
<description language="de"><![CDATA[Aktualisiert die Liste der Suchroboter anhand benutzerdefinierter Quellen (ersetzt WoltLabs Cronjob)]]></description>
@@ -15,4 +15,9 @@
1515
<canbedisabled>1</canbedisabled>
1616
</cronjob>
1717
</import>
18+
<delete>
19+
<cronjob>
20+
<classname>wcf\system\cronjob\MysteryCodeSpiderRefreshCronjob</classname>
21+
</cronjob>
22+
</delete>
1823
</data>

xml/eventListener.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE xml>
33
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com https://mysterycode.de/XSD/eventListener.xsd">
44
<import>
5-
<eventlistener>
5+
<eventlistener name="uninstallPackageAction">
66
<eventclassname>wcf\acp\action\UninstallPackageAction</eventclassname>
77
<eventname>execute</eventname>
88
<listenerclassname>wcf\system\event\listener\MysteryCodeSpiderRefreshUninstallListener</listenerclassname>

0 commit comments

Comments
 (0)