This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/bin/echo -e 'flush_all\nquit' | nc -q1 $(hostname -s) 11211 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'flush_all' | nc localhost 11211 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# D7 Search API Solr or apachesolr.module | |
drush --uri=[domain] ev ' | |
// Get Solr. | |
function XX_get_solr() { | |
$solr = false; | |
if (function_exists("apachesolr_get_solr")) { | |
// apachesolr.module | |
$solr = apachesolr_get_solr(); | |
} | |
elseif (function_exists("search_api_server_load")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# D8 Search API Solr: Wipe a Solr core completely NEEDS EDITING | |
drush --uri=[domain] ev ' | |
$search_api_server_machine_name = "acquia_search_server"; ## EDIT THIS IF NEEDED | |
$backend = Drupal\search_api\Entity\Server::load($search_api_server_machine_name)->getBackend(); | |
$connector = $backend->getSolrConnector(); | |
# Code based on \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::deleteAllIndexItems() | |
$query = "solrfieldname:solrfieldvalue"; ## REPLACE "solrfieldname:solrfieldvalue" WITH "*:*" TO DELETE EVERYTHING | |
$update_query = $connector->getUpdateQuery(); | |
$update_query->addDeleteQuery($query); | |
$update_query->addOptimize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$node = node_load(1); // 1 is node id we want to load | |
// Change field value | |
$node->field_product_description[$node->language][0]['value'] = 'This is a very nice and useful product. Buy it now! We want your money!'; | |
// Get the numeric id of your field by passing field name | |
$info = field_info_field('field_product_description'); | |
$fields = array($info['id']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Save the original field collection data. | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'commerce_product') | |
->entityCondition('bundle', $entity->type) | |
->propertyCondition('product_id', $entity->product_id); | |
$result = $query->execute(); | |
if (isset($result['commerce_product'])) { | |
$original_product = $result['commerce_product']; |
NewerOlder