Upcoming Changes to WiFiDB for v0.30

Talk about random things WiFiDB related, either new things, concepts, or issues to work out in code.
Post Reply
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Upcoming Changes to WiFiDB for v0.30

Post by pferland » Wed Jul 27, 2011 12:10 pm

Well it has been quite a while since I have made a post regarding WiFiDB. What was I thinking? Anyway, I have been `hard` at work on the database. When I first started writing it, I had started off attempting to make it an all Object oriented[ish] code base (as much as PHP would allow, and that my feeble little mind had learned so far at that time), but I never fully implemented it. It was always just half-assed OO, with HTML peppered all through the code and severely bad organization of functions and classes. So I have implemented Smarty Template's in hopes that this will make it much much easier to maintain the code separately from the web front end interface. There are not many, if any at all (besides the search page) UI enhancements. All changes were pretty much making the code neater, more secure, some speed improvements, and making themes easier.
  1. + Re-wrote the core of WiFiDB. All pages start off by calling lib/init.inc.php, this sets up the environment, checks to see if the database is in the correct state, and then starts doing what the user asked.
    1. Here is a very quick overview of the layout of the core object and its sub-objects.
    2. $dbcore The main Object that everything gets attached too.
      1. Core object variables include filesystem paths to library's, URL paths, and the current theme for the user.
        1. $dbcore->URL_PATH
        2. $dbcore->theme
        3. $dbcore->ver_array
        4. $dbcore->ver_str
      2. SQL Object ($dbcore->sql)
        1. MySQL Connection object. ($dbcore->sql->conn)
        2. MySQL Host name/IP string. ($dbcore->sql->host)
        3. WiFiDB Meta DB Name. ($dbcore->sql->db)
        4. WiFiDB Storage DB Name.($dbcore->sql->db_st)
      3. Database Object ($dbcore->database)
        1. Contains all the functions for interacting with the database and collecting data for output.
        2. $dbcore->database->fetch_ap($ap_id)
        3. $dbcore->database->import_vs1($source , $file_id, $user , $notes , $title, $verbose, $times)
      4. Export Object ($dbcore->export)
        1. Contains all the functions for sending data from the database to a file.
        2. $dbcore->export->exp_kml()
        3. $dbcore->export->exp_vs1()
        4. $dbcore->export->exp_gpx()
        5. $dbcore->export->exp_newest_kml()
        6. $dbcore->export->exp_csv()
      5. Mail ($dbcore->mail)
        1. A wrapper for the XPertMailer class.
      6. XML ($dbcore->xml)
        1. Holds the functions that use XML.
      7. Security Object ($dbcore->sec)
        1. All the functions that involve security and users permissions within WiFiDB.
      8. Meta Object ($dbcore->meta)
        1. Contains all the otherinformation for WiFiDB, Advertisement code, statistics tracking code, and anything else that does not quite fit in.
  2. = Fixed lots of WTF moments in the code, which includes increasing the speed of the imports by, well... alot. By no longer checking for duplicate GPS points on import.
  3. + Added a globe icon for APs that have GPS, APs that do not have GPS have a greyed out globe.
  4. = Fixed errors with handling UTF8 characters.
  5. = Fixed errors with exporting data for APs with some special characters.
  6. + *BROKEN* Added the ability for the search page to show the first 15 results on the same page as you type.
  7. + Added Temp File and output cleanup for unneeded Daemon KML files.
  8. + Added Smarty Templating across all web pages.
  9. + Moved Exporting functions out of the database.inc.php file and into their own export.inc.php and class.
  10. - Depreciated login_bar(), my_caches(), and user_panel_bar()
  11. + Moved the header() and footer() functions back from the themes folder and into the mainline code. Themes will just have a header and footer `.tpl` file now.
  12. + Changed over from the MySQL php functions to PDO with prepared statements, default working with the MySQL or MariaDB SQL Servers, maybe others will be tested against at a later time.
  13. - Removed all HTML elements from the import/export functions.
So a typical page will have a work flow similar to:
  1. Include 'lib/init.inc/php', this will initialize the $dbcore and setup the environment
  2. Gather any data that is needed to be displayed.
  3. Assign the data to smarty variables
  4. Have smarty display the template.
The init.inc.php initialization is more then just setting up the environment, its sets a few cookies also, so we can tell what time zone the user is in for proper time display. Also at this time, the $dbcore has all objects attached to it, I don't want to keep it like this (for performance reasons) but it will have to be for now till I tweak it a little more.

OK, that is it for now, will be back later with some more updates maybe.

-Phil
The best acceleration you can get on a Mac is 9.8ms^2

User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Upcoming Changes to WiFiDB for v0.30

Post by pferland » Sun Jan 08, 2012 10:14 pm

Made some more major changes:
  1. Removed the wifi_st database, this has greatly improved performace and SQL server stability. All APs are now stored in the wifi_pointers table, Signal history for all APs is stored in wifi_signal and all GPS history is stored in wifi_gps.
  2. Added geonames information, data fetched from http://download.geonames.org/export/dump/. Tables include geonames, geonames_admin1, geonames_admin2, and geonames_country_names. Data is used in the main DB and the geonames api (wifidb/api/geonames.php).
These are all the notes I can think of right now, will add more when they come up.
The best acceleration you can get on a Mac is 9.8ms^2

Post Reply