EE Squashed

Embed Size (px)

Citation preview

  1. 1. EE Squashed Debugging in ExpressionEngine
  2. 2. Why?
  3. 3. The Request GET /index.php
  4. 4. Whats Happening?Requestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  5. 5. CodeIgniterRequestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  6. 6. ExpressionEngineRequestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  7. 7. Requestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  8. 8. Requestindex.phpSet non-standardsystem pathcore/CodeIgniter$system_path = '../sys'; controllers/EElibraries/Core Kick off CodeIgniterrequire_once BASEPATH.'core/ libraries/Template CodeIgniter'.EXT; Output!
  9. 9. Run CodeIgniterRequest LOAD: core/CommonLOAD: core/CompatLOAD: config/constantsindex.phpLOAD: core/BenchmarkLOAD: core/HooksRUN: pre-system HOOKLOAD: core/Configcore/CodeIgniterLOAD: core/UnicodeLOAD: core/URILOAD: core/Router controllers/EE LOAD: core/OutputRUN: cache_override HOOKLOAD: core/Inputlibraries/Core LOAD: core/LangLOAD: core/Base[4,5]LOAD: core/ControllerLOAD: EE libraries/Template RUN: pre_controller HOOKINSTANTIATE: EERUN: post_controller_constructor HOOKOutput! RUN: EE/indexRUN: post_controller HOOKRENDER: outputRUN: post_system HOOK
  10. 10. Run CodeIgniterRequest LOAD: core/CommonLOAD: core/CompatLOAD: config/constantsindex.phpLOAD: core/BenchmarkLOAD: core/HooksRUN: pre-system HOOKLOAD: core/Configcore/CodeIgniterLOAD: core/UnicodeLOAD: core/URILOAD: core/Router controllers/EE LOAD: core/OutputRUN: cache_override HOOKLOAD: core/Inputlibraries/Core LOAD: core/LangLOAD: core/Base[4,5]LOAD: core/ControllerLOAD: EE libraries/Template RUN: pre_controller HOOKINSTANTIATE: EERUN: post_controller_constructor HOOKOutput! RUN: EE/indexRUN: post_controller HOOKRENDER: outputRUN: post_system HOOK
  11. 11. Run CodeIgniterRequest LOAD: core/CommonLOAD: core/CompatLOAD: config/constantsindex.phpLOAD: core/BenchmarkLOAD: core/HooksRUN: pre-system HOOKLOAD: core/Configcore/CodeIgniterLOAD: core/UnicodeLOAD: core/URILOAD: core/Router controllers/EE LOAD: core/OutputRUN: cache_override HOOKLOAD: core/Inputlibraries/Core LOAD: core/LangLOAD: core/Base[4,5]LOAD: core/ControllerLOAD: EE libraries/Template RUN: pre_controller HOOKINSTANTIATE: EERUN: post_controller_constructor HOOKOutput! RUN: EE/indexRUN: post_controller HOOKRENDER: outputRUN: post_system HOOK
  12. 12. Requestindex.php core/CodeIgniterKick off controllers/EE ExpressionEngine$this->core->_initialize_core(); libraries/Corelibraries/Template Output!
  13. 13. Requestindex.phpRun ExpressionEnginecore/CodeIgniterLOAD: DatabaseLOAD: Site PreferencesLOAD: libraries/Functions controllers/EE LOAD: libraries/ExtensionsLOAD: libraries/LocalizeLOAD: libraries/Session libraries/Core LOAD: languages/english/coreLOAD: libraries/TemplateRUN: template/run_template_engine libraries/Template Output!
  14. 14. Requestindex.phpRun ExpressionEnginecore/CodeIgniterLOAD: DatabaseLOAD: Site PreferencesLOAD: libraries/Functions controllers/EE LOAD: libraries/ExtensionsLOAD: libraries/LocalizeLOAD: libraries/Session libraries/Core LOAD: languages/english/coreLOAD: libraries/TemplateRUN: template/run_template_engine libraries/Template Output!
  15. 15. Requestindex.phpParse the TemplateParses URIcore/CodeIgniterFetch template from DBFetch template from diskStatic checkParse snippets, segments, embed:vars controllers/EE Check cacheParse input PHPParse simple conditionals libraries/Core Parse tagsParse output PHPWrite cache libraries/Template Parse advanced conditionalsLoop through sub-templatesOutput!
  16. 16. Requestindex.phpParse the TemplateParses URIcore/CodeIgniterFetch template from DBFetch template from diskStatic checkParse snippets, segments, embed:vars controllers/EE Check cacheParse input PHPParse simple conditionals libraries/Core Parse tagsParse output PHPWrite cache libraries/Template Parse advanced conditionalsLoop through sub-templatesOutput!
  17. 17. Requestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  18. 18. Whats Happening?Requestindex.php core/CodeIgnitercontrollers/EElibraries/Corelibraries/Template Output!
  19. 19. Debugging Debugging is a methodical process of nding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected.wikipedia
  20. 20. Debugging Debugging is a methodical process!
  21. 21. KISS Dont assume anything Attack the obvious Ask for help Start broad
  22. 22. When you assumeDont assume its an extension Dont assume its the database Dont assume its your host Dont assume Its much faster to determine what the problem isthan what the problem isnt.
  23. 23. Is it plugged in? Can you SSH/FTP? Can you access a static HTML le? Can you access your database? Can you access PHP info?
  24. 24. Help!Xdebug Extension for PHP http://xdebug.org/ Display Output Proler $config[show_profiler] = TRUE;
  25. 25. Broad strokesCheck the application, can you log into the CP? Check the templates, can you access other pages? Remove half the template, does it show up? Remove a fourth the template, does it show up? Rinse, repeat
  26. 26. KISS Huot Style1. Test a static le 2. Test the control panel 3. Test other templates 4. Remove the entire trouble template, replace itwith test 5. Fill back in the template until it breaks
  27. 27. KISS Huot Style6. Is the trouble spot xable in the template? 7. If not open the add-on and place debugginglines throughout 8. Is the trouble spot in the add-on? 9. If not open the core EE les and placedebugging lines throughout
  28. 28. Three Examples
  29. 29. 1. Datas Gone Missing
  30. 30. The Problem4:30 pm on a Friday
  31. 31. AssumptionsLets do it all wrong.
  32. 32. Its EEs FaultAn entry was overwritten? An entry was accidentally deleted? An entry was set to closed?
  33. 33. Its MySQLs FaultThe database is corrupt? Primary keys are out of order because of a backup or import?
  34. 34. Now, I feel like an ass.
  35. 35. KISS Dont assume anything Attack the obvious Start broad Ask for help
  36. 36. Is it plugged in?Check with the client, what is really missing? Can they tell you anything about the data? What channel it was in? What status they set it to?5:58 pmon a Friday
  37. 37. The SolutionDon't worry Mark, they never existed in the DB. We got to the bottom of it. I'm adding them by hand tomorrow. Sorry for all the confusion.6:23 pm on a Friday
  38. 38. 2. Finicky URLs
  39. 39. The Problem Every listing page just stopped working.
  40. 40. Yesterday
  41. 41. Today
  42. 42. BackgroundProject rolled seven sites into one. Each sub-site was different and contained separate IA (navigation).
  43. 43. Under the Hood Standard EE 1.x install No custom add-ons Not using Pages module Templates as controllers
  44. 44. Yesterday
  45. 45. AssumptionsLets do it all wrong.
  46. 46. Its EEs FaultHave the templates changed? Was something new installed/enabled? Is it daylight savings time?
  47. 47. Now, I feel like an ass.
  48. 48. KISS Dont assume anything Attack the obvious Start broad Ask for help
  49. 49. Ask For Help
  50. 50. Ask For Help
  51. 51. Ask For Help
  52. 52. The SolutionFor now, Ive renamed entry. Im open to suggestions, please feel free to educate me after this session with your ideas.
  53. 53. 3. EE Cant Count
  54. 54. The Problem Contestants arent sorting properly.
  55. 55. Under the Hood Standard EE 2.x install EE Members EE Member Custom Prole Fields Mark Huot Vote Module Solspace User Module
  56. 56. All together now The Vote module records votes in a separate database table. The Vote module summarizes total votes into a standard EE member prole eld. The User module displays users ordered by the EE member prole eld.
  57. 57. AssumptionsLets do it all wrong.
  58. 58. Its EEs Fault Values are correct in control panel.
  59. 59. Its Votes Fault Module code looks correct.Correctly using exp_member_data table.Pulling correct custom eld, I think
  60. 60. Its Users FaultNope, template appears correct.Sorting by other elds works as expected (username, other custom elds).Sort attribute correctly ips the results, but keeps them out of order.
  61. 61. Its My FaultTemplate looks right.Not a CSS issue, underlying XHTML is wrong too.
  62. 62. Now, I feel like an ass.
  63. 63. KISS Dont assume anything Attack the obvious Start broad Ask for help
  64. 64. Help!
  65. 65. Whatd we Learn?
  66. 66. Dont guess.