|
74 | 74 | ->label('description', "Create a new function. You can pass a list of [permissions](/docs/permissions) to allow different project users or team with access to execute the function using the client API.\n\n") |
75 | 75 | ->param('name', '' , new Wildcard() , 'Function name. Max length: 128 chars.', false) |
76 | 76 | ->param('execute', '' , new Wildcard() , 'An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', false) |
77 | | - ->param('env', '' , new Wildcard() , 'Execution enviornment.', false) |
| 77 | + ->param('runtime', '' , new Wildcard() , 'Execution runtime.', false) |
78 | 78 | ->param('vars', [] , new Wildcard() , 'Key-value JSON object.', true) |
79 | 79 | ->param('events', [] , new Wildcard() , 'Events list.', true) |
80 | 80 | ->param('schedule', '' , new Wildcard() , 'Schedule CRON syntax.', true) |
81 | 81 | ->param('timeout', 15 , new Wildcard() , 'Function maximum execution time in seconds.', true) |
82 | | - ->action(function ( $name, $execute, $env, $vars, $events, $schedule, $timeout ) use ($parser) { |
| 82 | + ->action(function ( $name, $execute, $runtime, $vars, $events, $schedule, $timeout ) use ($parser) { |
83 | 83 | /** @var string $name */ |
84 | 84 | /** @var array $execute */ |
85 | | - /** @var string $env */ |
| 85 | + /** @var string $runtime */ |
86 | 86 | /** @var object $vars */ |
87 | 87 | /** @var array $events */ |
88 | 88 | /** @var string $schedule */ |
|
94 | 94 | /** Body Params */ |
95 | 95 | $params['name'] = $name; |
96 | 96 | $params['execute'] = !is_array($execute) ? array($execute) : $execute; |
97 | | - $params['env'] = $env; |
| 97 | + $params['runtime'] = $runtime; |
98 | 98 | $params['vars'] = $vars; |
99 | 99 | $params['events'] = !is_array($events) ? array($events) : $events; |
100 | 100 | $params['schedule'] = $schedule; |
|
308 | 308 | $params = []; |
309 | 309 | /** Body Params */ |
310 | 310 | $params['command'] = $command; |
311 | | - $cloudFunctionPath = realpath(__DIR__.'/../../../files/'.$code); |
312 | | - $cloudFunctionParentDir = dirname($cloudFunctionPath, 1); |
313 | | - $cloudFunctionDirName = basename($cloudFunctionPath); |
| 311 | + $code = \urldecode($code); |
| 312 | + $cloudFunctionPath = realpath(__DIR__.'/../files/'.$code); |
| 313 | + $cloudFunctionParentDir = escapeshellarg(dirname($cloudFunctionPath, 1)); |
| 314 | + $cloudFunctionDirName = escapeshellarg(basename($cloudFunctionPath)); |
314 | 315 | if (file_exists($cloudFunctionPath) === false ) { |
315 | 316 | throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. "); |
316 | 317 | } |
317 | 318 | $archiveName = 'code.tar.gz'; |
318 | | - $volumeMountPoint = realpath(__DIR__.'/../../../files/'); |
| 319 | + $volumeMountPoint = realpath(__DIR__.'/../files/'); |
319 | 320 | exec("tar -zcvf $archiveName -C $cloudFunctionParentDir $cloudFunctionDirName && mv $archiveName $volumeMountPoint"); |
320 | 321 | $archivePath = realpath($volumeMountPoint."/$archiveName"); |
321 | 322 | $cFile = new \CURLFile($archivePath, 'application/x-gzip' , basename($archivePath)); |
|
0 commit comments