== Primary Task List == - *DONE* Setup plugin skeleton so it can be activated inside WordPress - *DONE* Build form --- *DONE* Don't forget the subscription and certificate info! - *DONE* Save form items in wp_options - *NOT GOING TO IMPLEMENT* Add logic to uninstall to remove settings? (deactivate does not touch them) - *DONE* Create custom cron schedule (15 minutes and 5 minutes) http://wpengineer.com/1908/use-wordpress-cron/ - *DONE* Do a check to see if a class is available, if not load packaged WAZ PHP SDK - *DONE* Create custom post type for diagnostics - *DONE* Pull diagnostics from table and place in database ---- *DONE* Code to retrieve from table ---- *DONE* How to create a new post from code? ---- *DONE* Title = Resource: Usage: Instance - *DONE* Add cron to pull diagnostics from the table and place in db - *DONE*Retrieve last 15 minutes of diagnostics from database --- *DONE* Create an array of the useful metric info --- *DONE* If there are no posts skip the checks --- *DONE* Function returns data in a usable state - See averages() at https://github.com/Interop-Bridges/Windows-Azure-Sample-Kit-4-PHP/blob/master/dealoftheday_sample/Worker/lib/functions.php --- *DONE* If data exists check against triggers - *DONE* Setup scaling code - *DONE* Hook triggers into scaling code - cron - *DONE* Add logic to erase crons on deactivate - *DONE* Add check to see if any options are set. If not tell the user to set them in a message === Secondary Tasks === - Add checks to cron to ensure the actions are only completed if valid settings are available - If function_exists(azure_getconfig()) use those values for INITIAL settings - Add numbers to triggers page - Convert Deployment Slot on settings page to select menu - Create code to list crons with prefix - Create code to manage cron jobs --- Very generic, should read and write --- Create ability to check for prefix - Build form to add schedule rules to cron --- Possibly save in wp_options and on activate check for the crons and restore them - Add dashboard widget that shows instance stats - *DONE* Ensure diagnostics info is getting pulled from the db for only last 15 minutes - Update settings form with checkboxes for types of triggers the user wants to check ---- Store in wazScale_settings -> wp_options ---- Update triggers from to read from wp_options and only provide fields checked ---- Update wazScale_check_triggers() to only check triggers in wp_options - Write a more creative admin message if options do not exist - Checkbox in settings to remove settings on uninstall - Checkbox in settings to remove diagnostics on uninstall ************************************************************************************* Anything below this line may not make sense and may not be implemented or implemented completely different. The following is only a brainstorm dump ************************************************************************************* == Certificate storage == The text for the cert could be stored in the database and the file created on the fly for security == Plugin Pages == - Main page displays stats and allows manual override - Settings (WAZ Subscription, cert, auto/manual, dashboard (on|off), etc) - Triggers - Schedule == Scheduler == User needs a way to create custom rules on a schedule. - New post type: wazScalerSchedule - New post type should NOT be publicly viewable, but may be from the backend Schedule items should include - Time to execute - Pulldown menu to (Scale In, Scale Out) - Date rule becomes enabled - Date rule becomes disabled Could transients be used here to ensure these only get executed once? Might it be possible to simply use the cron system completely for this? - Prefix all rules - To list rules --- Pull all cron items from db --- Filter out items that do not have the prefix --- Display list - Take a look at the MediaTemple cron UI for inspiration == Handling Diagnostic Information == By default diagnostic information is stored in a table. This is awkward to use. Since WordPress is using a database all the table entries should be pulled from the table and stored in the database *NOTE: Table here refers to a Windows Azure storage table, not a table in the database == Cron Jobs == - (Every 5 minutes) Pull diagnostics from table and insert into database - (Every 15 minutes) Retrieve diagnostics from db and check last 15 minutes against triggers - Look at how the WP cron system works and possibly add scheduler items here - Need to create custom cron hook that will add additional options http://codex.wordpress.org/Function_Reference/wp_get_schedules http://wpengineer.com/1908/use-wordpress-cron/ == Custom Post Types == - Custom rules scheduler (only if not using cron) - Diagnostics information == wp_options == For ease triggers could be stored as a JSON array, containing all the triggers. Alternatively, if we want to make it easier for users to manipulate settings directly from the database each setting could be stored as a seperate option == Deactivate Code == http://codex.wordpress.org/Function_Reference/register_deactivation_hook Store deactivation code in decactivate.php - Erase crons - Remove diagnostics - Remove settings? probably not == Uninstall code == - Remove diagnostics - Erase crons - Remove settings == Activation == http://codex.wordpress.org/Function_Reference/register_activation_hook - Pull crons from wp_options - Create needed database tables