This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To install PHP_CodeSniffer and to check drupal code type the following (composer is required system-wide): | |
First make sure you have the composer bin dir in your PATH. The default value is ~/.composer/vendor/bin/, but you can check the value that you need to use by running: | |
composer global config bin-dir --absolute | |
echo $PATH | |
PATH=$PATH:~/.composer/vendor/bin/ | |
echo $PATH | |
Add the following to the /home/<user>/.profile file: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We are going to use composer to create a codebase with the latest version of Drupal 8 or 7: | |
Drupal 8: | |
composer create-project drupal-composer/drupal-project:8.x-dev docker_drupal --stability dev --no-interaction | |
Drupal 7: | |
composer create-project drupal-composer/drupal-project:7.x-dev docker_drupal --no-interaction | |
Then we are going to clone the latest version of docker4drupal and remove the .git folder from it: | |
git clone [email protected]:wodby/docker4drupal.git docker_drupal_server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker events& | |
Then run your failing docker run ... command. Then you should see something like the following on screen: | |
2015-12-22T15:13:05.503402713+02:00 xxxxxxxacd8ca86df9eac5fd5466884c0b42a06293ccff0b5101b5987f5da07d: (from xxx/xxx:latest) die | |
Then you can get the startup hex id from previous message or the output of the run command. Then you can use it with the logs command: | |
docker logs <copy the instance id from docker events messages on screen> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect to the Postgres server: | |
psql postgres postgres | |
Create a database: | |
CREATE DATABASE drupal_legacy; | |
Connect to a database: | |
\c drupal_legacy | |
List all tables: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mime = \Drupal::service('file.mime_type.guesser')->guess($uri); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Delete all nodes. | |
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute()); | |
// Delete all files. | |
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute()); | |
// Delete all taxonomy terms. | |
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$header = array('uid','name','pass','mail','status','created','access','login','timezone','language','init','users_roles','prenom','patronyme','autre_prenoms','civilite','date_naissance','lieu_naissance','nouveau_email','nom_usage'); | |
$line = array('4509','[email protected]','$S$DUOohSWRaHv5IZOpqAQHfFiKFOVBbyo9yogtOIMicsI0jVv8TMR3','[email protected]','1','1479377985','1532625913','1532625913','Europe/Paris','fr','[email protected]','3','jérémy','lacroze','','mr','1991-03-01 00:00:00','enghien-les-bains','',''); | |
$file = fopen("modules/custom/migrate_opm/data/user/usrs.csv","w"); | |
fputcsv($file, $header); | |
for ($i = 2; $i <= 1500001; $i++) { | |
$line[0] = $i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\migrate_opm\Commands; | |
use Drush\Commands\DrushCommands; | |
use Symfony\Component\Console\Helper\ProgressBar; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
/** | |
* A Drush commandfile. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Execute PHPUnit tests in Symfony: | |
vendor/bin/phpunit -d memory_limit=-1 --group active | |
# Execute php code sniffer for Symfony: | |
phpcs --standard=Symfony --extensions=php --ignore=node_modules,bower_components,vendor DemandeController.php | |
phpcbf --standard=Symfony --extensions=php --ignore=node_modules,bower_components,vendor DemandeController.php | |
# Execute console commands from the host with docker-compose: | |
docker-compose exec php php bin/console doctrine:schema:update --force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drush locale-import file modules/custom/custom_opm/translations/custom_opm.fr.po |