Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS 5 compatibility using file string streams #23

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Module CI

on:
push:
pull_request:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
endtoend: false
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.idea
.idea
.phpunit.result.cache
composer.lock
public/
vendor/
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ nightly cron that scans the files or if you have queuedjobs installed, it will a
# Composer Install

```
composer require symbiote/silverstripe-steamedclams:~2.0
composer require symbiote/silverstripe-steamedclams
```

# Screenshots
Expand Down Expand Up @@ -74,6 +74,8 @@ Symbiote\SteamedClams\ClamAV:
deny_on_failure: false
# For configuring on existing site builds and ignoring the scanning of pre-module install `File` records.
initial_scan_ignore_before_datetime: '1970-12-25 00:00:00'
# If true will send files to clamd as streams (by default files are referenced using their path). Useful when files are stored remotely and/or encrypted at rest.
use_streams: false
```

If you have the QueuedJobs module installed, you can configure when files missed by ClamAV daemon are scanned.
Expand Down Expand Up @@ -137,9 +139,10 @@ ClamAVEmulator::config()->mode = ClamAVEmulator::MODE_OFFLINE;
```

# Supports
- Silverstripe 4.0 and up
- Silverstripe 5.0 and up
- [Versioned Files](https://github.com/symbiote/silverstripe-versionedfiles)
- [CDN Content](https://github.com/symbiote/silverstripe-cdncontent)
- For Silverstripe 4.x use 3.0
- For Silverstripe 3.2 and up (3.1 *should* work, create an issue if you determine otherwise) use 1.0

# Credits
Expand Down
3 changes: 3 additions & 0 deletions _config/extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ SilverStripe\Assets\File:
SilverStripe\SiteConfig\SiteConfig:
extensions:
- Symbiote\SteamedClams\Extension\ClamAVSiteConfigExtension
SilverStripe\Admin\Forms\UsedOnTable:
extensions:
- Symbiote\SteamedClams\Extension\ClamAVUsedOnTableExtension
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@
}
],
"require": {
"silverstripe/framework": "^4"
"silverstripe/framework": "^5",
"silverstripe/admin": "^2",
"silverstripe/reports": "^5",
"silverstripe/siteconfig": "^5",
"xenolope/quahog": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"suggest": {
"silverstripe/queuedjobs": "For allowing ClamAV 'missed files' scan to be run from a queued job. Otherwise you can run the tasks manually or via cronjob."
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
"dev-master": "4.0.x-dev"
},
"expose": [
"client/css",
Expand Down
16 changes: 16 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
12 changes: 6 additions & 6 deletions src/Admin/ClamAVAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ClamAVAdmin extends ModelAdmin
/**
* @var string
*/
private static $menu_icon = 'vendor/symbiote/silverstripe-steamedclams/client/images/clamav_icon.png';
private static $menu_icon = 'symbiote/silverstripe-steamedclams:client/images/clamav_icon.png';

/**
* @var array
Expand Down Expand Up @@ -117,7 +117,7 @@ public function getEditForm($id = null, $fields = null)
$versionField = LiteralField::create('ClamAV_Version', $version);
$versionField->setRightTitle($reason);
$versionField->dontEscape = true;
$fields->insertBefore($versionField, $insertBeforeFieldName);
$fields->insertBefore($insertBeforeFieldName, $versionField);

// Files to scan with install task
$listCount = 0;
Expand All @@ -129,12 +129,12 @@ public function getEditForm($id = null, $fields = null)

if ($listCount > 0) {
$fields->insertBefore(
$insertBeforeFieldName,
ReadonlyField::create(
'ClamAV_InitialScan',
'Files to scan with install task',
$listCount . ' '
),
$insertBeforeFieldName
)
);
}

Expand All @@ -145,9 +145,9 @@ public function getEditForm($id = null, $fields = null)
$listCount = $list->count();
}
$fields->insertBefore(
$insertBeforeFieldName,
ReadonlyField::create('ClamAV_NeedScan', 'Files that failed to scan', $listCount . ' ')
->setRightTitle('Due to ClamAV daemon being inaccessible/offline.'),
$insertBeforeFieldName
->setRightTitle('Due to ClamAV daemon being inaccessible/offline.')
);
});

Expand Down
Loading