Feed aggregator

John Goerzen: Being Different

Planet Debian - Sun, 09/11/2014 - 04:37

This evening, after the boys were in bed, Laura and I sat down to an episode of MASH (a TV series from the 70s) and leftover homemade pumpkin bars. She commented, “Sometimes I wonder what generation we’re in. This doesn’t seem to be something people are age are usually doing.” Probably true. I suppose people my age aren’t usually learning to play the penny whistle or put up antennas in trees either.

We’ve had a fun day today – a different sort of day in a lot of ways. We took the boys for their first Wichita Symphony Orchestra experience — they were doing their first-ever “family concert” (Beethoven Lived Upstairs, which combined Beethoven’s music with a two-person play aimed at kids). And they had an “instrument petting zoo” beforehand. Both boys loved it.

From November 8, 2014

After that, we took them to a sushi place for the first time. We ordered different types of rolls for our table, encouraging them to start with the California roll. They loved it (though Oliver did complain it was a bit hard to eat). Jacob happily devoured everything he could that wasn’t spicy. He would have probably devoured the plate of California roll slices by himself if I hadn’t stopped him and encouraged him to slow down and try some other things too.

It doesn’t seem very common around here to take 5-year-olds to a sushi place and plan on them eating the same sort of food that the adults around them are. It is a lot of fun to be different. Jacob and Oliver both have their unique personalities and interests, and I hope that they continue to find strength and joy in all the ways they are unique.

Categories: Elsewhere

Charles Plessy: Did we need a general resolution?

Planet Debian - Sun, 09/11/2014 - 02:55

In 2009 I called for a general resolution regarding membership procedures in Debian, to block a change that, in my opinion, was going against our values. Results, even if they satisfied the majority came with a bitter feeling and it became questioned whether a better solution could have been reached without using a constraining procedure. I did not think so, but not to the point of not having doubts about it, and therefore, regrets.

This year, we are again having a vote related to a change that some people think it goes against our values, and again the existence of this vote makes it hard to find compromises. Bitterness will win whatever the result is. For the avoidance of doubt, I have proposed the amendment number 3, stating that this general resolution should not have been started.

I hope that this amendment will defeat the original proposition and will make people think twice before pressing Debian's alarm button next time.

Categories: Elsewhere

Drupal core announcements: Drupal core updates for November 8, 2014

Planet Drupal - Sun, 09/11/2014 - 02:06

Co-authored by alimac, xjm, mparker17, and effulgentsia.

What's new with Drupal 8? DrupalCon Amsterdam and the Drupal 8 beta!

It's been more than a month since the last Drupal Core Update, and so much has happened! Around 2300 people travelled to the historic city of Amsterdam, Netherlands for DrupalCon Amsterdam, where after 5 days of sprinting, Drupal 8.0 entered beta! Beta 3 will be released on Wednesday, November 12.


Photo credit: Paul Johnson

Be sure to review the allowed beta changes policy to understand which core issues are still priorities for Drupal 8.0, and which will need to wait for Drupal 8.1 or Drupal 9.

Highly critical security fix released for Drupal 7 and 8

On October 15th, SA-CORE-2014-005, a highly critcial security fix necessary for all Drupal 7 and 8 sites was revealed and Drupal 7.32 and Drupal 8.0.0-beta2 were released to address the issue. A week later, on October 29th, the Drupal security team issued a public service announcement warning of automated attacks against Drupal sites that haven't been patched for SA-CORE-2014-005.

To help website administrators choose the best possible path for dealing with affected Drupal sites, Bevan Rudge has developed a detailed flowchart of actions to take, specific to different scenarios. One tool that can be useful is Drupalgeddon, a Drush command that can help detect some of the exploits. It is important to understand that some attacks may not leave any trace. If possible, restore your Drupal site from backup made before October 15, 2014.

In A Lesson In Security, Anthony Ferrara deconstructed the vulnerability and its resolution as well as Drupal Security Team's response. For some discussion of Drupal Security Team's practices and the media response, check out Bryan Ruby's post: Drupal Security: Not Shocking but Responsible.

D8 critical office hours with chx

Core contributor chx has started a weekly critical issue office hours on Fridays at 12:00p PST. If you are interested in really digging into a tough problem and helping resolve a stagnating release blocker, or if you are stuck on a critical currently, join #drupal-contribute IRC channel during the office hours. See chx's report of the first critical office hours for an idea of what we've done so far!

