Skip to content

Instantly share code, notes, and snippets.

@austinheap austinheap/artisan.php forked from duellsy/artisan.php
Last active Aug 29, 2015

Embed
What would you like to do?
More polished version of @duellsy's mod to prompt for confirmation before running Laravel artisan commands on a specific environment (mainly production).
<?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";
}
@austinheap

This comment has been minimized.

Copy link
Owner Author

commented Apr 7, 2014

Example Output:

alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.