Script Description: This php scritp is a demo project to parse command line, read users file, create table in mysql database and insert the users info into mysql table from users file.
Environment Assumption:
- Ubuntu 14.04 linux
- PHP PHP 5.5.9
- Mysql 5.6.25
- the dedicated mysql database is "test" and the dedicated mysql table is "users" (a better option is to add arguments -d [database] -t [table] in the command line)
- all the codes are tested in Nectar/Openstack cloud.
User Guide:
- copy the source code and users.csv file into directory or get files from github
- execute $php user_upload.php [arguments]
- the script will print all the result of different function in the sceen
Test Cases:
- php user_upload.php --help //print all the help information
- php user_upload.php --create_table -h localhost -u root -p root //create users table in mysql
- php user_upload.php --file users.csv --dry_run -h localhost -u root -p root //execute all the functions except insert data into mysql
- php user_upload.php --file users.csv -h localhost -u root -p root //execute read file and insert into database
- other fault tolerant test