Where's Drupal 8 at in terms of release?

DrupalCon Amsterdam and the beta release have brought lots of new momentum to the critical issue queue, with many issues both identified and resolved. Of the 130 critical issues currently blocking Drupal 8's release, 1 in 3 are new since the initial beta release, and 58% have activity within the past two weeks!

Where can I help? Top criticals to hit this week

Each week, we check with core maintainers and contributors for the "extra critical" criticals that are blocking other work. These issues are often tough problems with a long history. If you're familiar with the problem-space of one of these issues and have the time to dig in, help drive it forward by reviewing, improving, and testing its patch, and by making sure the issue's summary is up to date and any API changes are documented with a draft change record.

More ways to help

As always, if you're new to contributing to core, check out Core contribution mentoring hours. Twice per week, you can log into IRC and helpful Drupal core mentors will get you set up with answers to any of your questions, plus provide some useful issues to work on.

You can also help by sponsoring independent Drupal core development.

Notable Commits

So much great work has gone into Drupal 8 in the past weeks that it's difficult to pick the best of git log --after=2014-09-18 --pretty=oneline (571 commits in total). The final beta blocker was resolved across several issues, as were many entity API, theme system, dependency management, usability, and accessibility improvements.

  • Issue #2271419 by alexpott, larowlan: Fixed Allow field types, widgets, formatters to specify config dependencies.
  • Issue #1879930 by fran seva, Gábor Hojtsy, martin107, markie, Schnitzel, alexpott, Sutharsan, mon_franco, YesCT, spearhead93, herom, Désiré: Fixed Language selectors are not showing localized to the page language.
  • Issue #1953770 by amateescu: Move the field-specific settings form elements at the top of the form.
  • Issue #2224581 by alexpott, larowlan, jhodgdon, mgifford: Delete forum data on uninstall.
  • Issue #2332935 by plach, alexpott, dawehner: Allow code to respond to entity/field schema changes.
  • Issue #2028053 by vegantriathlete, franxo, InternetDevels, thamas, rootwork, LewisNyman: Add typographic styles, components, and utility classes.
  • Issue #2226207 by lauriii, mgbellaire, Cottser, m1r1k, Mark Carver, LinL, rachel_norfolk, rteijeiro, skwashd, davidhernandez, euphoric_mv: Make 'template' the default output option for hook_theme().
  • Issue #2350779 by benjy: Update Migrate maintainers in MAINTAINERS.txt.
  • Issue #2292035 by DimitriV, mgifford | andrewmacpherson: Fixed CKEditor uses the automatically generated ID attribute for the body field in the ARIA label.
  • Issue #2324791 by Michael Hodge Jr, ParisLiakos: Remove watchdog().
  • Issue #2329501 by alexpott, mdrummond, davidhernandez | Cottser: Add classy.info.yml to core, set Classy as base theme for Bartik and Seven.
  • Issue #2278353 by cilefen, dawehner, hussainweb, jibran, andyceo: Update to Symfony 2.5.
  • Issue #2304987 by Berdir, Wim Leers: Fixed Don't invalidate cache tags of referenced entities, use entity list cache tags correctly, add test coverage for entity list cache tags.
  • Issue #1869476 by rteijeiro, LewisNyman, lauriii, Wim Leers, mdrummond, swentel, hosef, cbiggins, larowlan, sun, EclipseGc, Gábor Hojtsy: Convert global menus (primary links, secondary links) into blocks.
  • Issue #2343759 by pwolanin, larowlan, dawehner, tim.plunkett, effulgentsia, xjm, Wim Leers: Provide an API function to replace url()/l() for external urls.
  • Issue #2002138 by yched, Jose Reyero, xjm, andypost, fago, msonnabaum, Berdir, dixon_: Use adapters for supporting typed data.
  • Issue #2338475 by herom: Remove hook_permission().
  • Issue #2232605 by alexpott, dawehner, martin107, Cottser, sun: Fixed Themes cannot be uninstalled.
Security fixes

Now that Drupal 8 is in beta, we're focusing on resolving disclosed security vulnerabilities in Drupal 8 so that site owners can safely build test sites. Here are the security fixes that have gone in over the past weeks:

  • Issue #1948418 by webflo, martin107, galooph, cilefen, gaurav.goyal, amitgoyal, dawehner, dstol: Fixed Address SA-CONTRIB-2013-035 for views in D8.
  • Issue #2357249 by Stefan Horst, greggles, larowlan, David_Rothstein, klausi: Fixed SA-CORE-2014-005 (SQL injection).
  • Issue #2304969 by pwolanin, cilefen, Berdir, Devin Carlson, klausi: Fixed Port private files access bypass from SA-CORE-2014-003.
  • Issue #2242749 by znerol, torotil, rszrama, larowlan, dawehner, penyaskito, tim.plunkett, sun, Damien Tournoud, David_Rothstein, effulgentsia: Fixed Port Form API security fix SA-CORE-2014-002 to Drupal 8.
  • Issue #2234277 by cilefen, hussainweb, Xano, netlooker, martin107: Composer update (includes security fixes).
  • Issue #2029855 by klausi, benjy, fgm, hussainweb, Cottser, pfrenssen, kim.pepper | moshe weitzman: Fixed Missing access control for user base fields.
  • Issue #2098419 by larowlan | fago: Fixed Missing default access for all comment fields.
Drupal 8 Around the Interwebs Drupal 8 in "Real Life" Whew! That's a wrap!

Do you follow Drupal Planet with devotion, or keep a close eye on the Drupal event calendar, or git pull origin 8.0.x every morning without fail before your coffee? We're looking for more contributors to help compile these posts. You could either take a few hours once every six weeks or so to put together a whole post, or help with one section more regularly. Read more about how you can volunteer to help with these posts!

Categories: Elsewhere

Martin-Éric Racine: On the Joey debacle

Planet Debian - Sun, 09/11/2014 - 00:07

Looking back, I cannot think of a single moment when Joey wouldn't have shown the utmost patience and courtesy towards anyone involved in Debian, even towards mere users filing sometimes senseless bug reports against his packages. From this perspective, I cannot help but venture that whatever chain of events lead to Joey's decisions essentially means one thing: Debian must have seriously gotten off-course for someone who has been involved for so long to call it quits. As for the current situation at hands, while I admittedly haven't followed too closely who or what caused Joey's decision, I nonetheless cannot help but feel that whoever pushed Joey's buttons so hard as to make him decide to leave Debian ought to be the one(s) kicked out of Debian instead.

Categories: Elsewhere

Bluespark Labs: BADCamp Drupal Higher Education Summit - Stories of rapid adaption and the challenges of standardization at scale

Planet Drupal - Sat, 08/11/2014 - 19:08

Attending the Higher Education Summit at the 2014 Bay Area Drupal Camp was a great experience. We work with several higher education institutions and are acutely aware of the very specific challenges these organizations face. The summit improved our understanding of the issues and helped them coalesce around a few key overarching concerns: standardization, adaption and scalability.

The summit got off to a great start before even starting because of the theme selected: “Storytellers and Geeks United for Higher Ed”. A clear indication of the importance of not solving just technological issues but solving communication issues with the help of technology. Everyone was in agreement that web people and communication people need to get together to figure out how to best tell their university’s story.

The opening panel session was the perfect illustration of the theme as it brought together technologists and communications partners (with the roles often blending into each other) from the universities of Arizona State, University of California, Davis and University of California, San Francisco. The big news for all was Arizona State’s bold move to enforce (albeit with a light touch) standardization from the top down. Arizona State has embarked on a very ambitious project aiming to provide a complete set of tools for departments to build their websites that spans not just the actual web page but hosting, analytics, sophisticated email and CRM systems (institution-wide Salesforce instance). All this will ultimately enable them to realize their vision of personalizing the experience for every user of the University. While it is still early days everyone seemed very excited about what AS is attempting to do and we are eagerly awaiting news about lessons learned.

A session by John Bickar of Stanford Web Services was inspiring and provided a great roadmap for any university about how to drive adoption of Drupal within the institution and support the needs of the community by providing both infrastructure and Drupal development tools in the form of pre-baked solutions and templates. As John indicated the forthcoming challenges for them will be those of success. They are seeing great adoption of their hosting solution and web development tools and need to ensure that they will be able to scale.

