Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Plone and Drupal: CMS Coexistence in Higher Edu...

Plone and Drupal: CMS Coexistence in Higher Education

70% of Higher Ed institutions running Plone also use Drupal. While some universities go down the path of consolidating onto one platform, there is another simpler and cheaper option: integrating the two CMSs.

Calvin Hendryx-Parker

June 20, 2014
Tweet

More Decks by Calvin Hendryx-Parker

Other Decks in Programming

Transcript

  1. #psm14 Cons... • Expensive: • CMS Evaluation • Migration •

    Bit Rot • Training • Demotivating • Polarizing Credits: http://ekladata.com
  2. #psm14 /** * Implements hook_node_insert(). */ function pushhub_node_insert($node) { if

    ($node->status && $node->promote) { pushhub_notify(array($node->nid), 'shared.xml'); } }
  3. #psm14 /** * Put stuff in the queue */ function

    pushhub_notify($nids, $topic='shared.xml', $timeout=60){ $hub_url = variable_get('pushhub_huburl', 'http://example.com/hub'); Resque::setBackend('localhost:6379'); $headers = array('Content-Type' => 'application/x-www-form-urlencoded'); $topic_url = url("pushhub/" . $topic, array('absolute' => TRUE)); $payload = array('hub.mode' => 'publish', 'hub.url' => $topic_url); $hub_endpoint = $hub_url . "/publish"; # Add the job to the queue Resque::enqueue('default', 'Post', array($hub_endpoint, $payload, $headers, $timeout)); }
  4. #psm14 class Post { public function perform() { $endpoint_url =

    $this->args[0]; $payload = $this->args[1]; $headers = $this->args[2]; $timeout = $this->args[3]; $request = Requests::post($endpoint_url, $headers, $payload, array('timeout' => $timeout)); } }
  5. #psm14 import requests ! ! def post(endpoint, payload, headers, timeout=60):

    response = requests.post( endpoint, data=payload, headers=headers, timeout=timeout) return response.status_code