GhostMVC

From Adam Colton
Revision as of 12:27, 30 May 2013 by Adamcolton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GhostMVC IDE

Core

Should be able to call functions like Post or PostArgs more than once (though args should only be called once).

Use a profiler on some basic pages to see what takes the most time. Any improvements to the core could be substantial.

Add subdomains to usable data

Add a wildcard character to routes to limit to exact match (no trailing data). Use case: if I want to route all traffic of a certain type from [SiteRoot]/[Model] to a specific function (other than index) I cannot because it will still match [SiteRoot]/[Model]/[Method].

Hook for libraries to call when they are loaded and when the call is closing (after the "after" hook).

Move Home_Controller, Defualt_controller and Default_method to hooks

Add useful errors:

  • When including anything, do a try

After the route has been determined, clear out the route object to clear up memory.

Add HTTP verbs to routing.

Create a redirect at the same level as view

V 2.0

Move hooks and config into directories. Anything in the root will be included. Functions in the "before" and "after" sub-directories. This makes it easier for people to write plug-ins as opposed to libraries because you don't have to modify the hooks or config file, you just drop a new file in the folders. I would like to take Ghost in a bit of a Wordpress direction - couple the framework with some default application (basic site operations) so that users can manage a site. The core framework will remain simple and very pure (separate from the default application). This creates a continuum for users from basic experience to highly advanced.

I would like to find a way to change the conditional routing so that it doesn't build up a massive array but does a lazy process. To accomplish this, I need someway to exit the sequence when I've found a match.

Libraries

Look into memcache, output buffering

Database

  • Finish 'having' functions in database library
  • Update database library to throw useful errors
    • data array is not included in update
  • Database to support limits
  • Multiple inserts
  • Database row and row_array (only returns one and auto-adds "limit 1")
  • Find a way to make database connections persistent in such a way that the user can have several, they will open as needed, close (via hooks) and can be used for mysql_real_escape_string.
  • Database Where to accept associative array or key value pairs
  • Allow subqueries using Database library objects.
  • Store all the values and run mysql_escape against them right before the query is run.

(this requires the the library hook in core) Have the constants defined with tails so that MYSQL_HOST becomes MYSQL_HOST_DEFAULT allow a range such as MYSQL_HOST_QUIZ, MYSQL_HOST_JOURNAL (using Moon-Jumper as an example). User the constant function (http://dk.php.net/manual/en/function.constant.php) to dynamically access them. Store each connection persistently in an array indexed by host and user, then close all the connections when the request finishes (or allow the user to manually close the connections early).

Parameterized SQL

Use PDO. Seems simple enough, put ? where user data goes then bind data to position. The important (and tricky) part is keeping the data in order so that it will line up with the correct position. http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/

http://projects.adamcolton.net/pdo/

Layout

Need to finish (and touch up) the html class.

Allow user to set headers and return codes.

Validation

Add phone numbers, sql-scrubbing... Look up common regex patterns and add those in. Some sort of a mass form validator would be nice, with the ability to pass back an array of errors.

Utilities

I need to think about how these should be installed. I can do a web installer from the admin panel easily - and that's what most people will probably use, but there needs to be a more fundamental way. Where do the files go, how does that work?

Edit

Add 'New' buttons to model, view, controller and resources in Edit utility.

Move this into a more IDE like environment with the files in an UL on the left and the editor being tabbed (possibly split-able).

Test Framework

Good base class, need to rename a lot of the methods to follow the camel casing that I choose. I also want to finish turning this into a real test interface where I can run a subset of tests.

For a first step, I would like to detect anytime a model or test is updated (by last modified date) and automatically re-run the tests when it changes. This way, every time I upload code, the unit tests will be run automatically. This could be very cool because I could set up the page on another computer or a tablet and it will provide feedback while I work.

Form Utility

Form builder utility. Select the controller, name the form (used as function name, view name and form id), add inputs and select their type. The utility automatically stubs out the view, both controller methods (name and _name) and the submit hook so that the post variables are passed as arguments.

Publish Utility

Use FTP to publish to another destination. Needs a process for 'popping' configs off a stack. Allow user to show all files, different by date, different by size and both. Use this (http://scrivna.com/blog/php-file-diff) to show the file differences.

Database

Add modify table to database utility

Move the whole thing into more of a tabbed view (rather than modal). So that you can see each table, keep queries that you've run around. A query builder would be nice.

Allow Database::select to be used for where_in.

For debugging, create a logging option that will store all queries in a log.

Installer

I seem to have lost this project. I should rebuild it and get it out and GitHub. Have that serve as the base template for GhostMVC. I saw a framework a while ago that set up all the base files you want - robots.txt, favicon, css and so forth. I'd really like to get that setup.

User Model

Based off Moon-Jumper user.

Properties

  • email
  • name
  • passhash
  • salt
  • hash algorithm
  • id

Methods

  • User User(name, password, email="") --How to return errors?
  • User User::Get(name, password)
  • User User::GetByEmail(email, password)
  • errorArr setEmail(email, sendConfirm=true)
  • errorArr User::ConfirmEmail(hash)
  • errorArr changePassword(password)
  • errorArr changeName(name)
  • errorArr sendResetPassword(email)
  • errorArr User::ConfirmResetPassword(hash)

There will also be tbl_permission and link_user_permission. This allows extensible, atomic permissions.

Module Names

One principle I like is to give things gibberish or unrelated names rather than meaningful but generic names (think about Access, it makes searching and naming difficult). For that reason I want to pull in names of ghosts and ghost-like things to name them.

  • Test Framework - Osiris (Egyptian god that tests spirits for the afterlife)
  • Jacob Marley (ghost from A Christmas Carol)
  • Casper
  • Banshee (wails when someone is about to die, maybe an error catching framework)