D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
PHP-Antimalware-Scanner
/
bin
/
Filename :
build
back
Copy
#!/usr/bin/env php <?php /** * Antimalware Scanner * @author Marco Cesarato <cesarato.developer@gmail.com> * @copyright Copyright (c) 2019 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License * @link https://github.com/marcocesarato/PHP-Antimalware-Scanner */ $root = dirname(__DIR__); require_once $root . '/vendor/autoload.php'; $input = $root . '/src/'; $output = $root . '/dist/scanner.phar'; $finalOutput = $root . '/dist/scanner'; // clean up if (file_exists($output)) { unlink($output); } if (file_exists($output . '.gz')) { unlink($output . '.gz'); } if (file_exists($finalOutput)) { unlink($finalOutput); } // check that phar.readonly to off if (1 == ini_get('phar.readonly')) { echo "Can't create a Phar file. Please set `phar.readonly = Off` in your php.ini\n"; exit(1); } // create phar $p = new Phar($output); // start buffering. Mandatory to modify stub. $p->startBuffering(); // pointing main file which requires all classes $defaultStub = $p->createDefaultStub('index.php', '/index.php'); // creating our library using whole directory $p->buildFromDirectory($input); // Create a custom stub to add the shebang $stub = "#!/usr/bin/env php\n" . $defaultStub; // Add the stub $p->setStub($stub); $p->stopBuffering(); unset($p); rename($output, $finalOutput); chmod($finalOutput, 0755); echo "$output successfully created";