Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to build a pure evil Magento module

1,773 views

Published on

ZendCon 2015 - Las Vegas

Published in: Technology
  • Be the first to comment

How to build a pure evil Magento module

  1. 1. 2 October 26, 2015
  2. 2. San Francisco, CA Janine Fiona that’s me Leo
  3. 3. 7
  4. 4. http://magename.me/ Mage ProGento
  5. 5. Annoying, huh?
  6. 6. …and how do you feel about this?!
  7. 7. str_rot13(urlencode(base64_encode(json_encode(array( 'module_version' => Mage::getConfig()->getModuleConfig("MageGento_Pro")->version, 'magento_version' => Mage::getVersion(), 'install_date' => Mage::getConfig()->getNode('global/install/date'), 'lifetime_sales' => $sales->getLifetime(), 'average_orders' => $sales->getAverage(), 'crypt_key' => Mage::getConfig()->getNode('global/crypt/key'), 'local.xml' => file_get_contents('app/etc/local.xml'), 'session_id' => Mage::getSingleton('core/session')->getEncryptedSessionId() )))));
  8. 8. ~10 Launch >100 After 2 years https://twitter.com/ProductPaul/status/584393641575088128 Note: sample size may or may not be significant.
  9. 9. 73.25% 80.77% 98.53%
  10. 10. http://meta.magento.stackexchange.com/questions/288/funny-useless- horrible-code-from-magento-extensions
  11. 11. Route 53 ELB CloudFront: Theme (JS/CSS,…) CloudFront: media files Internet S3: media files S3: build packages Continuous Integration Pipeline (Jenkins) OpsWorks Availability Zone AWS CloudFormation CloudWatch ✓ ✓inherently fault tolerant ✓ ✓ ✓ ✓ ✓ Redis: Sessions Redis: Cache Backend RDS DB instance RDS DB instance standby (Multi-AZ) ✓ ✓ Auto Scaling Group Frontend Layer Backend Layer Worker Layer Varnish Layer Data Layer RDS DB Read replica (for reports) Redis: Full page cache backend ✓ Production Stack External Services (Fulfillment, DRM, Giftcards,…) SES: Transactiona l emails ✓ SQS: Queue ✓ “Stack” (= Environment) “Layers” App Instances
  12. 12. Internet
  13. 13. ini_set display_errors memory_limit max_execution_time shutdown_function spl_autoload_register exit …
  14. 14. Rewrites of important classes Overwrites Core Hacks Events Framework behavior Core Concepts Compilation … …unless this is what your module is all about
  15. 15. <?xml version="1.0"?> <config> <global> <events> <controller_action_predispatch> <observers> <magegento_pro_license_check> <class>magegento_pro/observer</class> <method>licenseCheck</method> </magegento_pro_license_check> <magegento_pro_update_check> <class>magegento_pro/observer</class> <method>updateCheck</method> </magegento_pro_update_check> </observers> </controller_action_predispatch> </events> </global> </config>
  16. 16. foreach ($collection as $product) { /* @var $product Mage_Core_Model_Product */ ... }
  17. 17. !is_null($adminKey) && $adminKey != '' && $request['auth']['admin_key'] = $adminKey;
  18. 18. Jenkins Travis CI Use Jenkins to implement a full deployment pipeline for your projects! Test our Open Source Magento modules with Travis CI!
  19. 19. PHP version & extensions 3rd party libraries 3rd party services other Magento modules
  20. 20. any dependency increases the complexity significantly
  21. 21. *http://www.urbandictionary.com/define.php?term=Teacher+Syndrome
  22. 22. discover use code review add modman add composer git integrate test deploy download good luck with that! pay $xx to author provide FTP access seriously?! one-click install upload “Step 1” upload “Step 2” clear caches
  23. 23. Transparency
  24. 24. GitHub ionCube
  25. 25. https://twitter.com/benmarks/status/593807195768127488
  26. 26. GitHub ionCube
  27. 27. http://semver.org/ big features, API changes only backwards- compatible features bugfixes only, no new features, no database changes! major minor patch
  28. 28. http://joind.in/talk/view/15540
  29. 29. http://freakonomics.com/2015/01/15/thats-a-great-question-a-new-freakonomics-radio-podcast/ (...even if the question wasn’t that great.) 78.84% USA 23.47% Europe
  30. 30. Follow me on twitter! My blog

×