xhprof php profiling

xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); // run some code $kernel->terminate($request, $response); $xhprof_data = xhprof_disable(); $XHPROF_ROOT = "/usr/share/php"; include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php"; include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new XHProfRuns_Default(); $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_testing"); results can be accessed at http://xhprof.mydevdomain.dev/ m0ar info http://www.jeffgeerling.com/blog/2016/poor-mans-xhprof-profiling-drupal-8-migrations-and-drush-commands

Drupal 8 Cheats

Load menu item from node use Drupal\menu_link_content\Entity\MenuLinkContent; $node_id = 1; $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); $result = $menu_link_manager->loadLinksByRoute('entity.node.canonical', array('node' => $node_id)); dpm($result); Get Node from request $this->node = \Drupal::routeMatch()->getParameter('node'); Get URL \Drupal::request()->getRequestUri(); ... better $current_path = \Drupal::service('path.current')->getPath(); $result = \Drupal::service('path.alias_manager')->getAliasByPath($current_path); _Get nodes url_ $node->toUrl()->toString(); _Get Node ID from alias_ $node_path = \Drupal::service('path.alias_storage')->load(array( …

Solr Search

Install solr http://www.arborisoft.com/how-to-install-multicore-apache-solr-4-7-on-d… Will needs java 1.7 if you are on ubuntu 12.04. Create user Edit /etc/tomcat6/tomcat-users.xml Secure with password https://wiki.apache.org/solr/SolrSecurity#Common_servlet_container_exam… https://www.drupal.org/node/1333076#comment-8534105 Add this to /var/lib/tomcat6/webapps/solr/WEB-INF/web.xml Secure IP Add <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127.0.0.1"/> Under <Host> in /etc/tomcat6/server.xml Install conf files Copy modules/contrib/search_api_solr/solr-conf/4.x/* files to solr-4.9.1/MYSITE/multicore/core0/conf