Skip to content

Instantly share code, notes, and snippets.

@Renrhaf
Created September 21, 2016 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Renrhaf/f0f4a78133a014ce0a85fed07d2953a9 to your computer and use it in GitHub Desktop.
Save Renrhaf/f0f4a78133a014ce0a85fed07d2953a9 to your computer and use it in GitHub Desktop.
AFOUND-840
diff --git a/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.api.php b/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.api.php
new file mode 100755
index 0000000..f8bfba4
--- /dev/null
+++ b/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.api.php
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Hooks for arte_feeds_afp module.
+ */
+
+/**
+ * Alter expire URLs after importing/cleaning AFP stories via drush.
+ *
+ * @param array &$expire_urls
+ * The URLs to be purged.
+ */
+function hook_arte_feeds_afp_expire_alter(&$expire_urls) {
+ // Add/remove some URLs from the array.
+}
diff --git a/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.drush.inc b/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.drush.inc
old mode 100644
new mode 100755
index dad61fb..d7c1988
--- a/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.drush.inc
+++ b/modules/custom/arte_afp/modules/arte_feeds_afp/arte_feeds_afp.drush.inc
@@ -89,6 +89,12 @@ function drush_arte_feeds_afp_afp_cleanup($time_str = '7 days ago') {
$atom_titles = _arte_feeds_afp_get_old_atoms_titles($timestamp);
scald_atom_delete_multiple(array_keys($atom_titles));
drush_log('Deleted ' . count($atom_titles) . ' atoms', 'ok');
+
+ // Clear varnish cache for homepage.
+ // Allow modules to change these URLs as needed.
+ $expire_urls = ExpireAPI::getFrontPageUrls();
+ drupal_alter('arte_feeds_afp_expire', $expire_urls);
+ ExpireAPI::executeExpiration($expire_urls);
}
/**
@@ -136,4 +142,10 @@ function drush_arte_feeds_afp_afp_import() {
// Throw batch.
drush_backend_batch_process();
+
+ // Clear varnish cache for homepage.
+ // Allow modules to change these URLs as needed.
+ $expire_urls = ExpireAPI::getFrontPageUrls();
+ drupal_alter('arte_feeds_afp_expire', $expire_urls);
+ ExpireAPI::executeExpiration($expire_urls);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment