Skip to content

Commit

Permalink
feat: auto silent and auto skip on programmatically mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Oct 7, 2020
1 parent 010a875 commit f38c78d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# AMWSCAN - PHP Antimalware Scanner

**Version:** 0.6.0.106 beta
**Version:** 0.6.0.107 beta

**Github:** https://github.com/marcocesarato/PHP-Antimalware-Scanner

Expand Down Expand Up @@ -204,14 +204,17 @@ Usage: php scanner [<path>] [--agile|-a] [--help|-h] [--log|-l <log>] [--offset

### Programmatically

On programmatically silent mode and auto skip are automatically enabled.

```php
use marcocesarato\amwscan\Scanner;

$app = new Scanner();
$report = $app->setPathScan("my/path/to/scan")
->setSilentMode()
->enableBackups()
->setPathBackups("/my/path/backups")
->setAgileMode()
->setAutoSkip()
->setAutoClean()
->run();
```

Expand Down
Binary file modified dist/scanner
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0.106
0.6.0.107
25 changes: 18 additions & 7 deletions src/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Scanner
*
* @var string
*/
public static $version = '0.6.0.106';
public static $version = '0.6.0.107';

/**
* Root path.
Expand Down Expand Up @@ -224,6 +224,10 @@ public function __construct()

Definitions::optimizeSig(Definitions::$SIGNATURES);

if (!self::isCli()) {
self::setSilentMode(true);
}

self::$inited = true;
}
}
Expand Down Expand Up @@ -1340,6 +1344,9 @@ public static function setSilentMode($mode = true)
{
self::$settings['silent'] = $mode;
if ($mode) {
if (self::$prompt === null) {
self::setAutoSkip(true);
}
self::setReportMode(false);
}

Expand Down Expand Up @@ -1563,7 +1570,7 @@ public static function setPrompt($prompt)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoDelete($mode = true)
{
Expand All @@ -1573,7 +1580,7 @@ public static function setAutoDelete($mode = true)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoClean($mode = true)
{
Expand All @@ -1583,7 +1590,7 @@ public static function setAutoClean($mode = true)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoCleanLine($mode = true)
{
Expand All @@ -1593,7 +1600,7 @@ public static function setAutoCleanLine($mode = true)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoQuarantine($mode = true)
{
Expand All @@ -1603,7 +1610,7 @@ public static function setAutoQuarantine($mode = true)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoWhitelist($mode = true)
{
Expand All @@ -1613,7 +1620,7 @@ public static function setAutoWhitelist($mode = true)
}

/**
* @param string $prompt
* @param string $mode
*/
public static function setAutoSkip($mode = true)
{
Expand All @@ -1636,6 +1643,8 @@ public static function getPathBackups()
public static function setPathBackups($pathBackups)
{
self::$pathBackups = $pathBackups;

return new static();
}

/**
Expand Down Expand Up @@ -1948,5 +1957,7 @@ public function getLastError()
protected function setLastError($lastError)
{
$this->lastError = $lastError;

return $this;
}
}

0 comments on commit f38c78d

Please sign in to comment.