Skip to content

Commit 1738c6b

Browse files
committed
replace to get-tool
1 parent 8d1f371 commit 1738c6b

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

Models/FtpCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
*/
2222
class FtpCommand extends Model
2323
{
24-
const DEFAULT_CREATE_COMMAND = './ftp.sh add --username="{username}" --password="{password}" --directory="{dir}" --user="{user}"';
25-
const DEFAULT_UPDATE_COMMAND = './ftp.sh update --username="{username}" --password="{password}" --directory="{dir}"';
26-
const DEFAULT_DELETE_COMMAND = './ftp.sh delete --username="{username}"';
24+
const DEFAULT_CREATE_COMMAND = '{node_tools_path}/ftp.sh add --username="{username}" --password="{password}" --directory="{dir}" --user="{user}"';
25+
const DEFAULT_UPDATE_COMMAND = '{node_tools_path}/ftp.sh update --username="{username}" --password="{password}" --directory="{dir}"';
26+
const DEFAULT_DELETE_COMMAND = '{node_tools_path}/ftp.sh delete --username="{username}"';
2727

2828
/** @var bool */
2929
public $timestamps = false;

Services/FtpService.php

+14-10
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,29 @@
1010
*/
1111
class FtpService
1212
{
13-
const SCRIPT_NAME = './ftp.sh';
14-
const INSTALL_CMD = './ftp.sh install';
15-
const SCRIPT_DOWNLOAD_LINK = 'https://raw.githubusercontent.com/gameap/scripts/master/ftp/proftpd/ftp.sh';
13+
const GET_COMMAND = "get-tool https://raw.githubusercontent.com/gameap/scripts/master/ftp/proftpd/ftp.sh";
14+
const INSTALL_COMMAND = '{node_tools_path}/ftp.sh install';
1615

1716
/**
1817
* @param integer $dedicatedServerId
1918
* @return mixed
2019
*/
2120
public function install(int $dedicatedServerId)
2221
{
23-
$executeCommand = 'curl -O ' . self::SCRIPT_DOWNLOAD_LINK
24-
. ' && ' . 'chmod +x ' . self::SCRIPT_NAME
25-
. ' && ' . self::INSTALL_CMD;
22+
$getTask = GdaemonTask::create([
23+
'run_aft_id' => 0,
24+
'dedicated_server_id' => $dedicatedServerId,
25+
'task' => GdaemonTask::TASK_CMD_EXEC,
26+
'cmd' => self::GET_COMMAND,
27+
]);
2628

27-
return GdaemonTask::create([
29+
$installTask = GdaemonTask::create([
2830
'run_aft_id' => 0,
2931
'dedicated_server_id' => $dedicatedServerId,
3032
'task' => GdaemonTask::TASK_CMD_EXEC,
31-
'cmd' => $executeCommand,
32-
])->id;
33+
'cmd' => self::INSTALL_COMMAND,
34+
]);
35+
36+
return $getTask->id;
3337
}
34-
}
38+
}

module.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "FTP",
33
"alias": "ftp",
44
"description": "FTP Accounts Management",
5-
"version": "1.4.0",
5+
"version": "1.4.1",
66
"gameap-required": ">=3.0.0-beta4",
77
"keywords": ["ftp"],
88
"active": 1,

0 commit comments

Comments
 (0)