I'm working on the upgrade script. The one that moves the
2.3 HD into
2.4 original. As long as Piwigo doesn't perform any "copy" but only "move", the script runs pretty fast: 500ms for 10k HD photos.
To avoid any problem during upgrade, I will provide the operation
"remove pwg_high and thumbnail directories" in a separate plugin. This operation can be long, depending on the disk performances. I don't want to take the risk to fail an upgrade for a non blocking operation (keeping the "thumbnail" directories in "upload" is not a problem)
In addition to moving (overwritting) files, the script updates the images.width, images.height and images.filesize based on images.high_width, images.high_height and images.high_filesize (which are removed).
$upgrade_description = 'derivatives: new organization of "upload" and "galleries" directories';
$query = '
SELECT
id,
path,
tn_ext,
has_high,
high_filesize,
high_width,
high_height
FROM '.IMAGES_TABLE.'
;';
$result = pwg_query($query);
$starttime = get_moment();
$updates = array();
while ($row = pwg_db_fetch_assoc($result))
{
if ('true' == $row['has_high'])
{
$high_path = dirname($row['path']).'/pwg_high/'.basename($row['path']);
rename($high_path, $row['path']);
array_push(
$updates,
array(
'id' => $row['id'],
'width' => $row['high_width'],
'height' => $row['high_height'],
'filesize' => $row['high_filesize'],
)
);
}
}
$endtime = get_moment();
$elapsed = ($endtime - $starttime);
echo sprintf('%.3fs to move HD', $elapsed);
if (count($updates) > 0)
{
mass_updates(
IMAGES_TABLE,
array(
'primary' => array('id'),
'update' => array('width', 'height', 'filesize'),
),
$updates
);
}
Remaining operations are :
* removing columns images.high_width, images.high_height, images.high_filesize, images.tn_ext, images.has_high, user_infos.maxwidth, user_infos.maxheight
* converting 2.3 thumbnails/websize settings into 2.4 derivatives settings
* update upgrade task 113 to convert config params upload_form_hd* into original_resize*
* removing configuration parameters upload_form* (14 parameters)