Top Poster
#1 ramon fincken 405
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 khadish 1
#8 moxxx 1
#9 nistelrock 1
#10 Justin-ServerPilot 1

The time now is Sat Nov 27, 2021 12:13 pm
Ramonfincken.com Forum Index
View unanswered posts
[solution] convert linux mdbox compressed to maildir directories and separate mail
Author ramon fincken :: Posted: Fri Aug 20, 2021 1:44 pm :: Category: Bash, perl, python and CLI linux


please note:
do this on a separate server! Then Imapsync the result once you are done.
Also note: not all doveadm version support this ->
Error: Couldn't load plugin /usr/lib/dovecot/doveadm/lib10_doveadm_zlib_plugin.so: Module is for different ABI version 2.1.1 (we have 2.3.ABIv15(2.3.15))


Code:
# Change the owner of the files in mdbox so doveadm has access.
chown -R mail /home/myDomain/imap/myDomain.nl/myUser/mdbox
# Convert mdbox to Maildir. Do this in a temporary folder and not straight into the existing Maildir of the user because this will result in a permission error.
doveadm -o first_valid_uid=1 -o namespace=inbox -o namespace/inbox/inbox=yes -o namespace/inbox/separator=. -o mail_location=mdbox:/home/myDomain/imap/myDomain.nl/myUser/mdbox backup -u mail maildir:/home/myDomain/imap/myDomain.nl/myUser/Maildir_test
# Now copy the converted Maildir into the existing Maildir of the user.
cp -rf /home/myDomain/imap/myDomain.nl/myUser/Maildir_test/. /home/myDomain/imap/myDomain.nl/myUser/Maildir
# Change the owner of the files in Maildir so the user has access.
chown -R myDomain:mail /home/myDomain/imap/myDomain.nl/myUser/Maildir


Source
https://forum.directadmin.com/threads/m...ion.63538/


Split colum item in multiple colums
Author ramon fincken :: Posted: Thu Mar 18, 2021 9:28 am :: Category: Mysql databases
Tagged: , , ,


Split column item in multiple columns, and fill with empty if field Quantity is less then the split



Split on ; character.
The coupons column is " coupon1;coupon2 " etc .. and it needs to be split for the export we need.


Code:
SELECT id, `Quantity`, `email`, coupons

,SUBSTRING_INDEX(coupons,';',1) 'coupon1'
,IF(Quantity>1, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',2),';',-1) , '')  'coupon2'
,IF(Quantity>2, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',3),';',-1) , '')  'coupon3'
,IF(Quantity>3, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',4),';',-1) , '')  'coupon4'
,IF(Quantity>4, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',5),';',-1) , '')  'coupon5'
,IF(Quantity>5, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',6),';',-1) , '')  'coupon6'
,IF(Quantity>6, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',7),';',-1) , '')  'coupon7'
,IF(Quantity>7, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',8),';',-1) , '')  'coupon8'
,IF(Quantity>8, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',9),';',-1) , '')  'coupon9'
,IF(Quantity>9, SUBSTRING_INDEX(SUBSTRING_INDEX(coupons,';',10),';',-1) , '')  'coupon10'

FROM `coupons`


wp-cli delete all with custom keep-me table
Author ramon fincken :: Posted: Mon Jan 18, 2021 7:06 pm :: Category: CMS-ses (Joomla, WordPress, etc..)
Tagged:


Code:
wp-cli post delete $(wp-cli db query --socket=/usr/local/mysql/data/mysql.sock --skip-column-names --batch "SELECT post_id FROM wp_postmeta WHERE post_id < 1010313 AND post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'attachment' AND ID NOT IN ( SELECT meta_value FROM wp_found ) ) AND meta_key = '_wp_attached_file' LIMIT 200") --force


you need a limit if you expect many thousands of IDS, this is due to a bash limit, not your WP site or the DB

use at your own risk, this is more complex than you might think!


[solution] Letsencrypt Please choose an account
Author ramon fincken :: Posted: Fri Jan 15, 2021 9:58 am :: Category: Bash, perl, python and CLI linux


Duplicates in your accounts, fix them by pointing to the newest account. MAKE SURE your know which account is the most new.

Code:
/etc/letsencrypt/accounts# find -type d
.
./acme-v01.api.letsencrypt.org
./acme-v01.api.letsencrypt.org/directory
./acme-v01.api.letsencrypt.org/directory/some-old-hash
./acme-v02.api.letsencrypt.org
./acme-v02.api.letsencrypt.org/directory
./acme-v02.api.letsencrypt.org/directory/the-new-hash

/etc/letsencrypt/accounts# rm -rf ./acme-v01.api.letsencrypt.org



Code:
cd /etc/letsencrypt/renewal
sed -i 's/some-old-hash/the-new-hash/g' *.conf


[WordPress] creating PHP patches for WordPress Make Core and setting it up
Author ramon fincken :: Posted: Fri Oct 30, 2020 8:40 am :: Category: CMS-ses (Joomla, WordPress, etc..)


Do you want to contribute your PHP skills to WordPress Core?


Use this manual to get started !


# For to make PHP patches Razz To make children happy
# https://make.wordpress.org/core/handboo...dards/php/

# Download
svn co https://develop.svn.wordpress.org/trunk wordpress_make
cd wordpress_make

# JS and CSS
npm install
npm run build
npm run dev

copy wp-config-sample.php to wp-config.php and edit accordingly (do not forget to create a new DB !)


# Install and do your coding


# PHP unit test
# https://make.wordpress.org/core/handboo...g/phpunit/

#WARNING: You might need to install an older version
sudo apt install phpunit
copy wp-tests-config-sample.php to wp-tests-config.php and edit accordingly (do not forget to create a *new* DB !)

phpunit
or



# Patch and submit to trac
# https://make.wordpress.org/core/handboo...g-a-patch/
svn diff filename.php > filename.diff


[fix] How to add the clock seconds to ubuntu 20.04
Author ramon fincken :: Posted: Tue Aug 04, 2020 6:27 am :: Category: Ubuntu


Code:
sudo apt install dconf-editor


Then open dconf GUI

Search for "seconds" or go to /org/gnome/desktop/interface/clock-show-seconds

Enable!





Related read: https://ubuntu-mate.community/t/20-04-m...l/21795/21


[solution] htaccess rewrite to parent folder
Author ramon fincken :: Posted: Fri Dec 13, 2019 12:23 pm :: Category: PHP coding


when some idiot decides to put a whole site in a (dated) subfolder like

www/2018/

and you want to migrate to another host and set things strait ( meaning www/ ) you will end up with A LOT OF 404 urls

You need to create a 2018 folder and put this in your htaccess to redirect 301 all requests to the parent root folder

Code:
RewriteRule ^(.*)$ https://www.fulldomain.ext/$1 [R=301,L]


[chrome] re-add (unhide) www in address bar
Author ramon fincken :: Posted: Thu Oct 31, 2019 1:34 pm :: Category: Ubuntu


visit
Code:
chrome://flags/#omnibox-ui-hide-steady-state-url-scheme-and-subdomains


set
Omnibox UI Hide Steady-State URL Trivial Subdomains

to Disabled and restart to see the www. again.


All times are GMT
Who is Online
Who is Online Our users have posted a total of 410 articles
We have 26 registered users
The newest registered user is MathewCow
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest   [ Administrator ]   [ Moderator ]
Most users ever online was 41 on Wed Sep 09, 2015 1:34 am
Registered Users: None
This data is based on users active over the past five minutes
Log in
Username:    Password:      Log me on automatically each visit    

New posts New posts    No new posts No new posts    Forum is locked Forum is locked
General forums
The world of freelance
Programming
Other projects
Poll
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads