Last active
December 27, 2022 20:02
-
-
Save Gemorroj/be72bb393f5de423f0404a43dedbddda to your computer and use it in GitHub Desktop.
stopping-support-for-terrorism
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
#!/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