Blogs

Howto patch a Drupal module

Some contributtion to add to this Drupal module with which you have been working on?

Very easy, take note:

 

  1. Go to the folder of your module, previously cloned with git. For example, my contribution this morning: 
  2. git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/cpn.git
  3. cd cpn
  4. Create a new branch, for example: git branch 1912834-weight
  5. Change to this branch to make the changes: git checkout 1912834-weight
  6. Make your changes
  7. Add them with: git add your-file-modified
  8. Commit them, git commit -m "comment your changes as much as possible"
  9. Create your new patch: git diff 7.x-1.x > cpn-weightsettings-1912834.patch
  10. That's it :-)

 

More info:

 

 

error: unable to create temporary sha1 filename ./objects/17: Permission denied

I have had this issue recently, with a git branch which did not want to to react to push. That's what a was having:


$ git pushgit@domain.net's password Counting objects: 5, done.
Delta compression using up to 2 threads.
ng objects: 100% (3/3), done.
Writing objects: 100% (3/3), 303 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/17: Permission denied
fatal: failed to write object

error: unpack failed: unpacker exited with error code
git@domain.net:/var/www/git/domain
! [remote rejected] HEAD -> master (n/a (unpacker error))
error: failed to push some refs to 'git@server:/var/www/git/domain'

The problem is a permissions one... but it will not work if you try to update the permissions in the server folder. You have to update the permissions in the server, but in .git folder:

chown -R git:git .git/

In my case git was the user who should have the permissions to write.

Once changed, the push in your local environment should work.

categorias: 

Drupal maintenance tasks

 

How important is having a database optimized. Doing some "basic" optimizations like clearing the cache, runing the Drupal cron and a couple of things more, your database can change from having 4 GB to just around 200MB... incredible? Not at all, the importance of maintenance tasks :-)

Which tasks? Mainly:

 

  • Clean / truncate the sessions table. This table can grow up to several millions of registers. 
  • Carefull with the spammers. Your comment table can grow up to similar amounts if too many spammers take a look at you. If the problem is big, simply delete with phpmyadmin:
  • delete from comments where status = '1';  // unpublished comments
  • delete from comments where status = '0';  // all published comments

 

 

Related @links:

 

Drupal developer links of the week (01-02-2013)

Some interesting links that I have found this week.

Problems in which i've been involved this week:

git Mini Howto

All you need to know to start faster in Git:

  • sudo git add .
  • sudo git commit -m "function findFriends added"
  • git push -u origin master

That's it :-)

categorias: 

Drupal Sprint London January 2013

After a nice day knowing new people and mainly learning, this is my contribution to the community in this first Drupal Sprint in London:

Doesn't seems too much, mainly because i've learned more than what i've really being able to give.

Documentation and tools which I've found useful:

 

Others:

 

Howto contributing a module to Drupal

 

,

 

  1. Think in some interesting project, and build your module,
  2. If you didn't, create a Drupal user, and a new sandbox for your module(s). Follow this instructions and commit your first lines of code http://drupal.org/node/1068950
  3. Work in your project, and when you are happy to publish your first stable release, go to the next step.
  4. Help the community, doing some reviews of other modules (3 at least): http://drupal.org/project/issues/search/projectapplications?status[]=2&status[]=7 (more info here: http://drupal.org/node/1410826)
  5. Create a new project aplication: http://drupal.org/project/issues/projectapplications

 

 

 

 

some git commands

 

 

try.github.com

sudo git reset --hard origin/8.x

issue summary template: http://drupal.org/node/1155816

http://core.drupalofficehours.org/

http://drupal.org/project/dreditor  --> for chrome/firefox

 

Novice tags are good for starting to contribute.

 

Applying a patch in Drupal core:

1. Download the patch,

2. apply: git apply -v [patch]

 

 

categorias: 

Apache not sending changes in js and css (virtual box)

I am using a solution of vbox (virtual box) and shared folders in our windows work environment (yes, unfortunatelly, but the IT team is in his right to decide which machines we have to use).

Everytime the vbox start, it mounts "automagically" one of the shared folders in the linux host (centos and archlinux, one day I will explain why). So then, apache has all what he needs in /var/www/html/ (simply mounted with "mount /var/www/html") (see automatically mount directories in vbox).

So far, everything was working fine... until I started to make small changes in small files. Absolutely surprising because when I deleted the complete code in the css or js file, for example, and I updated the browser, the screen appeared white, so everything seemed ok. But not at all, dealing with small changes, like adding a line in your css simply add no effect, the change is here, but seems that Apache or the browser didn't like it, simply it was being ignored.

After a while struggling about the browsers cache and even restarting the virtual box I finally decided to dig into Google.

I found the problem in the frankooh blog and it seems that it is a vbox problem, exactly a vboxsf problem with Apache.

The solution is simple, go to you apache configuration (in centos /etc/http/conf/httpd.conf) and uncomment the line:

EnableSendfile Off

After restarting Apache all the changes were sended to the browser without problems, even the small ones.

PS: be carefull with case sensitive off != Off