EE Squashed

815
-1

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
815
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

EE Squashed

  1. 1. EE Squashed Debugging in ExpressionEngine
  2. 2. Why?
  3. 3. The Request GET /index.php
  4. 4. What’s Happening? Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  5. 5. CodeIgniter Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  6. 6. ExpressionEngine Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  7. 7. Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  8. 8. Request index.php Set non-standard system path core/CodeIgniter $system_path = '../sys'; controllers/EE libraries/Core Kick off CodeIgniter require_once BASEPATH.'core/ libraries/Template CodeIgniter'.EXT; Output!
  9. 9. Run CodeIgniter Request LOAD: core/Common LOAD: core/Compat LOAD: config/constants index.php LOAD: core/Benchmark LOAD: core/Hooks RUN: pre-system HOOK LOAD: core/Config core/CodeIgniter LOAD: core/Unicode LOAD: core/URI LOAD: core/Router controllers/EE LOAD: core/Output RUN: cache_override HOOK LOAD: core/Input libraries/Core LOAD: core/Lang LOAD: core/Base[4,5] LOAD: core/Controller LOAD: EE libraries/Template RUN: pre_controller HOOK INSTANTIATE: EE RUN: post_controller_constructor HOOK Output! RUN: EE/index RUN: post_controller HOOK RENDER: output RUN: post_system HOOK
  10. 10. Run CodeIgniter Request LOAD: core/Common LOAD: core/Compat LOAD: config/constants index.php LOAD: core/Benchmark LOAD: core/Hooks RUN: pre-system HOOK LOAD: core/Config core/CodeIgniter LOAD: core/Unicode LOAD: core/URI LOAD: core/Router controllers/EE LOAD: core/Output RUN: cache_override HOOK LOAD: core/Input libraries/Core LOAD: core/Lang LOAD: core/Base[4,5] LOAD: core/Controller LOAD: EE libraries/Template RUN: pre_controller HOOK INSTANTIATE: EE RUN: post_controller_constructor HOOK Output! RUN: EE/index RUN: post_controller HOOK RENDER: output RUN: post_system HOOK
  11. 11. Run CodeIgniter Request LOAD: core/Common LOAD: core/Compat LOAD: config/constants index.php LOAD: core/Benchmark LOAD: core/Hooks RUN: pre-system HOOK LOAD: core/Config core/CodeIgniter LOAD: core/Unicode LOAD: core/URI LOAD: core/Router controllers/EE LOAD: core/Output RUN: cache_override HOOK LOAD: core/Input libraries/Core LOAD: core/Lang LOAD: core/Base[4,5] LOAD: core/Controller LOAD: EE libraries/Template RUN: pre_controller HOOK INSTANTIATE: EE RUN: post_controller_constructor HOOK Output! RUN: EE/index RUN: post_controller HOOK RENDER: output RUN: post_system HOOK
  12. 12. Request index.php core/CodeIgniter Kick off controllers/EE ExpressionEngine $this->core->_initialize_core(); libraries/Core libraries/Template Output!
  13. 13. Request index.php Run ExpressionEngine core/CodeIgniter LOAD: Database LOAD: Site Preferences LOAD: libraries/Functions controllers/EE LOAD: libraries/Extensions LOAD: libraries/Localize LOAD: libraries/Session libraries/Core LOAD: languages/english/core LOAD: libraries/Template RUN: template/run_template_engine libraries/Template Output!
  14. 14. Request index.php Run ExpressionEngine core/CodeIgniter LOAD: Database LOAD: Site Preferences LOAD: libraries/Functions controllers/EE LOAD: libraries/Extensions LOAD: libraries/Localize LOAD: libraries/Session libraries/Core LOAD: languages/english/core LOAD: libraries/Template RUN: template/run_template_engine libraries/Template Output!
  15. 15. Request index.php Parse the Template Parses URI core/CodeIgniter Fetch template from DB Fetch template from disk Static check Parse snippets, segments, embed:vars controllers/EE Check cache Parse input PHP Parse simple conditionals libraries/Core Parse tags Parse output PHP Write cache libraries/Template Parse advanced conditionals Loop through sub-templates Output!
  16. 16. Request index.php Parse the Template Parses URI core/CodeIgniter Fetch template from DB Fetch template from disk Static check Parse snippets, segments, embed:vars controllers/EE Check cache Parse input PHP Parse simple conditionals libraries/Core Parse tags Parse output PHP Write cache libraries/Template Parse advanced conditionals Loop through sub-templates Output!
  17. 17. Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  18. 18. What’s Happening? Request index.php core/CodeIgniter controllers/EE libraries/Core libraries/Template Output!
  19. 19. Debugging Debugging is a methodical process of finding 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 Don’t assume anything Attack the obvious Ask for help Start broad
  22. 22. When you assume… Don’t assume it’s an extension Don’t assume it’s the database Don’t assume it’s your host Don’t assume… It’s much faster to determine what the problem is than what the problem isn’t.
  23. 23. Is it plugged in? Can you SSH/FTP? Can you access a static HTML file? Can you access your database? Can you access PHP info?
  24. 24. Help! Xdebug Extension for PHP http://xdebug.org/ Display Output Profiler $config[‘show_profiler’] = TRUE;
  25. 25. Broad strokes Check 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 Style 1. Test a static file 2. Test the control panel 3. Test other templates 4. Remove the entire trouble template, replace it with “test” 5. Fill back in the template until it breaks
  27. 27. KISS Huot Style 6. Is the trouble spot fixable in the template? 7. If not open the add-on and place debugging lines throughout 8. Is the trouble spot in the add-on? 9. If not open the core EE files and place debugging lines throughout
  28. 28. Three Examples
  29. 29. 1. Data’s Gone Missing
  30. 30. The Problem 4:30 pm on a Friday
  31. 31. Assumptions… Let’s do it all wrong.
  32. 32. It’s EE’s Fault An entry was overwritten? An entry was accidentally deleted? An entry was set to closed?
  33. 33. It’s MySQL’s Fault The 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 Don’t 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 pm on a Friday
  37. 37. The Solution “Don'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. Background Project 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. Assumptions… Let’s do it all wrong.
  46. 46. It’s EE’s Fault Have the templates changed? Was something new installed/enabled? Is it daylight savings time?
  47. 47. Now, I feel like an ass.
  48. 48. KISS Don’t 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 Solution For now, I’ve renamed entry. I’m open to suggestions, please feel free to educate me after this session with your ideas.
  53. 53. 3. EE Can’t Count
  54. 54. The Problem Contestants aren’t sorting properly.
  55. 55. Under the Hood Standard EE 2.x install EE Members EE Member Custom Profile 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 profile field. The User module displays users ordered by the EE member profile field.
  57. 57. Assumptions… Let’s do it all wrong.
  58. 58. It’s EE’s Fault Values are correct in control panel.
  59. 59. It’s Vote’s Fault Module code looks correct. Correctly using exp_member_data table. Pulling correct custom field, I think…
  60. 60. It’s User’s Fault Nope, template appears correct. Sorting by other fields works as expected (username, other custom fields). Sort attribute correctly flips the results, but keeps them out of order.
  61. 61. It’s My Fault Template looks right. Not a CSS issue, underlying XHTML is wrong too.
  62. 62. Now, I feel like an ass.
  63. 63. KISS Don’t assume anything Attack the obvious Start broad Ask for help
  64. 64. Help!
  65. 65. What’d we Learn?
  66. 66. Don’t guess.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×