Skip to content

Instantly share code, notes, and snippets.

View johnrobertwilson's full-sized avatar

John Robert Wilson johnrobertwilson

View GitHub Profile
@johnrobertwilson
johnrobertwilson / gist:1250751
Created September 29, 2011 13:46
dev settings
<?php
/**
* @file
* Drupal site-specific configuration file.
*/
/**
* Database settings must be pulled from a separate file which will not be
* put into version control.
*/
@johnrobertwilson
johnrobertwilson / gist:1250747
Created September 29, 2011 13:43
settings.php
<?php
// $Id: default.settings.php,v 1.51 2010/10/11 23:49:48 dries Exp $
/**
* @file
* Drupal site-specific configuration file.
*
* IMPORTANT NOTE:
* This file may have been set to read-only by the Drupal installation
* program. If you make changes to this file, be sure to protect it again
@johnrobertwilson
johnrobertwilson / gist:1218471
Created September 15, 2011 03:42
get entities to index
/**
* Returns an array of rows from a query based on an indexing namespace.
*/
function apachesolr_indexer_get_entities_to_index($namespace, $limit) {
$rows = array();
if (variable_get('apachesolr_read_only', 0)) {
return $rows;
}
$last_change = variable_get('apachesolr_indexer_last_run', 0);
@johnrobertwilson
johnrobertwilson / gist:1218466
Created September 15, 2011 03:39
Bad Cron Hook
/**
* Implements hook_cron().
*/
function apachesolr_indexer_cron() {
$cron_limit = variable_get('apachesolr_cron_limit', 50);
$rows = apachesolr_indexer_get_entities_to_index('apachesolr_search', $cron_limit);
apachesolr_indexer_enqueue($rows);
@johnrobertwilson
johnrobertwilson / gist:1215479
Created September 13, 2011 23:32
Easy Drupal 7 Tables output
$data = array(0 => 'data1', 1 => 'data2', 2 => 'data3');
$data_table = array(
'#theme' => 'table',
'#header' => array(t('data index'), t('data value')),
'#empty' => t('You have no content channels for this account.'),
'#rows' => array(),
);
if(!empty($data)){
foreach($data as $data_item_index => $data_item){
@johnrobertwilson
johnrobertwilson / gist:1214818
Created September 13, 2011 19:29
Entities by typ
/**
* Form builder for the bundle configuration form.
*
* @see apachesolr_indexer_config_form_submit().
*/
function apachesolr_indexer_config_form() {
$form['bundles'] = array(
'#type' => 'markup',
'#markup' => t('Select the entity types and bundles that should be indexed.'),
);
/Developer/D7: git clone [email protected]:bdglide/socialflow-drupal-module.git
Cloning into socialflow-drupal-module...
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 18 (delta 2), reused 18 (delta 2)
Receiving objects: 100% (18/18), done.
Resolving deltas: 100% (2/2), done.
/Developer/D7: ll
total 160
drwxr-xr-x 10 jr admin 340 Sep 12 15:41 .
@johnrobertwilson
johnrobertwilson / gist:1204124
Created September 8, 2011 18:04
Getting all entities and bundles
foreach (entity_get_info() as $entity_type => $entity_info) {
foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
$labels[$entity_type][$bundle] = !empty($bundle_info['label']) ? $bundle_info['label'] : FALSE;
}
}
@johnrobertwilson
johnrobertwilson / gist:1201011
Created September 7, 2011 16:20
DOE Setup?
<VirtualHost *:80>
ServerAdmin "[email protected]"
DocumentRoot "/Developer/D7/docroot"
ServerAlias drupal7.local
ErrorLog "/var/log/apache2/drupal7.local_log"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin "[email protected]"
DocumentRoot "/Developer/DOE/energy.gov/docroot"
@johnrobertwilson
johnrobertwilson / .htaccess
Created September 6, 2011 17:16
Drupal 7 .htaccess
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.