diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-01-15 20:40:27 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-01-15 20:40:27 +0100 |
commit | 3df0ae374dd3d404306cfb34ecd20f446cb73efe (patch) | |
tree | 49955383806369889208bf3a5bebd13dc5662897 /sync.php | |
parent | ce1daccd15bf88b76794a94ef87755c8242318c6 (diff) | |
download | phpbb-sync-3df0ae374dd3d404306cfb34ecd20f446cb73efe.tar.gz phpbb-sync-3df0ae374dd3d404306cfb34ecd20f446cb73efe.tar.bz2 phpbb-sync-3df0ae374dd3d404306cfb34ecd20f446cb73efe.zip |
Diffstat (limited to 'sync.php')
-rwxr-xr-x | sync.php | 27 |
1 files changed, 23 insertions, 4 deletions
@@ -11,10 +11,29 @@ include($phpbb_root_path . 'includes/functions_user.' . $phpEx); include($phpbb_root_path . 'includes/auth/auth_ldap.' . $phpEx); init_ldap(); -// config -$dry_run = in_array('--dryrun', $argv) || in_array('-n', $argv); -$verbose = in_array('--verbose', $argv) || in_array('-v', $argv); -$help = in_array('--help', $argv) || in_array('-h', $argv) || in_array('-?', $argv); +// handling comandline args +function check_args($flag, &$args) { + $key = array_search($flag, $args); + if ($key !== false) { + unset($args[$key]); + return true; + } + + return false; +} + +$dry_run = check_args('--dryrun', $argv) || check_args('-n', $argv); +$verbose = check_args('--verbose', $argv) || check_args('-v', $argv); +$help = check_args('--help', $argv) || check_args('-h', $argv) || check_args('-?', $argv); + +if (sizeof($argv) > 1) { + $help = true; + foreach ($argv as $key=>$arg) { + if ($key != 0) { + print("Unrecognized option: $arg\n"); + } + } +} if ($help) { $text = <<<EOH |