/** * Performs the load of the CSV file into the database */ function main() { $mysql; $opts = parseOpts(); $hostname = $opts['hostname']; $username = $opts['username']; $password = $opts['password'] != false ? $opts['password'] : ''; $database = $opts['database']; $filename = $opts['filename']; $mysql = fetch_db_connection($hostname, $username, $password, $database); $modules = parse_csv($filename); $queries = buildQueries($modules); $count = 0; foreach ($queries as $query) { $res = $mysql->query($query); if ($res) { $count++; } } echo "Inserted " . $count . " plugins in the database via CSV.\n"; }
if (file_exists($bootstrap) && is_readable($bootstrap)) { require_once $bootstrap; } else { $msg = sprintf('Invalid param --bootstrap, file (%s) not found or is not readable', $bootstrap); throw new Exception($msg); } } } $action = ''; $userName = ''; $verbose = false; $withTemplate = null; $remainingArgs = array(); $bootstrap = ''; try { $data = parseOpts(); extract($data); includeBootstrap($bootstrap); $log = Miao_Log::easyFactory(null, $verbose); $author = isset($_SERVER['USER']) ? $_SERVER['USER'] : ''; $console = new Miao_Console($remainingArgs[0], $author, $log); $console->createTemplate($withTemplate); if ($action == 'cp' || $action == 'ren') { if (!isset($remainingArgs[1])) { help(); } $console->{$action}($remainingArgs[1]); } else { $console->{$action}(); } } catch (Exception $ex) {