Use config URL instead of THISPAGE

THISPAGE is unreliable for CLI cron calls. It was historically used so the
admin could figure out which file/page generated the error. But with
backtrace support we no longer need it.
Merge pull request #412 from protich/issue/baseurl

Use config URL instead of THISPAGE

Reviewed-By: Jared Hancock <jared@osticket.com>
Drop the cdata table on field type change

If a field on the ticket details form changes type, recreate the cdata table
Merge pull request #413 from greezybacon/issue/drop-cdata-on-type-change

Drop the data table on field type change

Reviewed-By: Peter Rotich <peter@osticket.com>
Don't update the session unless it changes

And deadband session token updates to 1 per 30 seconds
Don't fetch ticket thread unless necessary
Don't generate staff statistics for AJAX requests
Periodically optimize core tables

This is instead of optimizing the lock table for every cron run, which
wastes a lot of db server io
Merge pull request #415 from greezybacon/db-perf-tweaks

Several database performance tweaks

Reviewed-By: Peter Rotich <peter@osticket.com>
cdata: Only apply updates to ticket details

If the entry answer being updated does not affect the ticket details form
(with type=T), then the updates do not need to be applied to the
ticket__cdata table.
Fix cdata fields in advanced search
Merge branch 'develop' into develop-next

Conflicts:
	include/class.cron.php