You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.2 KiB

<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
include_spip('inc/cextras');
include_spip('base/galactic_contrib');
function galactic_contrib_upgrade($nom_meta_base_version,$version_cible) {
$maj = array();
$maj['1'] = array(array('spip_org_to_spip_net'));
cextras_api_upgrade(galactic_contrib_declarer_champs_extras(), $maj['2']);
cextras_api_upgrade(galactic_contrib_declarer_champs_extras(), $maj['3']);
include_spip('base/upgrade');
maj_plugin($nom_meta_base_version, $version_cible, $maj);
}
/**
* Parcours la table spip_document
* remplace les liens files.spip.org en files.spip.net
* et les http://files.spip.net en https://files.spip.net
**/
function spip_org_to_spip_net() {
include_spip('inc/sql');
$urls_problematiques = array(
'http://files.spip.net',
'https://files.spip.org',
'http://files.spip.org'
);
foreach ($urls_problematiques as $url) {
$res = sql_select('id_document, fichier', 'spip_documents', "fichier LIKE ". sql_quote("$url%"));
while ($raw = sql_fetch($res)) {
$fichier = str_replace($url, "https://files.spip.net", $raw['fichier']);
$id_document = $raw['id_document'];
sql_updateq('spip_documents', array('fichier'=>$fichier), "id_document=$id_document");
}
}
}