fixed bugs

This commit is contained in:
huangjx
2022-02-22 20:52:38 +08:00
parent 1815c4f00c
commit 938055e6ea
5 changed files with 43 additions and 25 deletions

View File

@@ -44,7 +44,7 @@ class Aria2
$this->bin = Helper::findBinaryPath('aria2c', __DIR__ . "/../../bin/aria2c");
}
if ($this->isInstalled() && !$this->isExecutable()) {
chmod($this->bin, 755);
chmod($this->bin, 0744);
}
$this->setDownloadDir($dir);
$this->setTorrentsDir($torrents_dir);

View File

@@ -209,8 +209,10 @@ class Helper
$exeSniffer = new ExecutableFinder();
// Returns null if nothing is found
$result = $exeSniffer->find($program, $default, $paths);
// store the value for 5 minutes
$memcache->set($program, $result, 300);
if ($result) {
// store the value for 5 minutes
$memcache->set($program, $result, 300);
}
return $result;
}
@@ -324,4 +326,9 @@ class Helper
return self::doSignal($pid, 9);
}
public static function pythonInstalled()
{
return (bool) self::findBinaryPath('python');
}
}

View File

@@ -34,7 +34,7 @@ class Youtube
$this->bin = Helper::findBinaryPath('youtube-dl', __DIR__ . "/../../bin/youtube-dl");
}
if ($this->isInstalled() && !$this->isExecutable()) {
chmod($this->bin, 755);
chmod($this->bin, 0744);
}
$this->setDownloadDir($downloadDir);
if (!empty($settings)) {
@@ -246,6 +246,11 @@ class Youtube
return @is_executable($this->bin);
}
public function isReadable()
{
return @is_readable($this->bin);
}
public function getBin()
{
return $this->bin;