-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from GDATASoftwareAG/apply-plugin-check-sugges…
…tions Apply plugin check suggestions
- Loading branch information
Showing
35 changed files
with
361 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,17 @@ docker compose kill | |
docker compose rm --force --stop --volumes | ||
docker compose up --build --quiet-pull --wait -d --force-recreate --renew-anon-volumes --remove-orphans | ||
|
||
until docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp core install --url=http://127.0.0.1:8080 --title=testsite --admin_user=admin [email protected] --admin_password=admin" | ||
until docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp core install --url=http://127.0.0.1:8080 --title=testsite --admin_user=admin [email protected] --admin_password=admin" | ||
do | ||
echo "waiting for WordPress to be installed" | ||
sleep 2 | ||
done | ||
composer install | ||
|
||
docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp plugin uninstall hello" | ||
docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp plugin uninstall akismet" | ||
docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp plugin install wp-crontrol" | ||
docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp plugin activate wp-crontrol" | ||
docker exec -it --user www-data wordpress-gdata-antivirus-app-1 bash -c "wp plugin activate wordpress-gdata-antivirus" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin uninstall hello" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin uninstall akismet" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin install wp-crontrol" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin activate wp-crontrol" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin install plugin-check" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin activate plugin-check" | ||
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin activate gdata-antivirus" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
.devcontainer/* | ||
.vscode/* | ||
.git/* | ||
wordpress/* | ||
tests/* | ||
compose* | ||
Dockerfile | ||
test.sh | ||
wordpress/* | ||
xdebug.ini | ||
xdebug.php | ||
info.php | ||
Dockerfile.WordPress | ||
renovate.json | ||
renovate.json | ||
local-build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Gdatacyberdefenseag\GdataAntivirus; | ||
|
||
use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\IGdataAntivirusDatabase; | ||
use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\WordPressDatabase; | ||
use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\FileSystem\IGdataAntivirusFileSystem; | ||
use Gdatacyberdefenseag\GdataAntivirus\Infrastructure\FileSystem\WordPressFileSystem; | ||
use Gdatacyberdefenseag\GdataAntivirus\PluginPage\AdminNotices; | ||
use Gdatacyberdefenseag\GdataAntivirus\PluginPage\Findings\FindingsMenuPage; | ||
use Gdatacyberdefenseag\GdataAntivirus\PluginPage\FullScan\FullScanMenuPage; | ||
use Gdatacyberdefenseag\GdataAntivirus\PluginPage\OnDemandScan\OnDemandScan; | ||
use Gdatacyberdefenseag\GdataAntivirus\PluginPage\GdataAntivirusMenuPage; | ||
use Gdatacyberdefenseag\GdataAntivirus\Vaas\ScanClient; | ||
use Illuminate\Container\Container; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\Log\NullLogger; | ||
|
||
if (! class_exists('GdataAntivirusPlugin')) { | ||
class GdataAntivirusPlugin extends Container { | ||
public function __construct( LoggerInterface $logger = new NullLogger() ) { | ||
$logger->info('GdataAntivirusPlugin::__construct'); | ||
$this->singleton(FindingsMenuPage::class, FindingsMenuPage::class); | ||
$this->singleton(FullScanMenuPage::class, FullScanMenuPage::class); | ||
$this->singleton(OnDemandScan::class, OnDemandScan::class); | ||
$this->singleton(IGdataAntivirusFileSystem::class, WordPressFileSystem::class); | ||
$this->singleton(IGdataAntivirusDatabase::class, WordPressDatabase::class); | ||
$this->singleton(GdataAntivirusMenuPage::class, GdataAntivirusMenuPage::class); | ||
$this->singleton(ScanClient::class, ScanClient::class); | ||
$this->singleton(AdminNotices::class, AdminNotices::class); | ||
$this->singleton(LoggerInterface::class, function () use ( $logger ) { | ||
return $logger; | ||
}); | ||
|
||
$this->make(GdataAntivirusMenuPage::class); | ||
$findings_menu = $this->make(FindingsMenuPage::class); | ||
$this->make(FullScanMenuPage::class); | ||
$this->make(OnDemandScan::class); | ||
|
||
\assert($findings_menu instanceof FindingsMenuPage); | ||
$findings_menu->validate_findings(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Gdatacyberdefenseag\GdataAntivirus\Infrastructure\FileSystem; | ||
|
||
use Amp\ByteStream\ReadableResourceStream; | ||
use function Amp\ByteStream\Internal\tryToCreateReadableStreamFromResource; | ||
|
||
/** | ||
* this implements the functions that some filesystems have in common | ||
* for example, there is no proper replacement for fopen (where you get a stream from) | ||
* in the WP_Filesystem_Base class, so we need to implement it here | ||
*/ | ||
trait FileSystemBase { | ||
public function get_resource_stream_from_string(string $content): ReadableResourceStream { | ||
$stream = fopen('php://temp', 'r+'); | ||
fwrite($stream, $content); | ||
rewind($stream); | ||
return tryToCreateReadableStreamFromResource($stream); | ||
} | ||
|
||
public function open(string $path): ReadableResourceStream { | ||
return tryToCreateReadableStreamFromResource(fopen($path, 'r')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
<?php | ||
|
||
namespace Gdatacyberdefenseag\WordpressGdataAntivirus\Infrastructure\FileSystem; | ||
namespace Gdatacyberdefenseag\GdataAntivirus\Infrastructure\FileSystem; | ||
|
||
use Amp\ByteStream\ReadableResourceStream; | ||
|
||
interface IGdataAntivirusFileSystem { | ||
public function read( $path ): string; | ||
public function write( $path, $content ); | ||
public function delete( $path ); | ||
public function is_writable( $path ): bool; | ||
public function open( string $path ): ReadableResourceStream; | ||
public function read( string $path ): string; | ||
public function write( string $path, string $content ): bool; | ||
public function delete( string $path ): bool; | ||
public function is_writable( string $path ): bool; | ||
|
||
public function get_resource_stream_from_string( string $content ): ReadableResourceStream; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...dpressGdataAntivirusPluginDebugLogger.php → ...gging/GdataAntivirusPluginDebugLogger.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.