# uname -a

Switch

lundi 10 novembre 2014

Drupal 7 : change page title on node form

Every rule has its exceptions, setting drupal_set_title directly on form_alter doesn’t work for node form title. To customize pages like “Add node”, or “Edit node” :

  • Make a module

  • Add a function to implement hook_form_alter

  • Add a form afterbuild in your hook_form_alter implementation: $form['#after_build'][] = '_my_callback_form_set_title'

  • In '_my_callback_form_set_title', use drupal_set_title to change the form title: drupal_set_title(...)

  • Update system table to have the weight of your module greater than Node module (on a default install, core modules are weighted 0, so set your module weight to 1).

  • Rebuild registry, clear caches.

mercredi 30 avril 2014

Après mise à jour Ubuntu 12.04 vers 14.04 Steam retélécharge les jeux

Une petite note, traduction du billet précédent en anglais, à propos de la migration que j’ai effectué il y a quelques jours.

J’ai mis à jour Ubuntu 12.04 vers Ubuntu 14.04. Quand j’ai réinstallé Steam, ce dernier m’a demandé de réinstaller mes jeux.

Une vérification avec la commande df -h m’a montré que les 50Gio de jeux que j’avais téléchargé étaient toujours présents sur le disque. Comment lui faire retrouver les jeux que j’avais déjà, sans avoir à les re-télécharger ?

Steam, dans sa version précédente, stockait les jeux dans le dossier .local/share/Steam/SteamApps/, à présent c’est dans le dossier ~/.steam/SteamApps/

Il suffit de les déplacer !

mv -i ~/.local/share/Steam/SteamApps/* ~/.steam/SteamApps/

Redémarrez ensuite Steam, et c’est tout !

Steam update from Ubuntu 12.04 to Ubuntu 14.04 asks me to redownload my games !

I ran into an unexpected problem after upgrading my Ubuntu 12.04 to Ubuntu 14.04. The update took me 2 hours, everything was working fine, so I decided to reinstall Steam.

I installed Steam from the partners repository, Steam updates itself, asks me for password and then runs. But… Where are my games ? They are in the list but when I try to start it, Steam asks me to download the game. I don’t want to re-download 50Gio of data from Steam servers in order to reinstall my games.

A check with the command df -h shows me that the data is still on my hard drive, Steam has not deleted my data, it just looks at the wrong place.

Indeed, Steam previously stored games in .local/share/Steam/SteamApps/, but now it stores it in ~/.steam/SteamApps/

Just move it !

mv -i ~/.local/share/Steam/SteamApps/* ~/.steam/SteamApps/

Restart Steam. Enjoy.

samedi 8 février 2014

Conflict between broken Apache packages makes FCGI angry (mod_fcgid: can't lock process table)

Here is is a quick note on the fix I made today for a messed up Apache server.

The environment

Apache2 + Debian + mod_suexec + mod_fcgi

The problem

The server was down only for PHP-running websites. It triggered a connexion reset when trying to run PHP scripts. Static content and reverse proxies were working correctly, as if nothing was happening.

In the server logs, the following error was present :

mod_fcgid: can't lock process table

The suexec log was showing no anomaly.

The server wasn’t gracefully stopping anymore, and I had to kill him with the -9 signal to stop it.

The cause

Searching around the web was giving me very few clues on the problem. I couldn’t find why the CGI subprocess was broken, it is spawned by Apache and so it should not be missing permissions (there is no CGI daemon listening in Apache setup, contrary to Nginx)

What causes the Apache subprocesses to get spawned ? Either the Apache mpm-workers, or mpm-prefork, or mpm-event or mpm-itk. I knew I was using workers, but a glance in APT installed packages showed me broken packages on workers and ITK. Wait… ITK ?

Actually, I run Puppet, and Puppet was configured to keep Apache ot its latest version from repositories. With the release of a newer version of Apache, it had updated the apache2 package … and installed apache2-mpm-itk while apache2-mpm-workers was still present !

The result was a conflict while trying to spawn CGI processes, and a crash of the subprocess.

The fix

Doing a remove apache2-mpm-itk, and force-reinstall apache2-mpm-workers did the job.

lundi 3 février 2014

GetSimple: URL index/something returns 404

Problem

While using GetSimple with FancyURLs (Apache Rewrite), every menu item nested under the home page returned a 404.

The (rewritted) URL of the home page is /index

The sub-pages URLs are rendered as index/something, and triggered a 404 error.

Solution

Disable MultiViews.

MultiViews is an Apache mechanism for automatically switching wich document is sent to the user, based on the Accept header. Because the front controller is named index.php, MultiViews was trying to reach index.php/something instead of (as specified in RewriteRules) index.php?id=index/something.

How to do it

Open the GetSimple .htaccess file, and locate :

Options -Indexes

Change to :

Options -Indexes -MultiViews

See also

- page 7 de 12 -