dirname() is a slow function compared with __DIR__ and using
'/../'. Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code. This allows those required includes to perform as
best as possible in this situation.
this involves moving all formslib includes to where they're actually needed.
it also moves the portfolio stuff from assignment,data,chat,forum and glossary
into a locallib.php which involved creating it for many of those modules.
Added much needed documentation to the portfolio "scripts" (the libs are all
fine), and moved all parameter fetching from the body of the file to the top.
this introduces portfolio/file.php to serve portfolio related files - access check is delegated to the plugin.
and also two new classes in the portfolio plugin tree - push vs pull.