Drupal

Common Drupal Procedures

Set Yer Var

 drupal=10

Update drupal

 sudo 
 cd /etc/drupal
 ./backup.sh
 (this will back up the Drupal code and the databases)

untar the release, stripping off the first path element:

 cd /etc/drupal/${drupal}
 tar vxf /tmp/drupal-7.72.tar.gz --strip 1

Now put the permissions back, below

Update Modules

Before you update the modules you have to change the whole sites/ and modules/ directories to www-data permission:

 cd /etc/drupal/${drupal}/
 chown -R www-data:www-data sites/ modules/ themes/

.. then run the module update code admin--> reports --> updates

Now, put the permissions back; fix the permissions so that drupal can write to files/* and install its own modules, but not to the rest.

 /bin/chown -R daniel:users /etc/drupal/${drupal}/
 /bin/chown -R www-data:www-data /etc/drupal/${drupal}/sites/*/files/ \
         /etc/drupal/${drupal}/sites/default/ \
         /etc/drupal/${drupal}/modules/

and finally, run update.php on all websites :-(

Create A New Site

 site=fruitcake.org
 drupal=9
 cd /etc/drupal/${drupal}/sites/
 mkdir $site
 cp default/default.settings.php ${site}/settings.php
 for i in files modules themes ; do mkdir ${site}/${i} ; done
 chown -R www-data:www-data ${site}

Now create the database for it:

 site_db=fruitcake10
 echo mysqladmin -uroot -p create $site_db
 mysql -uroot -p 
   echo grant all on $site_db.* to 'drupal'@'localhost' identified by '0EWri3j017cX';
   flush privileges;
   exit

You're done. Go to http://fruitcake.org/ and follow the setup wizard, giving it the database info.

Now enter theme selection and configuration hell - but that's your problem.

Create A New Sub Site

 Alias /fruitcake /usr/share/drupal7

Slide Shows / Sliders / Slideshows

Tutorial here: https://www.youtube.com/watch?v=ku_97a6Bgkg

You need to install this js stuff: https://www.drupal.org/docs/contributed-modules/views-slideshow/installation-requirements

Backups

Database backups are in /var/drupal/sites/SITENAME/files/private/backup_migrate/

Cool Features

User List Page

Recently changed pages report

Solar Nova Scotia

Social Media: Structure --> Blocks --> Custom Block Library --> Social Footer

2021-06 Install Drupal 9

 create /etc/apache2/sites-available/drupal9.conf
 a2ensite drupal9
 https://bonmot.ca/drupal9/core/install.php
 ... create the database

2023-02 Install Drupal 10

 cd /etc/apache2/sites-available/
 cp drupal9.conf drupal10.conf (and edit it)
 a2ensite drupal10
 https://bonmot.ca/drupal10/core/install.php
 ... create the database

drupal10 needs php8 at least - we have 8.2

So, need to have multiple versions of PHP running.

Test versions with https://bonmot.ca/~denny/old/old_www/b2/phpinfo.php

Follow directions here https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-debian-10

Needed to install this in most of the apache2 conf files:

    <FilesMatch \.php$>
      # For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
      SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>