File Mode Isssues when Moving Git Repositories From Mac to Windows

Recently I had to copy an entire Git Repository from my MacBook to a Network Share that runs on Windows. Running git status on the new location notified me of file mode changes across all my files:

old mode 100644
new mode 100755

The solution for me was to change my repository's git configuration to filemode = false.

To do so you simply have to edit .git/config and change that line from true to false.

To prevent Git from tracking file modes in future projects you can set your global config using git config --global core.filemode false or, for more recent versions of Git, git config --add --global core.filemode false.

Tags: 

Fixing Undefined index: distribution_name in drupal_install_profile_distribution_name()

After my latest (minor) Drupal update I kept on getting the following error message on the modules page:

Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name() (Zeile 207 von/srv/www/vhosts/badeninfreiburg.de/httpdocs/includes/install.inc).

I've only been using the default installation profile and never changed anything regarding that. This issue might happen after running update.php.

There are many proposed solutions floating around, but the one that did the trick for me was really simple:

To minimize the number of new comments asking for it, here's a work-around for current Drupal 7 users: You need to enable the profile used to install Drupal by updating the system table. For example: UPDATE system SET status=1 WHERE name='standard'; will enable the Standard profile. If you don't know which profile was used, just use 'standard'.

Configure CKEditor to allow enterting empty tags

My previous post was about convincing CKEditor to not stripping class attributes from the markup. But the issues I had went beyond allowing class attributes.

I need the following markup to be rendered exactly as shown:

<p class="btn medium default"><a href="/node/9">Zur Kontaktseite <i class="icon-right-open-big"></i></a></p>

The (empty) <i> tag kept on being removed and it turned out to be more complicated than expected to change that behavior.

Here are the steps to allow empty <i> Tags in CKEditor (4.3.x) inside Drupal (7.x).

Allowing certain attributes on specific HTML elements in CKeditor within Drupal

Update

The CKEditor Drupal Module now has a dedicated configuration for ACF where you can put your Extra allowed content in a text area that is labeled as such!


CKEditor (version 4+) by default does a great job filtering unwanted markup, so it's highly recommended not to disable the Advanced Content Filter (AFC).

You could create your complete own set of rules to define which tags and attributes to allow in your markup using config.allowedContent, but that is ususally not what you'll need if you only want to add a little bit more freedom of tags or attributes you can use within CKEditor. That's where config.extraAllowedContent comes into play: it keeps your default Content Filtering rules and extends them with only the stuff you specify.

In my case I simply needed to allow three class names to be allowed on any <p> tag.

Make a Drupal Field available in the Page Template

Sometimes there's a need to render a Drupal field's value outside the scope of a node template. I used to achieve this with either Display Suite or CCK Blocks. As I'm about to change my workflow towards putting more theming stuff back to code (where it belongs) instead of clicking around slow and clumsy web interfaces I needed another solution.

1. Implement template_preprocess_page() in your theme's template.php

Of course you'll need to replace MYTHEME with the name of your theme, $stage_images with an arbitrary name of your choice and field_stage_images with the name of the field you want to render.

Customizing the Drupal Search Form to make use of Gumby's UI Kit

Yesterday I had a hard time modifying the output of the Search Form of Drupal 7. I needed to modify its HTML, adding wrappers, changing the input to a <button> tag, adding classes and additional markup to insert a font based icon into the button. I'm using the awesome Gumbyframework and took code from travisc's sandbox project, which itself seems to be heavily based on the Bootstrap theme for Drupal.

However, I like to start my themes from scratch with minimal overhead, so here's the stuff I extracted from above mentioned projects and changed a bit to make it work with my current setup (using Gumby 2.6.3).

Everything is inside the template.php of my theme (MYTHEME), so change that to your theme name.

This will change the search block form as well as the search form on the search page itself. If you only want it to affect one of those just change the implementation of hook_form_alter() accordingly.

Wie der 1&1 Support funktioniert

  1. Plötzliches Problem mit Website auf 1&1 Managed Server, nur noch die Startseite erreichbar (ohne jegliche Änderungen an CMS/Server/sonstwas)
  2. Ursache suchen, feststellen, dass die .htaccess Datei in einen Urzustand zurückgesetzt wird und somit sämtliche RewriteRules sowie sicherheitsrelevante Einstellungen einfach ins Nirwana geschickt wurden
  3. Eine gestern noch funktionierende .htaccess aus einem Backup einspielen, damit dann alles noch schlimmer machen, nichtmal die Startseite funktioniert
  4. Es verdichtet sich der Verdacht, dass PHP 5.3 einfach plötzlich nicht mehr angeboten wird, denn im Control Center lässt sich nur noch 5.4, 5.5 und dev auswählen.. und in der .htaccess, die fleißig automatisiert (?) überschrieben wird, steht steht der MimeType-Handler auf PHP 5.4 für die entsprechenden Dateiendungen
  5. Anruf beim Support. Man hat, nach Rücksprache mit der Technik (1), auch keine Ahnung, was das Problem ist. Eigentlich sieht alles gut aus. Es wird an die Technik (2) weitergegeben
Tags: 

SublimeText SFTP Plugin Key Bindings cheat sheet

As I keep going back to wbond's site to check the keyboard shortcuts for their SFTP Plugin for SublimeText (who the hell can remember ctrl+cmd+u+m?) I decided I need to print out an overview of this to have it sitting on my desk.

Here's my Google Doc, in case you also want to print out the shortcuts:

SublimeText SFTP Plugin Key Bindings on Google Drive

Tags: 

Faster Import of InnoDB Tables in MySQL

After waiting for more than an hour to import a MySQL dump of ~270 MB I started looking for the bottleneck. My database was mixed with InnoDB and MyISAM tables and it turned out the InnoDB tables took ages to import. I fixed it by wrapping my SQL statements for the InnoDB tables with the following statement:

SET autocommit=0;
# table definitions for the InnoDB table 
COMMIT;

If I understood it correctly this reduces the disk input massively. Don't forget the COMMIT statement at the end, as the MySQL reference says:

After disabling autocommit mode by setting the autocommit variable to zero, changes to transaction-safe tables (such as those for InnoDB, BDB, or NDBCLUSTER) are not made permanent immediately. You must use COMMIT to store your changes to disk or ROLLBACK to ignore the changes.

https://dev.mysql.com/doc/refman/5.0/en/commit.html

Tags: 

Pages