Planet Drupal

Subscribe to flux Planet Drupal
Drupal.org - aggregated feeds in category Planet Drupal
Mis à jour : il y a 26 min 47 sec

Drupal Association News: Get Ready to Vote: Elections Run 9 March - 20 March

lun, 02/03/2015 - 19:51
Huh? What are we Electing?

In case you missed it, the Drupal community electing one candidate to serve a two-year term on the Drupal Association Board of Directors. There are two At-Large (community elected) seats on the Board. The other seat is currently held by Matthew Saunders. We've got a really global slate of candidates to consider, and we encourage you to get to know them by listening to the Meet the Candidates sessions and asking them questions on their candidate profile pages. 

Who can vote?

Voting is open to all individuals who have a Drupal.org account by the time nominations opened and who have logged in at least once in the past year. These individuals' accounts will be added to the voters list on association.drupal.org and they will have access to the voting.

To vote, you will rank candidates in order of your preference (1st, 2nd, 3rd, etc.). The results will be calculated using an "instant runoff" method. For an accessible explanation of how instant runoff vote tabulation works, see videos linked in this discussion.

Elections process

Voting will be held from 9 March, 2015 through 20 March, 2015. During this period, you can review and comment on candidate profiles on assoc.drupal.org and engage all candidates through posting to the Drupal Association group. We'll also be scheduling and announcing three phone-in all candidates meetings, where community members and candidates can ask questions and get to know each other.

Have questions? Please contact Drupal Association Executive Director Holly Ross. Many thanks to nedjo for pioneering this process and documenting it so well in the past!

Flickr photo: Kodak Views

Catégories: Elsewhere

Phase2: How to Override Features

lun, 02/03/2015 - 17:36

The Features module helps address the shortcoming in Drupal 7 of how to manage and deploy site configuration data.  There are times when you need to change a Feature.  The Features Override module can help with this, but sometimes doesn’t solve the problem completely.  In this article I will discuss all the different ways to override your Features and the common problems associated with that.  While this has been an issue for years, it’s become more common recently with the advent of Distributions such as Open Atrium and Panopoly which heavily use Features and which expect the users to upgrade to new versions.  Maintaining your site customizations when upgrading a distribution using Features Override has become a more common need.

The Problem

How do I override configuration from an existing Feature  within my site-specific project?

Solutions Cloning the base module (not recommended)

If you need to make extensive changes you might need to clone the base module and then customize it.  Disable the original module, uninstall it, then enable your site-specific module.

Pros Cons
  1. You have full control over all aspects of the original module.
  2. Keeps the overrides nicely separate in their own modules that can be enabled/disabled/deployed.
  3. The original Features will never be shown “overridden” (because the original is uninstalled!)
  1. Any future bug fixes, improvements, updates to the original module will not be available.
  2. Since future security patches to the original module won’t be available, this might add a security risk to the project or force maintainers to monitor the original module for updates and apply them to the cloned version.
Using settings.php

If you just need to change a variable (from variable_get) you can do this via the $conf[] array in your site settings.php file.  This method is typically used for environment-specific settings, such as databases, search servers, caching settings, etc.  You can also set the $conf[] array within a custom module if you need to deploy the change across all your environment.  Avoid using variable_set() to change the variable since that will update the database directly as mentioned below.

Pros Cons
  1. The original feature containing the variable (via Strongarm) won’t be marked as “overridden”
  1. Only works for Variables (Strongarm Features)
  2. settings.php not typically part of the code repo, so need to ensure it is version controlled some other way.
  3. Sometimes developers forget to check settings.php for variable overrides, making ongoing support tricky.
  4. Best for Environment variables rather than for any generic Drupal variable.
Update the Database directly

You can create an update hook, or other Drupal hook (hook_enable, hook_install) and update the database directly via SQL or other API functions.  For variables you can use variable_set() to save the new value to the database.  This is only recommended as the last resort for configuration not supported by Features Override.

If you must update the database directly, be sure to only do it once and not in a hook such as hook_init that runs with each page load.  Updating the database on each page load can kill the performance of your site.  With variable_set() you can do this by first calling variable_get() and only saving the value if it needs to be changed.

Pros Cons
  1. Sometimes it’s the only way.
  2. Can keep the overrides separate in their own modules
  3. Only applies specific changes and allows future updates to the base Feature to be used.
  1. Reverting the base feature will change the database back to it’s original value, forcing you to re-run whatever SQL is needed to override it. Can be alleviated by Locking the original base Feature to prevent any reverts.
  2. If the original feature is locked, future bug fixes or improvements might not be available.
  3. The original feature will always be marked as “overridden”.
  4. Some configuration is not stored in the DB, such as Views (or other ctools-based components like Panels) that exist purely in code.
Implement an “alter hook” in code

Most configuration has some sort of “alter” hook that allows it to be modified after it is loaded from the database.  For example, Views calls hook_views_default_views_alter(&$data) to allow you to change any part of a view, whether that view comes from the DB or is in code.  You can create a custom module that implements the desired alter hooks and override the data directly.

Pros Cons
  1. Base Feature will not be marked as “overridden”.
  2. Keeps the overrides nicely separate in their own modules that can be enabled/disabled/deployed.
  3. Only applies specific changes and allows future updates to the base Feature to be used.
  1. Not all configuration has the needed hooks.
  2. Each component has a different hook name and different data structure to modify.
Use Features Overrides module

Similar to the above “Implement alter hook” the Features Override module is designed to create the alter hook implementations for you and export those as new Features modules that you can enable, disable, deploy.

Pros Cons
  1. Base Feature will not be marked as “overridden”.
  2. Keeps the overrides nicely separate in their own modules.
  3. Only applies specific changes and allows future updates to the base Feature to be used.
  4. Features Overrides does the work of figuring out which alter hooks can be used and how to override the data.
  5. Provides a UI for inspecting overrides.
  6. Allows an entire component to be altered (e.g. entire view), or just a single change (e.g. just the title of a view)
  7. Works properly with Features. An Override is just another Feature module on the site.
  1. Not all configuration has the needed hooks.
  2. Can be tricky to “override an override”.
Typical Problems Feature is stuck at being “overridden”

The most common difficulty is a base Feature marked as “overridden” that does not go away when the feature is reverted.  ”Overridden” simply means that the value of the configuration stored in the DB is different from what is stored in the exported Feature code file.  Features literally re-generates the feature export internally from the DB and compares the code with what is stored on disk.  Doing a “drush fd featurename” simply shows the code diff between the code stored on disk (shown in red) with the code generated from the current database (shown in green).

To determine if a Feature is overridden, Features actually takes the generated code, sanitizes it, sorts it, executes it, and then does an md5 checksum on it.  If the two checksum values are different, the Feature is marked as “overridden”.  However, the “drush fd featurename” command shows the actual code difference regardless of if it’s marked as “overridden”.

This behavior means that “drush fd” might output code differences that actually don’t cause the feature to be overridden.  For example, if you change the order of dependencies in your module.info file and then run “drush fd” on the feature, you’ll see it display those changes, even though a “drush fl” won’t show the feature as overridden.

This makes it difficult sometimes to debug why a feature is overridden, since not all of the output of “drush fd” is relevant.  You need to look for actual value changes, rather than just re-ordering changes.

Adding a new module

Sometimes, just enabling a new contrib module will cause your Features (especially field features) to be “overridden”.  If the new module adds some new settings, formatters, widgets, etc then these settings will be active in the DB but not reflected in the code.  So the Feature will be shown overridden.  Reverting the feature won’t have any affect because there is no way to remove the new settings from the DB without uninstalling the new module.

These kinds of overrides are annoying, but not actually that important.  They don’t prevent the feature from being reverted when a new version of the base module is released.  They are not caused by any site-specific change that would be lost by a revert.  Typically it’s best to just document these cases and leave them as overridden.  Just be careful to not become complacent and make a site customization in the future to the same feature and then ignore that it’s overridden and lose your changes when you revert.  You should periodically do a “drush fd” on overridden features just to be sure what is shown is still just from the new module you installed.

A disabled module

Similar to the above, but the opposite case.  If you have disabled a module that was used when the original Feature was exported, then the code might have settings for that module that are no longer in your database.  Once again you won’t be able to remove this by reverting.  Again, you can just document these cases.  But make sure you really need to have the module disabled.  Having a module enabled that you are not using is not a big performance impact.  The time saved in long-term maintenance of the site it typically more important than worrying about an extra module.

A bad override

If you have used some of the not-recommended approaches for overriding a base Feature, such as writing directly to the DB, then you will end up with an overridden feature that cannot be reverted.  Or if the Feature is reverted, you might lose the change that was written to the DB and need to reapply it.  Even if the Feature is locked to prevent reverting, it will still be listed as overridden.

Another type of “bad override” is using the wrong kind of alter-hook to try to modify configuration.  If the alter hook is called in a way that makes it look like a DB change to Features, then Features is going to see a difference between the DB and code and mark it as overridden.

Overridden Views and Panels

Some modules, such as Views and Panels have their own “override” functionality.  These “pure” Features can exist purely in code with nothing in the DB.  When you make a UI change to a View, it gets copied from the code into the DB and your change is made to the DB.  The View is then marked as “overrides code” in the Views listing.  A View that came from code can be “reverted” within the Views UI.  This essentially just deletes the version of the view in the DB so that the code takes affect again.

Sometimes you can get a View stored in the DB that still matches the code.  For example, you change a View in the UI (causing it to be copied to the DB), then you edit the View and undo the change.  Now it matches the code again, but the view is still in the DB.  In this case, the View Feature will not be shown as “overridden”, but in the Views listing it will still say “overrides code”.

When changing a pure Feature like a View via code (like in an alter hook), your changes will take affect immediately, or possible after a cache clear.  No revert will be necessary because there is nothing in the DB to update.  However, in the above case where you have changed a view and then changed it back so it’s stored in the DB, changing the code will not affect the View until you revert the Feature to remove the DB copy of the old view.

In general, if you are having issues with Views, Panels, or other ctools-like pure Features, make sure they are not overridden in their respective UIs.  For example, click the Revert option for the View within the Views listing to ensure it’s actually using the View stored in code.

Wrong version of Features

If the code in the Feature was exported using a different version of Features than what is on your site, there might be changes that cause overrides.  Ensure your version of Features matches the version used to generate the export.  This usually only applies to major version numbers and is not normally a problem.  Normally updates to the Features module are made in backwards-compatible ways to prevent this.  But certainly be sure your version of Features on your site is not older than the version that generated the base code.  Always try the latest version of Features to see if it helps.

Nobody should be using the 1.x branch of Features anymore.  There is no reason for this.  All Drupal 7 sites should be on the 2.x branch.

Unsupported Component

As mentioned, not all configuration components support Features Override, or only support it partially.  For example, Panelizer works with Features, but doesn’t work well with Features Override because it still depends on the specific order of items in it’s config array and when the alter-hook generated by Features Override tries to change something, that array order might not be preserved.  Sometimes in this case you can create your own alter-hook implementation that overrides the code properly.

This might also be an opportunity to help improve Features Override or suggest patches to the module in charge of the configuration to better support Features Override.

Living with Overrides

What if you have tried all of this advice and your Feature is still marked as overridden?  And what if this override represents a specific site change that you need to maintain and ensure never gets reverted?  The solution to this is to “lock” your feature component.  Go to the Structure/Features page and select the Feature that is marked as overridden.  Click the small “lock” icon next to the overridden component in the right column.  The component will still be listed as “overridden” but when you revert your Features the locked component will be skipped, ensuring that your customization remains in place.

When locking your Features, try to only lock the specific component rather than locking the entire Feature.  The downside to locking a component is that any changes to that component from a new version of your distribution won’t take affect.  This is similar to the consequences of the “Update the Database directly” option listed above.  However, sometimes this is the only alternative.

Conclusion

Just keep in mind that both Features and Features Override are just implementing hooks (normal hooks for Features, alter-hooks for Features Override) that are exposed by Drupal or contrib module.  If those hooks don’t exist or don’t work properly there isn’t much Features or Features Override can do about it.  Drupal 7 doesn’t have any sort of configuration management in core, so every contrib module does it differently.  ctools-based modules have more of a standard framework, as does entity API.  Features itself tries to add code to handle core components such as Fields, Content Types, etc that don’t have the needed hooks.  But there is often a limit to how much Features can do and just patching stuff into the DB is not usually a good solution.

Don’t “hate” Features or Features Override.  Life was much worse without them.  They are the best solution to solving configuration management problems in Drupal 7.  They have been developed over years of experience.  Try to help improve them before trying to implement your own configuration or override architecture.

Drupal 8

Don’t count on Drupal 8 magically solving all of these issues.  The Configuration Management Initiative (CMI) within Drupal 8 was focused on handling site configuration, but not on “bundling functionality”.  It provides an API, storage mechanism, and framework for deploying configuration.  CMI helps a lot, but there are still issues around around component granularity and overriding configuration.  In Drupal 8, configuration is owned by the site rather than owned by a module.   This will make bundling functionality (ala Features original intent) more difficult.  We will be working on Features for D8 soon, but this is still mostly unknown territory.  For now, take a look at some existing modules such as config_packager and config_devel.

I’ve submitted a session to DrupalCon Los Angeles on Features in Drupal 8.  Add a comment and support!

Catégories: Elsewhere

Drupal core announcements: No Drupal 6 or Drupal 7 core release on Wednesday, March 4

lun, 02/03/2015 - 16:52

The monthly Drupal core bug fix/feature release window is scheduled for this Wednesday. Unfortunately, due to travel, work, and various other scheduling issues, I was not able to find the time to volunteer to get a Drupal 7 release together for this month. There are also a number of important Drupal 7 patches in development that could probably use another month before they are ready.

Since there hasn't been a bug fix/feature release of Drupal 7 since November, the hope is to get one out in the April release window instead.

Upcoming release windows include:

  • Wednesday, March 18 (security release window)
  • Wednesday, April 1 (bug fix/feature release window)

For more information on Drupal core release windows, see the documentation on release timing and security releases, and the discussion that led to this policy being implemented.

Catégories: Elsewhere

groups.drupal.org frontpage posts: Florida Drupalcamp 2015 Open for Registration!

lun, 02/03/2015 - 13:36

Florida DrupalCamp is now taking registrations and session submissions! Register at https://www.fldrupal.camp! The event will be taking place at the beautiful campus of Florida Technical College in Orlando, Florida on Saturday, Apr 11-12th.

Early-bird registration is only $25 and includes lunch and an awesome tshirt! Register today (before we raise the price on you)!

https://www.fldrupal.camp




Catégories: Elsewhere

Red Crackle: Using REST Export With Views In Drupal 8

lun, 02/03/2015 - 10:13
This article will take you through the steps required to use REST web services with Views in Drupal 8. You will have to install and enable two modules - RESTful Web Services and Serialization. Both these modules are part of a package known as Web Services. Follow the screenshots accompanying the article as we create a REST Export view, specify a REST Export path and enable json settings. You will have to install a REST client as well. In this example, we have installed Advanced REST client from the Google Chrome browser. As shown in the article, select GET in the REST client to send and receive a 200 status code.
Catégories: Elsewhere

Web Omelette: Dynamically sort complex data with PHP's sort functionality

lun, 02/03/2015 - 09:01

In a previous article I showed you how to use the usort() and uasort() PHP functions to sort some more complex data using a comparator callback function. How cool was that?

Although powerful, this technique is quite restricting though because all the logic for the sorting happens inside the comparator function. In other words, you cannot pass parameters to this callback except for the actual default values that are being compared. So what's the problem with this?

Say you have an array of objects that have a name property that can be retrieved by a getName() getter method. And let's say they also have an address property retrieved by getAddress(). And you have a listing of this data and you need to allow for sorting by any of these properties both ASC and DESC. And forget for one second about the possibility of ordering them as they come out of your data store.

Implementing this with just the default usort() function means you will need 4 different comparer functions (one for each combination of property and sort direction). And what if you want to add more columns to the listing? Oh no..

As you can imagine, the solution to this problem is having a dynamic sorting function (or method in a class) to which you can pass the items to be sorted, the property by which to sort and the direction of sort. And then not have to worry about creating all these ridiculous comparer functions. So how might this look like?

function sortByObjectProps(&$items, $method, $order) { if ( ! is_array($items)) { return false; } return usort($items, function($a, $b) use ($method, $order){ $cmp = strcmp($a->$method(), $b->$method()); return $order === 'asc' ? $cmp : -$cmp; }); }

So what happens here? First of all, $items is passed by reference so we don't need to return it. The return value will just be a boolean indicating the success or failure of the sort. Additionally, we pass the method name that retrieves the property value ($method) and the direction of the sort ($order).

Then we run usort() on the items but - and here is the kicker - with an anonymous function that can use the passed in method and order values. Then it's just a matter of comparing the return values of the getter methods and negate the integer if the order is DESC. Pretty cool no?

So now you can have as many columns as you need and get them sorted in both directions. And obviously even more complex stuff.

Hope this helps.

In Web Development var switchTo5x = true;stLight.options({"publisher":"dr-8de6c3c4-3462-9715-caaf-ce2c161a50c"});
Catégories: Elsewhere

Out & About On The Third Rock: Drupal Camp London 2015 – revisiting Empathy

lun, 02/03/2015 - 00:21
#DCLondon 2015 was nothing short of Epic, Drupal Camp London has in its own right become a mini-Con, with community members flying in from not only across Europe but the US, India, Australia and New Zealand it is hard to call it just a London camp! London is the centre of the multiverse! It was awesome […]
Catégories: Elsewhere

Gizra.com: Headless Drupal In Your Terminal

dim, 01/03/2015 - 23:00
Graphics in the Terminal, for you geeking pleasure

If you're excited about this, you are most likely a developer - so here's the code.

If this data looks familiar to you, it might be because it's the same data you see via Hedley's Angular client.

Continue reading…

Catégories: Elsewhere

DrupalOnWindows: Deploying Drupal Like a Pro

dim, 01/03/2015 - 07:00
Language English Introducing the Deploying Drupal Like a Pro Series

Building a Drupal site is difficult, developing a Drupal Based application is more difficult but correctly managing, deploying and keeping alive an application who's customer is paying you a 4, 5 or even 6 figure number per month is even more difficult. And if you want to do that one last thing in a cost effective way you must do it yourself.

More articles... Pages
Catégories: Elsewhere

Chen Hui Jing: Drupal 101: Basic site optimisations

dim, 01/03/2015 - 01:00

It has been statistically proven that nobody likes a slow website. We have all moved on from the days when you’d patiently wait for a page to load over that lovely dial-up modem. Nowadays, people want their pretty content, and they want it loaded instantaneously (or at most by 2 blinks).

One very basic concept I learnt about website performance is: minimise requests to your server. This makes perfect sense to me. Say I had a shopping list with 12 items. If I went to the general store and asked the shopkeeper for each item separately, he’d have to make 12 trips and most likely end up being very pissed at me. It’s much more efficient and faster to...

Catégories: Elsewhere

Code Drop: GovCMS: What Drupal developers can look forward to in 2015

sam, 28/02/2015 - 05:49

At Code Drop we are looking forward to leveraging all of the incredible effort which has gone into the govCMS ecosystem and all which as gone into making Drupal the choice for Government organisations. Developers who work with or are hoping to work with the platform have a lot of stuff to look forward to in 2015.

Planned Features

While govCMS is the name for the overarching project to bring Drupal into government using turnkey solutions, it is powered by the Drupal distribution aGov. Part of the recent work that has gone into the platform is a planned set of features for a new version of aGov (7.x-3.x). These planned features have been posted on Drupal.org and do represent a really positive evolution in the profile, a quick summary of which can be found below.

Catégories: Elsewhere

Drupal Association News: Drupal Association Board Meeting: 18 February, 2015

sam, 28/02/2015 - 01:17

February may be the shortest month of the year, but it's certainly been one of the busiest for the Drupal Association, so I apologize for taking more than a week to get this summary post up! What's been keeping us so busy? Our first ever DrupalCon in Latin America and the Drupal Association At-Large Board elections. Both of these events have been huge positive milestones for the Association, and have involved dozens of volunteers from around the globe. In the middle of all that, we managed to sneak in a board meeting on 18 February. If you missed it, you can listen to the recording, read the notes, and peruse the materials. Or feel free to skim this summary!

Operational Update
  • We have a big initiative internally at the Association to reevaluate the metrics we use to illustrate the success of our work. We are also looking at ways to better display these metrics so that you can see more context. So over the next few months, you'll see the metrics in the dashboared shift and change. Just a bit of a heads up, and let us know if you have any feedback along the way.
  • The February board packet covered our January metrics, and things look pretty good one month into the year. We are especially pleased that the Engineering team has been able to bring site performance to our goal levels. 
  • The Engineering Team also took several big steps towards key areas of the Drupal.org roadmap in January. Step 1 of the roadmap is better Account Creation and Login, and several key issues were closed out.
  • The DrupalCon Team and Engineering worked together to launch events.drupal.org in January as well. This shift means that Con sites are all on the same platform now. We no longer have to launch a site from scratch for each Con, which helps make Cons much easier to manage. Most importantly, we've been able to introduce key new features in reegistration for our community. Excited? Go ahead and register now! You can check out the new features yourself!
  • We are really lucky to work with the tireless Drupal 8 Branch Maintainers on the Drupal 8 Accelerate program. The program is picking up steam with a number of grants made and completed already. The next big grant will fund a Drupal CI (testbot) srpint in Portland at the end of March.
Content Strategy Update

Last year, the Content Working Group began a process of building a larger strategy for a reimagination of Drupal.org. Our first work was focused on User Research, and completed that work in the fall, publishing the developed personas. The next phase has focused on developing a content strategy. With over 1.2 MILLION pieces of content on Drupal.org, a strategy for dealing with that content is going to be pretty darn important. You can check out the presentation, as well as the post that's currently one of those pieces of content on Drupal.org.

Drupal.org Advertising Strategy

Finding new revenue streams is vitally important to the Association. For the entire history of the Drupal Association, DrupalCons have been the primary way we have funded other community work. We want to do more to serve our mission: uniting a global open source community to build and promote Drupal. If we're going to do that, we need new revenue streams. The bonus? If we can find new funding sources, it takes the pressure off of DrupalCons to perform financially, which means we can make choices for those events that might not fuel the financial bottom line, but make the events better for the community. 

So how are we doing it? New programs like Drupal Jobs have launched. We are also introducing advertising on Drupal.org and to Drupal.org visitors. We working to develop advertising products that are meaningful for advertisers (enough traffic, good clicks) and also deliver value to our community. We've drawn a few clear lines - we won't advertise on issue queues, for example, and will focus on users who are not logged into the site. We'll also be developing a variety of programs so that small shops can participate alongside bigger firms. 

For all the details, check out the presentation.

The End

Thanks so much for checking in on this board meeting and, as always, please let me know if you have any questions or thoughts.

Catégories: Elsewhere

Victor Kane: DrupalCon Latin America 2015 Bogotá will live on as one of the classics

ven, 27/02/2015 - 23:13

Grass roots enthusiasm, D8 teen spirit, much needed long absent leadership and community courage facing up to critical issues should overflow into DrupalCon Los Angeles in May

An incredible DrupalCon, DrupalCon Latin America, ended a couple weeks ago and I haven't seen any cool DrupalCon wrap-ups capable of really sharing with the rest of the Drupal community what an extremely well-organized and just plain special community experience it was. I am sure I'm not the only one who felt completely invigorated by it all. Let's take a look at why, and see how we can make it contagious.

Great Venue
Attendees from all over
Quality of presentations
Drupal 8 properly positioned
Now we know when to start switching to D8
Much Needed Drupal leadership
Huge participation in the Sprints and beyond

read more

Catégories: Elsewhere

X-Team: Install Drush 7 for Drupal 8 without throwing away Drush 6

ven, 27/02/2015 - 22:43

If you are playing around with Drupal 8, you may want to install version 7 of Drush on your computer. However, Drush 7 is currently only available as the master branch at github, and you may not like to throw out your existing Drush 6 in favor of the Drush development version, which is not...

The post Install Drush 7 for Drupal 8 without throwing away Drush 6 appeared first on X-Team.

Catégories: Elsewhere

Wuinfo: Design a Drupal Website with a Million Nodes in Mind

ven, 27/02/2015 - 22:10

Begin to design a Drupal website with a million nodes in mind. We build a Drupal website. It runs well at beginning. Until one day, the system has hundreds of thousands of node. We found the site became slow. We need wait many seconds before we can open a new page. Not only it is slow, but also sometimes we got errors like memory exhausted.

Most time the problem was existed at the beginning stage of a system. When designing a site, there are something we as a developer have to take care. We need bear in mind the site will grow and more and more nodes will come. Everytimes creating a function, we need to make sure the function will work fine when there are hundreds of thousands of nodes in the system. Otherwise, those functions may time out or finish all the memory by those ever increasing nodes in the system.

PHP have a maximum memory limit for each user. Sometimes it is 128 MB. Sometimes it is 256MB. The number is limited, and it is not infinite large for sure. There is no limit on how many nodes can exist on our website. As our system getting larger and larger with more nodes created, we will face the memory limitation sooner or later if we did not take it into consideration at the beginning.

Here is a quick sample. Drupal have a function node_load_multiple(). This function can load all nodes in the database to memory. Here are some codes from one of our contributed module.

foreach (node_load_multiple(FALSE) as $node) {
// Modify node objects to be consistent with Revisioning being
// uninstalled, before updating the {taxonomy_index} table accordingly.
unset($node->revision_moderation);
revisioning_update_taxonomy_index($node, FALSE);
}

This code is in an implementation of hook_uninstall. It will run into a problem if there are over 10,000 nodes in the system. As a result, we can not uninstall this module. Here is the error message:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 36 bytes) in ...

It used up all 256MB memory before it can load all the nodes. As the result, the module can never be uninstalled from the site.

It is an extreme case. As we troubleshooting an existing site, we may notice similar case here and there. I also notice that we can do something on the field_sql_storage module to make Drupal running faster and keep SQL database smaller.

Catégories: Elsewhere

Drupalize.Me: Podcast No. 58: Drupal Console

ven, 27/02/2015 - 15:05

This week on the podcast, Amber Matz chatted with Jesus Manuel Olivas about the Drupal Console project. What is Drupal Console? The Drupal Console is, at this time, a suite of tools that you run on a command line interface (CLI) to generate boilerplate code and interact with a Drupal 8 installation.

Catégories: Elsewhere

Lullabot: Drupal Console

ven, 27/02/2015 - 15:05

In this episode, Amber Matz talks with Jesus Manuel Olivas, one of the maintainers of the Drupal Console project. Drupal Console brings the Symfony Console component to Drupal 8 and provides code generation and module scaffolding commands as well as commands for interacting with a Drupal 8 installation. Extended notes and resources are on the Drupalize.Me blog.

Catégories: Elsewhere

Code Karate: Drupal 7 Range: Set two values for a CCK field

ven, 27/02/2015 - 14:04
Episode Number: 195

You ask and you shall receive. That is exactly what happened. Roman, the supporter of the Range Module, asked us to review his module. So that is what we did.

Tags: DrupalContent TypesFieldsCCKDrupal 7Drupal Planet
Catégories: Elsewhere

Deeson: Developing mobile apps with Drupal and DrupalGap

ven, 27/02/2015 - 13:22

One of the key benefits of using Drupal as a content management system (CMS) is the flexibility and agility it allows for your content.

I've had the experience of using DrupalGap to take this to the next level, applying the same level of ease to creating mobile apps. 

DrupalGap is an open source application development kit for Drupal websites.

Essentially, it allows developers to create mobile apps which communicate with their Drupal websites.

An intuitive and clean system, it's also perfectly geared up for use with headless Drupal

Agile and seamless

One of the advantages of using DrupalGap was the speed and ease with which I could use it to create a mobile app using web tech.

This can be an unseemly process using some of the other tools on the market.

It may seem obvious, but another key advantage was the fact that it talked seamlessly to the Drupal CMS.

This means that content could be reused in population of the mobile app.

It also makes it simpler for content administrators to update content in one place and have it displayed on the website and mobile app.

A smaller learning curve

Some technologies provide a great output at the expense of usability. But with DrupalGap I particularly like the way that 'views' can be used to display content. 

There's also a relatively easy learning curve if you're familiar with Drupal and JavaScript. You can simply jump right in and get creating. 

After using some CSS3 techniques and the GreenSock animation library I was able to create a smooth, native looking application quickly.

Product optimisations

As with any open source project, there are constant improvements and optimisations taking place.

For me, the frustrating part of DrupalGap is that it's tied to the jQuery Mobile library which doesn’t allow much room for customisation.

I found myself having to overwrite jQuery mobile classes to make the app look exactly how I wanted. This could be an area for change and improvement as the product evolves. 

So if you're already using Drupal and are thinking about a mobile app, then DrupalGap's well worth considering. My colleague Simon wrote a blog post recently about when an app is a good idea, so that's worth a look too if you're not sure if an app is the right tool for you or not.

I'll be writing an introductory guide to using DrupalGap in the near future, so stay tuned for that as well.

Catégories: Elsewhere

Pages