Daniel'strae

Is cuma cá mhinice a théann tú ar strae; is é is tábhachtaí gurb áil leat do bhealach a aimsiú arís.

SVN autoremove missing file

svn rm $( svn status [LOCAL_COPY_PATH] | sed -e '/^!/!d' -e 's/^!//' ) [LOCAL_COPY_PATH]

Posted June 6, 2011

Mysql 2 Postgresql Common Commands

mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;

mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

Moving (or hiding) elements from a node form page

Versione formattata decentemente: http://paste.ubuntu.com/511476/

 

/*
 * Implementation of hook_form_alter
 * */
function MYMODULE_form_alter(&$form, &$form_state, $form_id){
    switch($form_id){
        case 'MYFORMID':
            /*
             * Invoco la funzione che ingloba tutti i campi 'difficili' in un unico campo.
             * */
            $form['#after_build'] = array('_mymodule_form_options');
        break;
    }
}
 

Read the rest of this post »

Filed under  //   drupal   modules  

Change the module/theme priority

/**
 * Implementation of hook_theme_registry_alter().
 *
 * Make jQuery Update's page preprocess function run *after* everything else's,
 * so that a theme can't call drupal_get_js() and mess everything up.
 */
function jquery_update_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['page'])) {
    if (count($theme_registry['page']['preprocess functions']) > 0) {
      // If jquery_update's preprocess function is there already, remove it.
      if ($key = array_search('jquery_update_preprocess_page', $theme_registry['page']['preprocess functions'])) {
        unset($theme_registry['page']['preprocess functions'][$key]);
      }
    }
    // Now tack it on at the end so it runs after everything else.
    $theme_registry['page']['preprocess functions'][] = 'jquery_update_preprocess_page';
  }
}

Filed under  //   Drupal   modules   themes  

Configurazione Drupal 6 Multisite con Plesk

Prima configurazione

  • Creare il gruppo 'drupal' sul server:
    • 'groupadd drupal'
    • Aggiungere l'utente web(apache, plesk, www) al gruppo drupal:
      • 'vi /etc/group'
      • aggiungere il nome dell'utente www (nel caso di plesk, 'psaserv') alla riga del gruppo drupal: 'drupal:x:7777:psaserv'
  • Creare la cartella /var/www/vhosts/drupal
  • Scaricare l'utlima versione di drupal da drupal.org ed estrarla in /var/www/vhosts/drupal
    • Controllo: il file index.php di drupal deve essere in /var/www/vhosts/drupal/index.php
  • Entrare in /var/www/vhosts/drupal/sites
    • Creare le cartelle:
    • all
    • all/themes
    • all/modules
    • all/files
  • Entrare in /var/www/vhosts/drupal/sites/default
    • Creare le cartelle
    • themes
    • modules
    • files
  • Cambiare il gruppo della cartella /var/www/vhosts/drupal in drupal in modo ricorsivo:
    • 'cd /var/www/vhosts'
    • 'chgrp -R drupal drupal'

Read the rest of this post »

Filed under  //   config   drupal   how-to   multisite   tutorial  

Creare link simbolici di tutto il contenuto di una cartella in un altra

Notare che all'interno del comando sed gli slash (/) sono preceduti da un backslash (\).

ls /path/to/folder | sed 's/\(.*\)/ln -s \/path\/to\/folder\/& \/path\/to\/destination\/folder\/& /' | sh

  1. ls /path/to/folder lista tutti i file e cartelle
  2. 's/\(.*\)/ln -s \/path\/to\/folder\/& \/path\/to\/destination\/folder\/& /' esegue una regxp, in questo caso.. inutile
  3. sh esegue l'output del sed come fosse un comando

Filed under  //   config   linux   tips  

Creare "alias" di comando su linux (ubuntu)

Metodo 1: link simbolico dell'eseguibile alla cartella /usr/local/bin/:

ln -s /path/to/executable/file /usr/local/bin/name_of_the_new_command

Usare SEMPRE le path assolute, e bisogna avere i permessi sudo
Se il programma in questione è un unico file, si può anche copiare direttamente il file in /usr/local/bin
Per eliminare un alias così creato, rimuovere il link simbolico (o il file) da /usr/local/bin

Metodo 2: creare alias tramite comando alias:

Read the rest of this post »

Filed under  //   cli   config   linux   tips   ubuntu  

Modificare open_basedir su plesk

Per modificare l’open_basedir per un singolo dominio sul pannello Parallels Plesk dovete editare il file

vi /var/www/vhosts/nomedominio.ext/conf/vhost.conf  (se non esiste createlo)

e aggiungete al suo interno:

<Directory /var/www/vhosts/nomedominio.ext/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir “/var/www/vhosts/nomedominio.ext/httpdocs:/nuovo/path”
</Directory>

nel caso vogliate, invece, disabilitarlo:

<Directory /var/www/vhosts/nomedominio.ext/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir none
</Directory>

Una volta fatto questo dovete eseguire il seguente comando:

/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=nomedominio.ext

 Fonte: http://www.deec.it/2009/09/29/modificare-lopen_basedir-su-plesk-per-singolo-dominio/

Esempio pratico:

<Directory /var/www/vhosts/example.com/httpdocs>
    php_admin_flag engine on
    php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/var/www/vhosts/example.com/private:/tmp"
</Directory>

Questo aggiungerà la cartella /var/www/vhosts/example.com/private alla include directory del php per il dominio example.com 

Filed under  //   PHP   config   plesk  

Plesk is undrupal-friendly

I've successfully set up multi site on Plesk 7.1 like so...

- set up your vhost as normal in Plesk
- create a database & database user for the domain (still in plesk)
- run drupal database script & any module scripts

then,
- create a group called drupal (i.e. groupadd drupal)
- edit /etc/group and add apache (or whatever the www user is) to the drupal group
- create a drupal directory in the vhosts directory
- put drupal in the drupal directory :-)
- set the whole drupal directory tree to drupal group (chgrp -R drupal drupal/)

then in each site's vhost directory
- rename/remove httpdocs
- create a symlink to the drupal directory called httpdocs

and voila. If you wind up with permissions problems, make sure that the applicable read/write permissions are set for the group, and that the file/directory is set to the drupal group.

from: http://drupal.org/node/42661

Filed under  //   drupal   multisite   plesk  

Installazione Drupal Multisite con unica Codebase

    Installazione Drupal Multisite con unica Codebase

    1. ~: sudo apt-get install drupal6
            1. Configurare il database di drupal6 con dbconfig-common? [Si]
            2. Tipo di database da usare con drupal6: [mysql]
            3. Password per l'utente root del database: [mysql_root_passwd]
            4. Password per l'utente amministratore del database: [mysql_drupal_passwd]
            5. Conferma password: [mysql_drupal_passwd]
    #   Vengono così creati:
    #       1. Il database 'drupal6'
    #       2. l'utente database drupal6 'drupal6'
    #       3. La cartella /etc/drupal
    #       4. La cartella /etc/drupal/6/sites/default/ con relativi files di configurazione

    2. Creare la cartella /etc/drupal/6/sites/all
            # Tutti i moduli e temi "comuni" andranno inseriti qua dentro.

    3. Creazione del file 'drupal' in /etc/apache2/sites-avaiable/ con contenuto:

# Virtual hosting configuration for Drupal

    4. Creare link simbolico a quel file nella cartella /etc/apache2/sites-enabled/ :
            1. ~: cd /etc/apache2/sites-enabled
            2. ~: ln -s ../sites-available/drupal

    5. Riavviare apache2:
            1. ~: sudo /etc/init.d/apache2 reload
            2. ~: sudo /etc/init.d/apache2 restart

-------------------------------------------------------------------------------------------------------------

    #   Creo il sito $nome_sito
    1. ~: sudo dpkg-reconfigure drupal6
            1. Installare il database di drupal6? [SI]
            2. Tipo di database da usare con drupal6: [mysql]
            3. Metodo di connessione al database MySQL per drupal6: [unix-socket]
            4. Nome dell'utente amministratore del database: [mysql_root_user]
            5. Password per l'utente amministratore del database: [mysql_root_passwd]
            6. Utente  di drupal6: [site_db_user]
            7. Nome del database  per drupal6: [site_db_passwd]
    #   Vengono così creati:
    #       1. Database 'site_db_passwd'
    #       2. Utente per il database site_db_passwd: 'site_db_user'

    2. Aggiungo al file 'drupal' in /etc/apache2/sites-avaiable/ il contenuto:

#
# Virtual hosting configuration for site-host.etx
#
<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /usr/share/drupal6/
    ServerName site-host.ext
    #ServerAlias [if you want to support www.example.com and example.com]
    RewriteEngine On
    RewriteOptions inherit
</VirtualHost>

            2. Riavviare apache2:
                1. ~: sudo /etc/init.d/apache2 reload
                2. ~: sudo /etc/init.d/apache2 restart

    3. Configuro il sito:
            1. ~: cd /etc/drupal/6/sites/
            2. ~: sudo cp -a default site-host.ext
                1. IL NOME DELLA CARTELLA DEL SITO IN ./sites/ DEVE ESSERE IDENTICO ALL'HOST IN APACHE NEL FILE /etc/apache2/sites-enabled/drupal
            3. ~: vi site-host.ext/dbconfig.php
                # Modifico i dati della connessione al database; username, dbname, password.
                # Dovrebbero essere già corretti, è solo un controllo.

    4. Installo drupal sul nuovo Sito:
            1. http://site-host.ext/install.php

            ## FARE ATTENZIONE ALLA NOTIFICA RIGUARDO LE MODIFICHE AL FILE DI CONFIGURAZIONE, DEVE ESSERE:
                All necessary changes to ./sites/site-host.ext and ./sites/site-host.ext/settings.php
                have been made. They have been set to read-only for security.

            ## SE INVECE DI ./sites/site-host.ext C'E SCRITTO ./sites/default SI E' SBAGLIATO QUALCOSA
            ## IL NOME DELLA CARTELLA DEL SITO IN ./sites/ DEVE ESSERE IDENTICO ALL'HOST IN APACHE

            2. Procedere con l'installazione.
            3. Tutti i moduli/temi che saranno utilizzati SOLO da questo sito, vanno posizionati nella cartella /etc/drupal/6/sites/site-host.ext/

Filed under  //   drupal   multisite