removed superfluous code
This commit is contained in:
@@ -70,12 +70,10 @@ class MainController extends Controller
|
|||||||
|
|
||||||
private function _download($url)
|
private function _download($url)
|
||||||
{
|
{
|
||||||
$filename = Helper::getFileName($url);
|
if ($filename = Helper::getFileName($url)) {
|
||||||
if ($filename) {
|
|
||||||
$this->aria2->setFileName($filename);
|
$this->aria2->setFileName($filename);
|
||||||
}
|
}
|
||||||
$result = $this->aria2->download($url);
|
if (!($result = $this->aria2->download($url))) {
|
||||||
if (!$result) {
|
|
||||||
return ['error' => 'failed to download the file for some reason!'];
|
return ['error' => 'failed to download the file for some reason!'];
|
||||||
}
|
}
|
||||||
if (isset($result['error'])) {
|
if (isset($result['error'])) {
|
||||||
@@ -105,14 +103,12 @@ class MainController extends Controller
|
|||||||
|
|
||||||
move_uploaded_file($_FILES['torrentfile']['tmp_name'], $file);
|
move_uploaded_file($_FILES['torrentfile']['tmp_name'], $file);
|
||||||
|
|
||||||
$result = $this->aria2->btDownload($file);
|
if (!($result = $this->aria2->btDownload($file))) {
|
||||||
if (!$result) {
|
|
||||||
return ['error' => 'failed to download the file for some reason!'];
|
return ['error' => 'failed to download the file for some reason!'];
|
||||||
}
|
}
|
||||||
if (isset($result['error'])) {
|
if (isset($result['error'])) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'uid' => $this->uid,
|
'uid' => $this->uid,
|
||||||
'gid' => $result['gid'],
|
'gid' => $result['gid'],
|
||||||
|
|||||||
Reference in New Issue
Block a user