From b7b8114182a7f36b0cee559676834fec63bfcf81 Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sat, 18 Aug 2012 18:20:17 +0000 Subject: improved and expanded symlink detection --- langs/report.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'langs') diff --git a/langs/report.php b/langs/report.php index d0924e389..ac90abd75 100644 --- a/langs/report.php +++ b/langs/report.php @@ -41,6 +41,7 @@ /** */ include 'lib.php'; + define('APP_ROOT', realpath(__DIR__ . '/..')); $enFiles = get_lang_references(); $otherLangs = get_other_langs(); @@ -68,16 +69,26 @@ $langF = str_replace('.en.lang', '.' . $l . '.lang', $f); $langF = $l . substr($langF, 2); + $link = str_replace(array('en/', '.en.lang', 'index'), '', $f); + $dest_l = sprintf('%s/%s/%s/%s', APP_ROOT, $l, $link, 'index.php'); + $dest_en = sprintf('%s/%s/%s/%s', APP_ROOT, 'en', $link, 'index.php'); + // if symlink e.g. does directly translated page exist? + if ((realpath($dest_l) == realpath($dest_en))) { + $page_not_linked = ''; + $old_page = ''; + } else { + $page_not_linked = sprintf('old page still exists!', $l, $link); + $old_page = sprintf('by recycling old page', $l, $link); + } if (file_exists($langF)) { $stats[$l]['files'] += 1; - $link = str_replace(array('en/', '.en.lang', 'index'), '', $f); if ($link == 'downloads/get') { $link = sprintf('view download OK page view non existing file page', $l, $link, $l, $link); } else { - $link = sprintf('view page', $l, $link); + $link = sprintf('view page%s', $l, $link, $page_not_linked); } $test = _lang_diff($f, $langF); @@ -128,17 +139,8 @@ $stats[$l]['files'] += 0; $stats[$l]['strings'] += 0; - $old_link = str_replace(array('en/', '.en.lang', 'index'), '', $f); - // if symlink e.g. does directly translated page exist? - if (is_link('./../' . $l . '/' . $old_link)) { - $old_link = ''; - } else { - $old_link = sprintf('by recycling old page', $l, $old_link); - } - - $cols .= sprintf('add translation%s', - $f, $l, $old_link + $f, $l, $old_page ); } } -- cgit v1.2.1