Skip to content
Snippets Groups Projects
Commit bf102640 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #33472 : script to migrate domain thumbnails in no subdir mode

parent 8fba26a1
6 merge requests!1553Master,!1502Master,!1501Stable,!1312Master,!1299Master,!1296Hotline#33472 gros problemes d url suite url rewriting sur prod
- ticket #33472 : prise en charge de la non répétition du répertoire dans les urls de vignettes des domaines
\ No newline at end of file
<?php
if (!$argv[2]) {
echo 'Missing arguments : hostname basedir';
exit(1);
}
$hostname = $argv[1];
$basedir = $argv[2];
chdir($basedir);
require('console.php');
echo BASE_URL . "\n";
$loader = function() use($basedir) {
return Class_Catalogue::findAllBy(['where' => 'url_img like "%' . $basedir . '%"']);
};
$items = $loader();
echo count($items) . " domains to process found\n";
$occurences = 0;
foreach ($items as $item) {
echo $item->getId() . ' : ' . $item->getUrlImg() . " -> ";
$item
->setUrlImg(Class_CmsUrlTransformer::removeBaseDir($hostname, $basedir, $item->getUrlImg()))
->save();
echo $item->getUrlImg() . "\n";
$occurences++;
}
if ($items = $loader()) {
$ids = array_map(function($a) {return $a->getId();}, $items);
echo "check domains : " . implode(', ', $ids) . "\n";
}
echo $occurences . " occurence(s) replaced.\n";
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment