Skip to content

Instantly share code, notes, and snippets.

@Gemorroj
Last active December 27, 2022 20:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gemorroj/be72bb393f5de423f0404a43dedbddda to your computer and use it in GitHub Desktop.
Save Gemorroj/be72bb393f5de423f0404a43dedbddda to your computer and use it in GitHub Desktop.
stopping-support-for-terrorism
#!/usr/bin/env php
<?php
/**
* https://gist.github.com/Gemorroj/be72bb393f5de423f0404a43dedbddda
*
* Create file `bin/anti-terrorism`
* Add to composer.json like this:
```
"scripts": {
"post-install-cmd": [
"@php bin/anti-terrorism"
],
"post-update-cmd": [
"@php bin/anti-terrorism"
]
}
```
P.S. you can use russian (https://packagist.org.ru/) or chienese (https://mirrors.cloud.tencent.com/help/composer.html) mirrors for composer
*/
declare(strict_types=1);
$vendorDir = \dirname(__DIR__).'/vendor';
$filePath = $vendorDir.'/symfony/framework-bundle/Console/Application.php';
$fileData = @\file_get_contents($filePath);
if (false === $fileData) {
return;
}
$count = 0;
$patchedData = \str_replace(
' <bg=#0057B7;fg=#FFDD00>#StandWith</><bg=#FFDD00;fg=#0057B7>Ukraine</> <href=https://sf.to/ukraine>https://sf.to/ukraine</>',
'',
$fileData,
$count
);
if ($count) {
$result = @\file_put_contents($filePath, $patchedData);
if (false === $result) {
return;
}
}
echo "\033[32m[OK]\033[0m".\PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment