-
-
Save austinheap/10027292 to your computer and use it in GitHub Desktop.
More polished version of @duellsy's mod to prompt for confirmation before running Laravel artisan commands on a specific environment (mainly production).
This file contains hidden or 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
<?php | |
// Adding this to your app/start/artisan.php file will | |
// do a quick confirmation that you really do want | |
// to run this command when in production environment | |
if (php_sapi_name() == "cli" && | |
App::environment() == "production") | |
{ | |
echo "\033[0;31m\n"; | |
echo <<<EOF | |
uuuuuuuuuuuuuuuuuuuu | |
u" uuuuuuuuuuuuuuuuuu "u | |
u" u\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$u "u | |
u" u\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$u "u | |
u" u\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$u "u | |
u" u\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$u "u | |
u" u\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$u "u | |
\$ \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ \$ | |
\$ \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ \$ | |
\$ \$\$\$" ... "\$... ...\$" ... "\$\$\$ ... "\$\$\$ \$ | |
\$ \$\$\$u `"\$\$\$\$\$\$\$ \$\$\$ \$\$\$\$\$ \$\$ \$\$\$ \$\$\$ \$ | |
\$ \$\$\$\$\$\$uu "\$\$\$\$ \$\$\$ \$\$\$\$\$ \$\$ """ u\$\$\$ \$ | |
\$ \$\$\$""\$\$\$ \$\$\$\$ \$\$\$u "\$\$\$" u\$\$ \$\$\$\$\$\$\$\$ \$ | |
\$ \$\$\$\$....,\$\$\$\$\$..\$\$\$\$\$....,\$\$\$\$..\$\$\$\$\$\$\$\$ \$ | |
\$ \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$ \$ | |
"u "\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$" u" | |
"u "\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$" u" | |
"u "\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$" u" | |
"u "\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$" u" | |
"u "\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$" u" | |
"u """""""""""""""""" u" | |
"""""""""""""""""""" | |
****************************************** | |
* >>> YOU ARE ON A \033[30;33mPRODUCTION\033[0;31m SERVER <<< * | |
****************************************** | |
EOF; | |
echo "\033[30;34mAre you sure you want to run \"\033[30;37m" . implode(" ", $_SERVER["argv"]) . "\033[30;34m\"? (yes/NO) \033[30;37m"; | |
$line = fgets(STDIN); | |
echo "\n"; | |
if(strtolower(trim($line)) != "yes") | |
{ | |
echo "\033[0;33mABORTING!\033[0m\n"; | |
exit; | |
} | |
echo "\n"; | |
echo "\033[0;32mThank you, continuing...\033[0m\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example Output: