Use php autoincrement to match part_aa, part_ab, files, etc, and obviate the need to hard code or pass global variables into process_file().
Also means that filenames (wikipedia/part_xx) are only listed in a single place.
Also avoid messy checking via ls() system call, and stop when no more files to read. As an additional check, look for correct ending of the last file, to make sure all the XML dump has been downloaded and split correctly. Warn otherwise.