Finally, I found the discussions around development processes, estimation and the use of agile particularly interesting. It is clear that where such processes have been put in place it has yielded positive results. At a break-out session on the subject everyone agreed that while agile provides a great set of principles it is equally important that to adapt the practices to the specific needs of an organization. In other words don’t be afraid to try a few different things and see what works for you, but start getting a process in place!

Overall, it looks like the future of Drupal in Higher Education is brighter than ever. The problems are those of improving communication and dealing with the success that widespread adoption brings. Helping to standardize around common practices in how Drupal is deployed and how individual departments adapt so that they can meet both wider University needs as well as their specific requirements will be key. This will allow the University as a whole and groups within it to each tell the best version of their story.

Many thanks to everyone that worked hard to make this summit possible and we look forward to attending next year!

Tags: Higher EducationDrupalDrupal Planet
Categories: Elsewhere

Paul Booker: Sending Push Notifications to users with a given role using Private Messages

Planet Drupal - Sat, 08/11/2014 - 18:27
/** * Implements hook_privatemsg_message_insert. */ function push_notifications_privatemsg_message_insert( $message ) { if ( variable_get( 'push_notifications_privatemsg_integration', 0 ) ) { // Compose the payload. If the body is empty, just use the subject line. // Otherwise, combine subject and body. $payload = (empty($message->body)) ? $message->subject : $message->subject . ' ' . $message->body; $payload = 'From ' . $message->author->name . ': ' . $payload; // Compose an array of recipients. $recipients = array(); foreach ( $message->recipients as $recipient ) { if ( $recipient->type == "role" && $recipient->name != 'authenticated user' ) { $results = db_select('users_roles', 'ur') ->fields('ur', array('uid')) ->condition('ur.rid', $recipient->rid, '=') ->execute() ->fetchCol(); } elseif ( $recipient->type == "role" && $recipient->name == 'authenticated user' ) { $results = db_select('users', 'u') ->fields( 'u' ) ->execute() ->fetchCol(); } if ($recipient->type == "role") { foreach ($results as $result) { $recipients[] = $result; } } else{ $recipients[] = $recipient->uid; } } push_notifications_send_message( $recipients, $payload ); } } Tags: URL: Push Notification does not send Push when Private Message goes to Roles
Categories: Elsewhere

Andrew Cater

Planet Debian - Sat, 08/11/2014 - 16:51
Still at the mini-Debconf in Cambridge

Lots of talks, hopefully being live streamed.

Lots of side chats going on - also a room full of folk typing on laptops while lectures are going on - multi-tasking, as ever.

New ideas bouncing around as people see interesting possibilities - all good fun, as ever.
Categories: Elsewhere

Gunnar Wolf: Collective pain

Planet Debian - Sat, 08/11/2014 - 16:25

The following text is not mine. I'm copy-translating a text a dear friend of mine just wrote in Spanish, in Facebook. He writes far better than I do (much better than most people I have known). I am not also a great translator. If you can read Spanish, go read the original.

I hate my country. I want to get the hell out of here. This country stinks.

Phrases that appear in talks between Mexicans since yesterday. On the network and outside of it. And to tell the truth, I would have put them between quotation marks if I had not thought them as well. At some point. Because that is the edtent of the pain. Enuogh to hate, to insult, to give up.

But we talk and write without realizing that it might be the most terrible thing in all this mess. That the pain makes us give up and consent to play a role in the game that they, the executioners, would pleasedly look at from their tribunes, laughing at us while they hand each other the popcorn. That would be over the line. So lets not give them that joy.

Because they surely don't realize we have the obligation to notice it from the very beginning and do something to avoid falling there: The root of the pain they caused us yesterday is because that's how the annihilation of hope feels like.

The shout "Alive they were taken" –they do not realize but we do– is a shout of hope. A pronouncement for the possible goodness in the human being. A testimony of hope in the future. A bet for life. And with his cold address, the federal attorney yesterday wanted to finish the killing of our already aching hope. We cannot grant him that joy.

They say it's the last thing that dies. I'd say it's the only thing that should not die. Ever. It finishes and everything finishes.

There is no possible justice for the parents of the 43. Much less for the 43. Not even however much the official discourse wants to gets us dizzy with the propaganda saying "we will not rest until". Not even if the president quits that would bring back to their classrooms even one of those that by today are just ashes. And sadly, that's the excuse that man wields to not stop boarding his plane and travel wherever he pleases. The farthest from Mexico, the better. Lets not do the same.

Lets remind the world this country is full of us, not of them. That the face of a persn is not the dirtyness on his forehead and cheeks, but the skin that's below, that feels and throbs. Lets show the world Mexico is more the verse than the blood, more the idea than the terror.

And to them...

Lets not give them the joy.

To them, lets make them see that, however hard they try, there are things they will never take from us.

Our love for this country, for example.

The country, over all things.

- Antonio Malpica. After what appears to be the bitter and sadly expected end of a sad, terrible, unbelievable collective social rupture we have lived for ~50 days.

And what comes next? How can it come? How can we expect it? I have no way to answer. We, the country's people, are broken.

Categories: Elsewhere

Steve Kemp: Some brief notes on Docker

Planet Debian - Sat, 08/11/2014 - 14:33

Docker is the well-known tool for building, distributing, and launching containers.

I use it personally to run a chat-server, a graphite instance, and I distribute some of my applications with Dockerfiles too, to ease deployment.

Here are some brief notes on things that might not be obvious.

For a start when you create a container it is identified by a 64-byte ID. This ID is truncated and used as the hostname of the new guest - but if you ever care you can discover the full ID from within the guest:

~# awk -F/ '{print $NF}' /proc/self/cgroup 9d16624a313bf5bb9eb36f4490b5c2b7dff4f442c055e99b8c302edd1bf26036

Compare that with the hostname:

~# hostname 9d16624a313b

Assigning names to containers is useful, for example:

$ docker run -d -p 2222:22 --name=sshd skxskx/sshd

However note that names must be removed before they can be reused:

#!/bin/sh # launch my ssh-container - removing the name first docker rm sshd || true docker run --name=sshd -d -p 2222:22 skxskx/sshd

The obvious next step is to get the IP of the new container, and setup a hostname for it sshd.docker. Getting the IP is easy, via either the name of the ID:

~$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' sshd 172.17.0.2

The only missing step is the ability to do that magically. You'd hope there would be a hook that you could run when a container has started - unfortunately there is no such thing. Instead you have two choices:

  • Write a script which parses the output of "docker events" and fires appropriately when a guest is created/destroyed.
  • Write a wrapper script for launching containers, and use that to handle the creation.

I wrote a simple watcher to fire when events are created, which lets me do the job.

But running a deamon just to watch for events seems like the wrong way to go. Instead I've switched to running via a wrapper dock-run:

$ dock-run --name=sshd -d -p 2222:22 skxskx/sshd

This invokes run-parts on the creation directory, if present, and that allows me to update DNS. So "sshd.docker.local" will point to the IP of the new image.

The wrapper was two minutes work, but it does work, and if you like you can find it here.

That concludes my notes on docker - although you can read articles I wrote on docker elsewhere.

Categories: Elsewhere

Ingo Juergensmann: Bind9 vs. PowerDNS - part 2

Planet Debian - Sat, 08/11/2014 - 11:31

Two weeks ago I wrote about implementing DNSSEC with Bind9 or PowerDNS and asked for opinions, because Bind9 appeared to me to be too complex to set it up with regular key signing and such and PowerDNS seemed to me to be nice and easy, but some kind of black box where I don't now what's happening.

I think I've now found the best and most suitable way for me to deal with DNSSEC. Or in short words: Bind9 won!

It won because of its inline-signing config option that you can use in bind9.9, which happens to be in backports. Another tip I can give due to my findings on the web: if you plan to implement DNSSEC with Bind9, do NOT! search for "bind dnssec" on the web. This will only bring up old HowTos and manuals which leaves you with the burden of manually update your keys. Just add the magic word "inline-signing" to your search phrase and you'll find proper results like the one from Michael McNally on a subpage of ISC.org: In-line Signing With NSEC3 in BIND 9.9+ -- A Walk-through. It's a fairly good starting point, but still left me with several manual steps to do to get a DNSSEC-signed zone. 

I'm quite a lazy guy when it comes down to manual steps that needs to get executed repeatedly, as many others in IT as well, I think. So I wrote some sort of small wrapper script to do the necessary steps of creating the keys, adding the necessary config options to your named.conf.local, enabling nsec3params, add the DS records to your zone file and displaying the DNSKEY to you, so that you just need to upload it to your registrar.

One problem was still open: when doing auto-signing/inline-signing with bind9, you are left with your plain text zone file whereas your signed zone file will keep to increase the serial with each key rollover. When changing your plain text zone file by adding, changing or removing RRs of that domain, you'll be left with the manual task of finding out was your actual serial is that is currently used, because it's not your serial +1 from your plain text zone file anymore. This is of course an awkward part I wanted to get rid off. And therefor my script includes an option to edit zone files with your favorite editor, increase the serial automatically by determing the currently highest number, either on disk or in DNS and raising this serial by 1. Finally the zone is automatically reloaded by rndc.

That way I now have the same comfort as in PowerDNS with Bind9, but also know what's going on, because it's not a black box anymore. Me happy. :-)

P.S.: I don't know whether this script is of interest to other users, because it relies heavily on my own setting, e.g. paths and such. But if there's interest, just ask...

Kategorie: DebianTags: DebianSoftwareInternetDNS 
Categories: Elsewhere

Russ Allbery: Another book haul

Planet Debian - Sat, 08/11/2014 - 06:05

Someday there will be reviews. Also, software releases. But these posts are much easier to write in the evening when my brain is fried. Also, the anticipation of reading good books is delightful. The motivating reason for this order was that Powell's was giving away $10 gift cards with an order, so I bought books to buy more books later.

Iain M. Banks — Feersum Endjinn (sff)
Jacqueline Carey — Autumn Bones (sff)
Robert Caro — The Path to Power (non-fiction)
Keith Houston — Shady Characters (non-fiction)
Jan Morris — Hav (mainstream)
Arika Okrent — In the Land of Invented Languages (non-fiction)

I've been in a non-fiction mood lately, so lots of random non-fiction here.

The Caro is the first volume of his huge biography of LBJ, which is apparently one of the best biographies ever written. The other non-fiction is less serious: one about intentionally-created languages, and the other about the history of punctuation characters. Hav is a travel book about a city that doesn't actually exist, so it fits somewhat with the non-fiction theme.

Categories: Elsewhere

Entity Pilot: The Entity Pilot exists plugin - dealing with conflicts

Planet Drupal - Sat, 08/11/2014 - 05:06

Any content-staging workflow is going to have conflicts. In the simplest form a conflict exists when trying to import content that already exists. In more complex cases conflict might occur between revisions.

Having a solid API to detect and handle conflicts is key to any content-staging workflow. Read on to find out how Entity Pilot handles conflicts via an extendable plugin system.

Categories: Elsewhere

Entity Pilot: Working with normalizers in Drupal 8

Planet Drupal - Sat, 08/11/2014 - 05:06

Entity Pilot makes extensive use of normalizers for handling dereferencing incoming content.

Normalizers are a key part of Drupal 8's serialization strategies and represent a flexible extension point for your module to interact with core APIs.

Read on to learn how your code can interact with Drupal's normalizing and denormalizing operations and influence what is output by the REST and Hal modules.

Categories: Elsewhere

Entity Pilot: Introducing Entity Pilot - Painless content staging for Drupal

Planet Drupal - Sat, 08/11/2014 - 05:06

After nine months of development, we're proud to announce Entity Pilot, a painless content-staging solution for Drupal.

Offering a flexible content deployment model that adapts your preferred workflow, Entity Pilot aims to solve deploying content once and for all.

Read on for details on how it works and our plans for future development.

Categories: Elsewhere

Paul Booker: Updating push notification page to send out messages to devices belonging to users with a given role

Planet Drupal - Sat, 08/11/2014 - 01:49
/** * Additional handler for push_notifications_mass_push_form_validate form validate. */ function mymodule_push_notifications_mass_push_form_validate($form, &$form_state) { } /** * Additional handler for push_notifications_mass_push_form_submit form submit. */ function mymodule_push_notifications_mass_push_form_submit($form, &$form_state) { $recipients = $form_state['values']['recipients']; $payload = $form_state['values']['payload']; $role = $form_state['values']['role']; $language = (isset($form_state['values']['language'])) ? $form_state['values']['language'] : false; // Send message to all iOS recipients. if (!empty($recipients['ios'])) { // Get all iOS recipients. $tokens_ios = push_notifications_get_tokens_by_role(PUSH_NOTIFICATIONS_TYPE_ID_IOS, $role, $language); if (!empty($tokens_ios)) { // Convert the payload into the correct format for APNS. $payload_apns = array('aps' => $payload); $result = push_notifications_apns_send_message($tokens_ios, $payload_apns); $dsm_type = ($result['success']) ? 'status' : 'error'; drupal_set_message($result['message'], $dsm_type); } else { drupal_set_message(t('No iOS recipients found, potentially for this language.')); } } // Send message to all Android recipients. if (!empty($recipients['android'])) { // Get all Android recipients. $tokens_android = push_notifications_get_tokens_by_role(PUSH_NOTIFICATIONS_TYPE_ID_ANDROID, $role, $language); if (!empty($tokens_android)) { // Determine which method to use for Google push notifications. switch (PUSH_NOTIFICATIONS_GOOGLE_TYPE) { case PUSH_NOTIFICATIONS_GOOGLE_TYPE_C2DM: $result = push_notifications_c2dm_send_message($tokens_android, $payload); break; case PUSH_NOTIFICATIONS_GOOGLE_TYPE_GCM: $result = push_notifications_gcm_send_message($tokens_android, $payload); break; } $dsm_type = ($result['success']) ? 'status' : 'error'; drupal_set_message($result['message'], $dsm_type); } else { drupal_set_message(t('No Android recipients found, potentially for this language.')); } } } /** * Determine all recipients of a given role from a specific device type. * * @param $type_id * Device Type ID. * @param $role * User Role. * @param $language * Language code, optional. * @param $raw * Boolean, set true to retrieve the raw query results. * * @return * Array of results, null if no entries. */ function push_notifications_get_tokens_by_role($type_id = '', $role = FALSE, $language = FALSE, $raw = FALSE) { // Make sure this type_id is supported. $valid_type_ids = array(PUSH_NOTIFICATIONS_TYPE_ID_IOS, PUSH_NOTIFICATIONS_TYPE_ID_ANDROID); if (!in_array($type_id, $valid_type_ids)) { return FALSE; } // Select all tokens for this type id and users of given user role. $query = db_select('push_notifications_tokens', 'pnt'); $query->join('users', 'u', 'pnt.uid = u.uid'); $query->join('users_roles', 'ur', 'u.uid = ur.uid'); $query->fields('pnt', array('token')); $query->condition('pnt.type', $type_id); $query->condition('ur.rid', $role); // If language code is passed, limit the results by language. if ($language) { $query->condition('pnt.language', $language); } $result = $query->execute(); // Return raw result, if needed. if ($raw) { return $result; } // Otherwise, create an array of tokens. else { $tokens = array(); foreach ($result as $record) { $tokens[] = $record->token; } return $tokens; } } /** * Implements hook_form_alter(). */ function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'push_notifications_mass_push_form') { $result = db_select('role', 'r') ->fields('r',array('rid','name')) ->condition('name',array('administrator','anonymous user'),'NOT IN') ->execute() ->fetchAll(); $role = array(); foreach($result as $role){ $roles[$role->rid] = $role->name; } $form['role']['#title'] = "Roles"; $form['role']['#type'] = "select"; $form['role']['#options'] = $roles; $form['role']['#required'] = 1; $form['#validate'][] = 'mymodule_push_notifications_mass_push_form_validate'; unset($form['#submit']); $form['#submit'][] = 'mymodule_push_notifications_mass_push_form_submit'; } } Tags:
Categories: Elsewhere

Code Karate: How to setup a Drupal website with Bluehost

Planet Drupal - Fri, 07/11/2014 - 23:57

So let me guess: You either have a Drupal website or are going to create one and need a place to

Categories: Elsewhere

ImageX Media: Speeding up your MySQL dump/restores with Mydumper

Planet Drupal - Fri, 07/11/2014 - 23:39
Why Mydumper?

How many times in your last web development project have you had to load a mysql/mariadb database? If your answer was "too many", and you've been frustrated by how slow the process can be, this article may be for you.

Categories: Elsewhere

Appnovation Technologies: How to Use Drupal REST Services with AngularJs

Planet Drupal - Fri, 07/11/2014 - 23:20

In a previous post I showed how to use Drupal 8 RESTful services.

var switchTo5x = false;stLight.options({"publisher":"dr-75626d0b-d9b4-2fdb-6d29-1a20f61d683"});
Categories: Elsewhere

Pages

Subscribe to jfhovinne aggregator