Skip to content

Instantly share code, notes, and snippets.

View iAugur's full-sized avatar

George Boobyer iAugur

View GitHub Profile
@iAugur
iAugur / Readme.txt
Last active August 29, 2015 14:02
Magento and Drupal in one site
This Gist is to show how to set up a document structure and VHosts file to get a magento site to work alongside a Drupal site
the original post is here: http://technology.blue-bag.com
@iAugur
iAugur / A-readme.txt
Last active July 8, 2019 12:15
Adding a Reset Button to a Drupal form
I have come across a lot of discussions about how to add a reset button to a form in Drupal 7.
If you search for 'add a reset button to a drupal form' you will find loads of examples using the #markup method of adding html for a reset button. This is because using the render array to add a button #type=> 'button' gives the button a class of 'form-submit'.
But you can use the render array and simply give the button a '#button_type' which translates into a class. Buttons on a form default to submit and that is why they get a class of form-submit. But make the type 'reset' and it will get a class of form-reset.
@iAugur
iAugur / areadme.md
Last active January 8, 2019 13:33
Excluding common requests from your apache logs

Original article: http://www.blue-bag.com/blog/excluding-common-requests-your-apache-logs

Log files can get filled up with repeated calls to files such as favicon, robots.txt, images, css js etc

Mostly you want to log the initial request for a page and not all of the resources subsequently requested.

Troubleshooting other issues may mean you would log files such as favicon, images etc - but generally they needlessly fill up your logs.

Do it ocassionally to look for missing images etc.

@iAugur
iAugur / about-rewrite-access-php.md
Last active December 19, 2015 16:19
Control access to sensitive files
@iAugur
iAugur / commerce_bestsellers.sql
Last active April 14, 2018 05:32
Drupal Commerce - Top selling Products
/**
* Get a list of the top selling products on a Drupal Commerce site
* If you have different product types - add them to the in list.
* Based on https://drupal.org/node/1292104#comment-6866420 by tmsimont https://drupal.org/user/566678
*/
SELECT node.title AS product_title, node.nid AS product_nid, COUNT(cp.title) AS order_count
FROM commerce_order
LEFT JOIN field_data_commerce_line_items as fdcli ON commerce_order.order_id = fdcli.entity_id AND (fdcli.entity_type = 'commerce_order' AND fdcli.deleted = '0')
INNER JOIN commerce_line_item as cli ON fdcli.commerce_line_items_line_item_id = cli.line_item_id
@iAugur
iAugur / example_data.sql
Last active December 19, 2015 00:49
Examples for working with Relational Division
/* Tables and data for Relational Division Example */
CREATE TABLE `skill` (
`idSkill` int(11) NOT NULL AUTO_INCREMENT,
`Skill` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idSkill`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
CREATE TABLE `person` (
`idPerson` int(11) NOT NULL AUTO_INCREMENT,
@iAugur
iAugur / Drupal-Node-status-vs-entity_translation-Status.sql
Last active December 15, 2015 13:48
The entity_translation status does not get updated when the node status changes - This can lead to the main language translation not appearing - see http://technology.blue-bag.com/entity-translations-and-published-status-flag
/**
* Get a list of nodes where the entity_translation status is not in sync
* Note we only get the unpublished translations as it is the node status we are concerned with
* We are also only interested in the source translations
**/
select node.status, et.status
from entity_translation et
inner join .node on node.nid = et.entity_id and et.entity_type = 'node'
where node.status <> et.status and et.status = 0 and et.source = ''
@iAugur
iAugur / node_comment_statistics.sql
Created February 13, 2013 21:42
Drupal Rebuild node_comment_statistics from http://drupal.org/node/137458#comment-5072066
/**
* Rebuild the node_comment_statistics
* turn off when importing
* $commentvar = variable_get('comment_maintain_node_statistics', TRUE);
* variable_set('comment_maintain_node_statistics', FALSE);
* ref: http://drupal.org/node/137458#comment-5072066
*/
TRUNCATE TABLE node_comment_statistics;
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="none"/>
</cross-domain-policy>
@iAugur
iAugur / How to purge Binary Logs.md
Last active December 12, 2015 01:28
Purge MySQL binary logs