Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .drone.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Lint

on:
pull_request:
push:
branches:
- master
- stable*

jobs:
php:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']

name: php${{ matrix.php-versions }}
steps:
- uses: actions/checkout@v2

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- name: Lint
run: composer run lint || ( echo 'Please run `composer run lint` and fix your code' && exit 1 )

php-cs-fixer:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.4']

name: cs php${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none

- name: Install dependencies
run: composer i

- name: Run coding standards check
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

xml-linters:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download schema
run: wget https://apps.nextcloud.com/schema/apps/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd
1 change: 1 addition & 0 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ composer.*
krankerl.toml
l10n/.gitkeep
.nextcloudignore
.php_cs.dist
README.md
screenshots
tests
Expand Down
18 changes: 18 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;
18 changes: 15 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2"
}
"autoload-dev": {
"psr-4": {
"OCP\\": "vendor/christophwurst/nextcloud/OCP",
"OCA\\WorkflowScript\\": "lib/"
}
},
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -not -path './tests/integration/vendor/*' -print0 | xargs -0 -n1 php -l"
},
"require-dev": {
"nextcloud/coding-standard": "^0.5.0",
"christophwurst/nextcloud": "dev-master"
}
}
25 changes: 15 additions & 10 deletions lib/BackgroundJobs/Launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@

namespace OCA\WorkflowScript\BackgroundJobs;

use Exception;
use OC\BackgroundJob\QueuedJob;
use OC\Files\View;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\ILogger;
use OCP\ITempManager;
use Psr\Log\LoggerInterface;

class Launcher extends \OC\BackgroundJob\QueuedJob {
class Launcher extends QueuedJob {

/** @var ILogger */
/** @var LoggerInterface */
protected $logger;
/** @var ITempManager */
private $tempManager;
Expand All @@ -40,9 +42,9 @@ class Launcher extends \OC\BackgroundJob\QueuedJob {
/**
* BackgroundJob constructor.
*
* @param ILogger $logger
* @param LoggerInterface $logger
*/
public function __construct(ILogger $logger, ITempManager $tempManager, IRootFolder $rootFolder) {
public function __construct(LoggerInterface $logger, ITempManager $tempManager, IRootFolder $rootFolder) {
$this->logger = $logger;
$this->tempManager = $tempManager;
$this->rootFolder = $rootFolder;
Expand All @@ -54,13 +56,16 @@ public function __construct(ILogger $logger, ITempManager $tempManager, IRootFol
protected function run($argument) {
$command = (string)$argument['command'];

if(strpos($command, '%f')) {
if (strpos($command, '%f')) {
$path = isset($argument['path']) ? (string)$argument['path'] : '';
try {
$view = new \OC\Files\View(dirname($path));
$view = new View(dirname($path));
$tmpFile = $view->toTmpFile(basename($path));
} catch (\Exception $e) {
$this->logger->logException($e, ['level' => ILogger::WARN, 'app' => 'workflow_script']);
} catch (Exception $e) {
$this->logger->warning($e->getMessage(), [
'app' => 'workflow_script',
'exception' => $e
]);
return;
}
$command = str_replace('%f', escapeshellarg($tmpFile), $command);
Expand Down
Loading