use contao build in functions
Hey,
use the contao build-in functions.
Here are the functions for your own "dirty-non-prepared-statements-import-script":
PHP-Code:
/**
* Convert a UUID string to binary data
*
* @param string $uuid The UUID string
*
* @return string The binary data
*/
function uuidToBin($uuid)
{
return pack('H*', str_replace('-', '', $uuid));
}
/**
* Get a UUID string from binary data
*
* @param string $data The binary data
*
* @return string The UUID string
*/
function binToUuid($data)
{
return implode('-', unpack('H8time_low/H4time_mid/H4time_high/H4clock_seq/H12node', $data));
}
Liste der Anhänge anzeigen (Anzahl: 1)
yes, we can!
Zitat:
Zitat von
Paolob
Perfect, thanks for the tip.
Can I calculate the UUID of the file having the file path?
1. copy all your Files from Catalog/contao2 (tl_files/) to contao3 (files/)
2. in Contao3 Backend, run the Syncroutine (see attached picture)
Anhang 13735
3. use this dirty-function to retrive the uuid by catalog-path as parameter.
PHP-Code:
/**
* return the uuid by given catalog-filepath
* usaeage: getBinUuidByPath('tl_files/john/doo/fooBar.png');
*/
function getBinUuidByPath($TLpath) {
$picQ = mysql_query("SELECT uuid FROM tl_files WHERE path = '".substr($TLpath,3)."'
AND extension != ''");
$result = mysql_fetch_array($picQ);
if(mysql_num_rows($picQ) == 1)
return $result['uuid'];
else
return false;
}