Nextcloud
Ici on liste les trucs et astuces pour Nextcloud
Vider la corbeille des dossiers de groupe
cd <data_nextcloud>
sudo -u www-data php occ groupfolders:trashbin:cleanu
Convertir une base Mysql en Postgres
Attention Il faut être au minimum en version 21.
- Supprimer la base Postgres existante si elle existe
sudo su postgres
psql
drop database MABASE;
- Re-créer la base avec le bon utilisateur
CREATE DATABASE MABASE OWNER MONUSER ENCODING 'UTF8';
GRANT CREATE ON SCHEMA public TO MONUSER;
- Lancer la conversion via l'outil de Nextcloud
occ
sudo -u www-data php7.4 occ db:convert-type --all-apps --password="MOTDEPASSEBASEPG" pgsql nc_USER_usr 127.0.0.1 nc_DATABASE_db
Mise à jour hors ansible.
- lancer la demande de mise à jour via l'interface.
- Appliquer la mise à jour.
- Terminer la mise à jour en ligne de commande avec
sudo -u www-data php occ upgrade
Troubleshooting
Les partages ont disparus
C'est vraissemblablement un problème de rescan des fichiers qui a créé des nouveaux identifiants et n'a pas mis à jour la table oc_share. On peut solutionner ce problème en mettant à jour la table avec la commande suivante :
update oc_share set item_source=t.fileid, file_source=t.fileid from (select distinct on (c.fileid) c.fileid as origin, d.path, d.fileid from oc_filecache as d right join (select a.path, a.fileid from oc_filecache as a right join oc_share as b on a.fileid=b.file_source) as c on c.path = d.path order by c.fileid,d.fileid desc) t where oc_share.file_source = t.origin;
D'autres commandes disponible :
update oc_share c set file_source=b.fileid, item_source=b.fileid from old_filecache as a left join oc_filecache as b on a.path=b.path where a.fileid=file_source;
# récupérer le chemin complet des fichier partagés
select a.path from oc_filecache as a right join oc_share as b on a.fileid=b.file_source;
# récupérer le dernier Id pour un path donné :
select fileid, path from oc_filecache where path = 'PATH' order by fileid desc;
# recupérer les ancien id par rapport aux nouveaux
select distinct on (c.fileid) c.fileid as origin, d.path, d.fileid from oc_filecache as d right join (select a.path, a.fileid from oc_filecache as a right join oc_share as b on a.fileid=b.file_source limit 10) as c on c.path = d.path order by c.fileid,d.fileid desc;