Skip to content

Instantly share code, notes, and snippets.

@schmunk42
Created June 2, 2015 14:57
Show Gist options
  • Save schmunk42/5abd79da2e70d312fa8e to your computer and use it in GitHub Desktop.
Save schmunk42/5abd79da2e70d312fa8e to your computer and use it in GitHub Desktop.
Partially hide password-string (keep hint)
<?php
if (YII_DEBUG) {
$passwordDisplay = substr($root_password,0,2).str_repeat("*",max(0,strlen($root_password)-4)).substr($root_password,-2,2);
} else {
$passwordDisplay = '**HIDDEN**';
}
$this->stdout("Creating database '{$db}' and granting permissions to user '{$user}' on DSN '{$dsn}' with user '{$root}/{$passwordDisplay}'");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment