jwilson3

jwilson3's picture

Drush Aliases for successful sql-sync

  1. <?php
  2. // ~/.drush/example.aliases.drushrc.php
  3. /**
  4.  * @file
  5.  *     Aliases for Example project.
  6.  * @usage
  7.  *   Confirm that the Drush aliases in this file are installed using:
  8.  *     `drush sa`
jwilson3's picture

Code

  1. <?php
  2. // Contents of ~/.drush/puam.aliases.drushrc.php
  3. $aliases['dev'] = array(
  4.   'uri' => 'puam.local',
  5.   'root' => '~/Sites/Puam/public/www',
  6.   'db-url' => 'mysql://puam:puam@localhost/puam',
jwilson3's picture

Custom theme_username with custom profile fields.

  1. /**
  2.  * Override of theme_username().
  3.  * Our customized version of theme_username accounts for user profile fields.
  4.  */
  5. function ami_core_username($object) {
  6.   //dpm($object);
  7.   // Default case -
jwilson3's picture

override theme_username in a module

  1. /**
  2.  * Implementation of hook_theme_registry_alter().
  3.  */
  4. function ami_core_theme_registry_alter(&$theme_registry) {
  5.   if (!empty($theme_registry['username'])) {
  6.     $theme_registry['username']['
jwilson3's picture

Fix for Code

  1. /**
  2.  * Implementation of hook_entity_info_alter().
  3.  */
  4. function profile_privacy_info_alter(&$entity_info) {
  5.   $entity_info['user']['view modes']['teaser'] = array(
  6.     'label' => t('Teaser'),
  7.  
jwilson3's picture

Fix for varnish vhost config

  1. backend default {
  2.   .host = "173.255.226.15";
  3.   .port = "8080";
  4.   .connect_timeout = 600s;
  5.   .first_byte_timeout = 600s;
  6.   .between_bytes_timeout = 600s;
  7. }
  8.  
  9.  
  10. backend conference {
  11.   .host = "
jwilson3's picture

varnish vhost config

  1. backend default {
  2.   .host = "173.255.226.15";
  3.   .port = "8080";
  4.   .connect_timeout = 600s;
  5.   .first_byte_timeout = 600s;
  6.   .between_bytes_timeout = 600s;
  7. }
  8.  
  9.  
  10. backend production {
  11.   .host = "
jwilson3's picture

Fix for MySQL Tuning Primer

  1. https://launchpad.net/mysql-tuning-primer
  2.  
  3.         -- MYSQL PERFORMANCE TUNING PRIMER --
  4.              - By: Matthew Montgomery -
  5.  
  6. MySQL Version 5.0.45-log i686
  7.  
  8. Uptime = 45 days 17 hrs 8 min 20
jwilson3's picture

MySQL Tuning Primer

  1. https://launchpad.net/mysql-tuning-primer
  2.  
  3.         -- MYSQL PERFORMANCE TUNING PRIMER --
  4.              - By: Matthew Montgomery -
  5.  
  6. MySQL Version 5.0.45-log i686
  7.  
  8. Uptime = 45 days 17 hrs 8 min 20
jwilson3's picture

Empty DateTime Object

  1. <?php
  2.  
  3. // Put this code in a new file (eg date.php) in your drupal root.
  4.  
  5. $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  6. require_once './includes/bootstrap.inc';
  7. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
jwilson3's picture

Fix for Code

  1. <?php
  2. $issue = 'issue';
  3. return $issue;
  4. //test
  5. ?>
jwilson3's picture

drupal_get_machinename

  1. /**
  2.  * Most machine names are generated as-you-type via Javascript helpers on the
  3.  * client side. This helper function automates server-side conversions from
  4.  * regular text strings into valid Drupal machine names.
  5.  *
  6.  * Machine names must contain only lowercase alpha-numerics and underscores.
  7.  * Non-alphanumeric characters are converted to underscores, and sequential
  8.  * underscore characters are trimmed to a single character.
  9.  *
  10.  * Additionally, if the transliteration module is enabled, then it will be
  11.  * used to first convert non-ascii Unicode characters to standard Roman ASCII
  12.  * characters on a best-effort basis, and replacing all unknown characters
  13.  * with underscores.
  14.  *
  15.  * @param $text
  16.  *   A string of characters to be converted.
  17.  *
  18.  * @return
  19.  *   A string containing the valid Drupal machine name for the specified text.
  20.  *   Returns the empty string if invalid input was provided.
  21.  *
  22.  * @see
  23.  *   See the transliteration module in the drupal contrib repository for more
  24.  *   information on non-ascii character transliterations.
  25.  */
jwilson3's picture

Fix for Drupal machine name with PHP

  1. /**
  2.  * Most machine names are generated as-you-type via Javascript helpers on the
  3.  * client side. This helper function automates server-side conversions from
  4.  * regular text strings into valid Drupal machine names.
  5.  *
  6.  * Machine names must contain only lowercase alpha-numerics and underscores.
  7.  * Non-alphanumeric characters are converted to underscores, and sequential
  8.  * underscore characters are trimmed to a single character.
  9.  *
  10.  * @param $text
  11.  *   A string of characters to be converted.
  12.  * @return
  13.  *   A string containing the valid Drupal machine name for the specified text.
  14.  *   Returns the empty string if invalid input was provided.
  15.  */
jwilson3's picture

Drupal machine name with PHP

  1. /**
  2.  * Most machine names are generated as-you-type via Javascript helpers on the
  3.  * client side. This helper function automates server-side conversions from
  4.  * regular text strings into valid Drupal machine names.
  5.  *
  6.  * Machine names must contain only lowercase alpha-numerics and underscores.
  7.  * Non-alphanumeric characters are converted to underscores, and sequential
  8.  * underscore characters are trimmed to a single character.
  9.  *
  10.  * @param $text
  11.  *   A string of characters to be converted.
  12.  * @return
  13.  *   A string containing the valid Drupal machine name for the specified text.
  14.  *   Returns the empty string if invalid input was provided.
  15.  */
jwilson3's picture

mac os x php ini xdebug macgdbp webgrind

  1. [xdebug]
  2. xdebug.default_enable=1
  3.  
  4. ; Configure MacGDBp.app as the debugger UI.
  5. xdebug.remote_enable=On
  6. xdebug.remote_host=127.0.0.1
  7. xdebug.remote_port=9991
  8. xdebug.remote_autostart=1
  9.  
  10. ; Configu
jwilson3's picture

Fix for += operator not supported

  1. Getting a strange 'Unsupported operand types'  error in /modules/field/field.info.inc on line 247  in Drupal 7.
  2.  
  3. It could be that my database is slightly corrupt, but i need to know how to troubleshoot this... i dont understand though how the += operator works with arrays... thanks for your help!
  4.  
  5. I did some testing locally, and found that in every case (for my particular site) there was no need to merge the results from field_info_field_settings() into $field['settings'] because it already had the same or MORE settings than those provided by field_info_field_settings(), so i simply commented both of these lines, and everything works fine. This seems rather unnecessary code that i expect someone else will eventually run into down the road... but i didn't test it fully.... so I'm not considering contributing this to the D7 issue queue right now.
jwilson3's picture

drushrc.php structure-tables for D7

  1. <?php
  2. /**
  3.  * The list of tables whose *data* is skipped by the 'sql dump' and 'sql load'
  4.  * commands when a structure-tables-key is provided.
  5.  */
  6. $options['structure-tables'] = array(
  7.  'common-d
Syndicate content