Project

General

Profile

Bug #38417 » chki18nuniq.php

The PHP script I used to check if an installation has duplicate records or not - Dennis Schubert, 2012-06-27 10:21

 
<?php

$_db = new mysqli("localhost", "", "", "");

$masterLangElements = $_db->query("SELECT uid FROM tt_content WHERE deleted=0 AND l18n_parent=0");
printf("number of master language elements: %d\n", $masterLangElements->num_rows);

while ($element = $masterLangElements->fetch_array()) {
$localizations = $_db->query(sprintf("SELECT sys_language_uid, uid, l18n_parent FROM tt_content WHERE deleted=0 AND l18n_parent=%d AND pid>0", $element['uid']));
$currentPage = array();
while ($localization = $localizations->fetch_array()) {
$currentPage[$localization["sys_language_uid"]][] = $localization;
}
foreach($currentPage as $language) {
if(count($language) > 1) {
printf("%d localizations for root element #%d, language #%d!\n", count($language), $language[0]['l18n_parent'], $language[0]['sys_language_uid']);
}
}
}

$_db->close();

?>
(2-2/2)