Added 'package verify'

Performs some basic sanity checks on installed packages to detect
missing files.
Fixed version upgrading

Also added additional safety checks to avoid data corruption
Extended lastAPI to include package format info
Fixed removal of comments from lpkversion files
Order by folder_order when available
Fixed issues with removing templates with missing files
Fix articles referring to invalid templates