- Export the live database into an
.sql
file - Move it into
./mysql-init
directory (alternatively import with phpMyAdmin athttp://localhost:8881/
) - Start docker containers
docker compose up
- Wait for
./wordpress
creation by docker - Copy
languages
,uploads
,plugins
(delete previous localplugins
folder to make sure it is replaced), from livewp-content
to./wordpress/wp-content
- Log in to phpMyAdmin (
http://localhost:8881
wordpress
/wordpress
) and fix site url in the database by running following SQL query in SQL tab.
UPDATE wp_options SET option_value = 'http://localhost:8880' WHERE option_name IN ('siteurl', 'home');
- Verify with
SELECT * FROM wp_options WHERE option_name = 'siteurl' OR option_name = 'home';
.- New url should be
http://localhost:8880
for both.
- New url should be
- Add site url to
wp-config.php
- After
define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
add rows: define('WP_HOME', 'http://localhost:8880'); define('WP_SITEURL', 'http://localhost:8880');
- Deactivate SSL enforcing plugin e.g.
really-simple-ssl
:- Log in to phpMyAdmin and edit table
options
and rowactive_plugins
. - Copy the original entry for
active_plugins
inwp_options
table to somewhere for backup. - Remove
i:16;s:47:"really-simple-ssl/rlrsssl-really-simple-ssl.php";
entry. - Decrease the first number after
a:
by 1. - Make sure to update other indices
i:<value>
, so that the positions are correct (or deactivate the plugin via phpAdmin or file system)
- Log in to phpMyAdmin and edit table
- Deactivate
wordfence/wordfence.php
similarly to previous step - Open http://localhost:8880/, http://localhost:8880/wp-admin/. To login, either:
- Use your production wordpress credentials.
- Move
tools/create-default-user.php
towordpress
folder, and visit http://localhost:8880/create-default-user.php. Sign in withadmin
-admin
- Consider disabling most plugins for performance reasons (Wordfence Security seems to impact performance heavily). If admin session expires and you are unable to log in, disable WPML Sticky Links via PHPMyAdmin, log in, and enable it again.
If you see an error with plugins like
Fatal error: Uncaught Error: Call to undefined function get_field() in /var/www/html/wp-content/themes/tuleva/lib/class-wp-bootstrap-navwalker.php:137 Stack trace: #0 /var/www/html/wp-includes/class-wp-walker.php(147): WP_Bootstrap_Navwalker->start_el('
Then step 7 was not done succesfully.
You need to activate necessary plugins again in http://localhost:8880/wp-admin/plugins.php
.
First initialize all plugins that can be initialized, then WPML
plugins, then all plugins except really-simple-ssl
.
Re-initialize the database by deleting the existing one before
docker-compose down
docker volume rm wordpress-theme_db_data
- Connect to VPN which routes your traffic or register your ip with the host
- Set up variables in
tools/sync_database.sh
andtools/sync_media.sh
, ask from team - Run scripts with
sh sync_media.sh
andsh sync_database.sh
- If needed add execution permission
chmod +x <file name>
- The script expects you to have an SSH connected in the agent. If you do not then edit the scripts by adding
-i <path to key>
to ssh use
- If needed add execution permission
- Monitor progress and wait for finish message
CI uses host ftp.tuleva.ee
since CloudFlare is configured to forward to the correct machine with that url.
Rsync uploads changed files using a key, which is configured in the host and CI.
Install wp cli:
brew install wp-cli
- Generate POT file after code changes affecting translations
./tools/i18n/generate-pot.sh
- Or
wp i18n make-pot src/wp-content/themes/tuleva src/wp-content/themes/tuleva/lang/tuleva.pot --ignore-domain
If the command fails with
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)
then run the following command instead:
php -d memory_limit=512M /opt/homebrew/bin/wp i18n make-pot src/wp-content/themes/tuleva src/wp-content/themes/tuleva/lang/tuleva.pot --ignore-domain
- Generate PO file and add Estonian translations
./tools/i18n/generate-po.sh
- Or
wp i18n update-po src/wp-content/themes/tuleva/lang/tuleva.pot src/wp-content/themes/tuleva/lang
- Generate MO file to reflect them in Wordpress
./tools/i18n/generate-mo.sh
wp i18n make-mo src/wp-content/themes/tuleva/lang
Alternatively, use POEdit for steps 2 and 3.
php tools/i18n/makepot.php wp-theme src/wp-content/themes/tuleva/ src/wp-content/themes/tuleva/lang/tuleva.pot
Start following npm script
cd src/wp-content/themes/tuleva; npm install; npm run watch:scss
And edit scss files to have them built into css.