Migration des wikis : Différence entre versions

De Wicri Base 1.28
imported>Jacques Ducloy
(Pour les images)
imported>Jacques Ducloy
(Les modèles)
Ligne 86 : Ligne 86 :
  
 
diff templateOld templateTarget | grep "<" | cut -b 2-
 
diff templateOld templateTarget | grep "<" | cut -b 2-
 +
</source>
 +
 +
===Pour comparer des listes===
 +
<source lang="sh">
 +
1  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Modèle:" | SxmlSelect -p "[[@1]]"
 +
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Modèle:" | SxmlSelect -p " [[@1]]"
 +
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Attribut:" | SxmlSelect -p " [[@1]]"
 +
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Catégorie:" | SxmlSelect -p " [[:@1]]"
 
</source>
 
</source>
  

Version du 23 juin 2017 à 18:03

Cette page est un recueil de notes pour la migration des wikis.

Variables shell

WIKI=http://ticri.univ-lorraine.fr/wicri-base.de
WIKI=http://ticri.univ-lorraine.fr/wicri.de
WIKI=http://ticri.univ-lorraine.fr/wicri-europa.de
WIKI=http://ticri.univ-lorraine.fr/wicri-base.pt
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/de

WIKI=http://ticri.univ-lorraine.fr/wicri-music.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Musique/en

WIKI=http://ticri.univ-lorraine.fr/wicri-meta.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Meta/en

WIKI=http://ticri.univ-lorraine.fr/wicri-saarland.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/Allemagne/Sarre/en

WIKI=http://ticri.univ-lorraine.fr/wicri-lor.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/France/Lorraine/en

WIKI=http://ticri.univ-lorraine.fr/wicri-france.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/France/en


WIKI=http://ticri.univ-lorraine.fr/wicri-gr.de
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/GrandeRegion/de

WIKI=http://ticri.univ-lorraine.fr/wicri-gr.en
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Europe/GrandeRegion/en

WIKI=http://ticri.univ-lorraine.fr/wicri-asie.fr
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Asie/fr

WIKI=http://ticri.univ-lorraine.fr/wicri-meta.fr
WIKI_TARGET=https://lorexplor.istex.fr/Wicri/Meta/fr

Vérifications

Pour obtenir la liste des espaces de nom.

curl "$WIKI/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml" | SxmlIndent
curl "$WIKI_TARGET/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml" | SxmlIndent

Pour obtenir la liste des pages de l'espace principal (en fait si elle dépasse 500)

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500" \
   2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1 | wc

Les modèles

Pour les wikis anglais

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > templateOld

curl "$WIKI_TARGET/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > templateTarget

diff templateOld templateTarget | grep "<"

Pour les wikis français

(
curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500&apfrom=L&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1 
) | sort -u > templateOld

(
curl "$WIKI_TARGET/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  

curl "$WIKI_TARGET/api.php?action=query&list=allpages&format=xml&aplimit=500&apfrom=L&apnamespace=10"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1 
) | sort -u > templateTarget

diff templateOld templateTarget | grep "<"

diff templateOld templateTarget | grep "<" | cut -b 2-

Pour comparer des listes

1  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Modèle:" | SxmlSelect -p "[[@1]]"
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Modèle:" | SxmlSelect -p " [[@1]]"
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Attribut:" | SxmlSelect -p " [[@1]]"
  diff modeleSemNew modeleSemOld | grep ">" | cut -b 3- | grep "Catégorie:" | SxmlSelect -p " [[:@1]]"

Les catégories

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=14"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > categoriesOld

curl "$WIKI_TARGET/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=14"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > categoriesTarget

diff categoriesOld categoriesTarget | grep "<"

diff categoriesOld categoriesTarget | grep "<" | cut -b 2-

Les attributs

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=102"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > attOld

curl "$WIKI_TARGET/api.php?action=query&list=allpages&format=xml&aplimit=500&apnamespace=102"  2>/dev/null  |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1  | sort -u > attTarget

diff attOld attTarget | grep "<"

diff attOld attTarget | grep "<" | cut -b 2-

Suite à améliorer

 

(
curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=1"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=2"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=3"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=4"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=5"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=8"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=9"  2>/dev/null  
) |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1


(
curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=11"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=12"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=13"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=15"  2>/dev/null
)    |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1


(

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=103"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=104"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=105"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=106"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=107"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=108"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=109"  2>/dev/null  

)    |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1

(

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=500"  2>/dev/null  

curl "$WIKI/api.php?action=query&list=allpages&format=xml&aplimit=100&apnamespace=501"  2>/dev/null  

) |SxmlSelect -s api/query/allpages/p/attribute::title -p @s1

Pour les images

 curl "http://ticri.univ-lorraine.fr/wicri.pool/api.php?action=query&list=allimages&ailimit=5&aifrom=COLLN&aiprop=url&format=xml" |SxmlIndent

curl "http://ticri.univ-lorraine.fr/wicri.pool/api.php?action=query&list=allimages&ailimit=50&aifrom=COLLN&aiprop=url&format=xml"  2>/dev/null  | SxmlSelect -s api/query/allimages/img/attribute::url -p @s1