Skip to content

Commit a951e36

Browse files
authored
Merge pull request #230 from e-alfred/v180
Fixes for version 1.8.0 (thanks @weeman1337)
2 parents 7ca84b4 + ac38fa9 commit a951e36

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ Loki3000
9090
(formerly) Xavier Beurois
9191

9292
## Releases notes
93+
### v1.8.0 [unreleased]
94+
- Removed Nextcloud 20 support (min version is now 21)
95+
- Added Nextcloud 23 support
96+
- Fixed curl download stuck in "waiting" status
97+
- Fixed some "Trying to access array offset" errors in `queue.php`
98+
9399
### v1.7.1
94100
- Added support for quota limits (thanks @Irillit)
95101
- Moved translations to Transiflex and fixed some localization issues (thanks @MorrisJobke and @rakekniven)

SERVER/fallback.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ private static function curlSetAdvancedOptions($OPTIONS)
9595
if (isset($OPTIONS['user-agent'])) {
9696
curl_setopt(self::$CurlHandler, CURLOPT_USERAGENT, $OPTIONS['user-agent']);
9797
}
98-
if (isset($OPTIONS['out'])) {
99-
curl_setopt(self::$CurlHandler, CURLOPT_FILE, $OPTIONS['out']);
100-
}
10198
if (isset($OPTIONS['all-proxy'])) {
10299
curl_setopt(self::$CurlHandler, CURLOPT_PROXY, $OPTIONS['all-proxy']);
103100
if (isset($OPTIONS['all-proxy-user']) && isset($OPTIONS['all-proxy-passwd'])) {

appinfo/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
'order' => 10,
1717
'href' => \OC::$server->getURLGenerator()->linkToRoute('ocdownloader.Index.Add'),
1818
'icon' => \OC::$server->getURLGenerator()->imagePath('ocdownloader', 'ocdownloader.svg'),
19-
'name' => 'ocDownloader'
19+
'name' => \OC::$server->getL10N('ocdownloader')->t('ocDownloader')
2020
]);

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<description>Easy to use download manager using Curl/Aria2 and youtube-dl to allow downloading HTTP(S), FTP(S), YouTube videos and BitTorrent files. For more information on how to install, please go to https://github.com/e-alfred/ocdownloader/blob/master/README.md
77

88
</description>
9-
<version>1.7.12</version>
9+
<version>1.8.0</version>
1010
<licence>agpl</licence>
1111
<author>e-alfred</author>
1212
<author>Nibbels</author>
@@ -17,7 +17,7 @@
1717
<screenshot>https://raw.githubusercontent.com/e-alfred/ocdownloader/master/appinfo/Screenshot.jpg</screenshot>
1818
<repository>https://github.com/e-alfred/</repository>
1919
<dependencies>
20-
<nextcloud min-version="20" max-version="22" />
20+
<nextcloud min-version="21" max-version="23" />
2121
<lib>curl</lib>
2222
</dependencies>
2323

controller/lib/curl.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,40 @@ class CURL
1515
private static $GID = null;
1616
private static $URI = null;
1717
private static $OPTIONS = null;
18-
18+
1919
public static function addUri($URI, $OPTIONS)
2020
{
2121
self::$GID = uniqid();
2222
self::$URI = $URI;
2323
self::$OPTIONS = $OPTIONS;
24-
24+
2525
self::run();
26-
26+
2727
return array('result' => self::$GID);
2828
}
29-
29+
3030
public static function tellStatus($GID)
3131
{
3232
if (file_exists('/tmp/' . $GID . '.curl')) {
3333
$Line = null;
34-
34+
3535
$TFHandle = fopen('/tmp/' . $GID . '.curl', 'r');
3636
$Cursor = -1;
37-
37+
3838
fseek($TFHandle, $Cursor, SEEK_END);
3939
$Char = fgetc($TFHandle);
40-
40+
4141
while ($Char === "\n" || $Char === "\r") {
4242
fseek($TFHandle, $Cursor--, SEEK_END);
4343
$Char = fgetc($TFHandle);
4444
}
45-
45+
4646
while ($Char !== false && $Char !== "\n" && $Char !== "\r") {
4747
$Line = $Char . $Line;
4848
fseek($TFHandle, $Cursor--, SEEK_END);
4949
$Char = fgetc($TFHandle);
5050
}
51-
51+
5252
$StatusArray = array(
5353
'status' => 'waiting',
5454
'completedLength' => 0,
@@ -57,7 +57,7 @@ public static function tellStatus($GID)
5757
'PID' => 0,
5858
'GID' => $GID
5959
);
60-
60+
6161
if (!is_null($Line)) {
6262
$Status = explode(';', $Line);
6363
if (count($Status) == 5) {
@@ -77,15 +77,15 @@ public static function tellStatus($GID)
7777
);
7878
}
7979
}
80-
80+
8181
public static function remove($Status)
8282
{
8383
$Return = null;
8484
if (isset($Status['PID']) && is_numeric($Status['PID']) && isset($Status['GID'])) {
8585
if ($Status['PID'] == 0 || posix_kill($Status['PID'], 15) === false) {
8686
$Return = null;
8787
}
88-
88+
8989
if (file_exists('/tmp/' . $Status['GID'] . '.curl')) {
9090
$PFHandle = fopen('/tmp/' . $Status['GID'] . '.curl', 'a');
9191
if (is_resource($PFHandle)) {
@@ -95,14 +95,14 @@ public static function remove($Status)
9595
.';'.$Status['PID']."\n"
9696
);
9797
fclose($PFHandle);
98-
98+
9999
$Return = array('result' => $Status['GID']);
100100
}
101101
}
102102
}
103103
return $Return;
104104
}
105-
105+
106106
public static function removeDownloadResult($GID)
107107
{
108108
if (file_exists('/tmp/' . $GID . '.curl')) {
@@ -112,7 +112,7 @@ public static function removeDownloadResult($GID)
112112
'result' => 'OK'
113113
);
114114
}
115-
115+
116116
/********** PRIVATE STATIC METHODS **********/
117117
private static function run()
118118
{

controller/queue.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ public function get()
144144
$Queue = [];
145145
$DownloadUpdated = false;
146146
while ($Row = $Request->fetchRow()) {
147+
if (is_array($Row) === false) {
148+
break;
149+
}
150+
147151
$Status =($this->WhichDownloader == 0
148152
?Aria2::tellStatus($Row['GID']):CURL::tellStatus($Row['GID']));
149153
$DLStatus = 5; // Error

0 commit comments

Comments
 (0)