[BUGFIX] Last edit is not computed correctly 59/41959/2
authorXavier Perseguers <xavier@typo3.org>
Sat, 25 Jul 2015 17:28:30 +0000 (19:28 +0200)
committerXavier Perseguers <xavier@typo3.org>
Sat, 25 Jul 2015 23:16:06 +0000 (01:16 +0200)
Change-Id: Id24d39c041b84e8f4d37d9a6ca7f6fcfb9c0d0f1
Reviewed-on: http://review.typo3.org/41959
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/files/scripts/etc/functions

index f13dbfb..de871c9 100644 (file)
@@ -157,28 +157,17 @@ function lastedit() {
        local PROJECT="$1"
        local LANGUAGE="$2"
 
-       # XP/19.06.2013: Using filesystem instead of database
-       #timestamp=$(mysqlpipe "SELECT p.id, p.code, l.code AS lang, u.mtime, UNIX_TIMESTAMP(u.mtime) AS tstamp
-       #       FROM pootle_app_project AS p
-       #       LEFT JOIN pootle_app_translationproject as tp ON p.id = tp.project_id
-       #       LEFT JOIN pootle_store_store AS s ON tp.id = s.translation_project_id
-       #       LEFT JOIN pootle_store_unit AS u ON s.id = u.store_id
-       #       INNER JOIN pootle_app_language l ON l.id = tp.language_id
-       #       WHERE ( u.state = 50 OR u.state = 200 )
-       #       AND p.code = '$PROJECT'
-       #       AND l.code = '$LANGUAGE'
-       #       GROUP BY p.id, l.code;" \
-       #| awk '{ print $6 }')
-
-       LANGUAGE_DIR=${POOTLE_PO}/${PROJECT}/${LANGUAGE}
-       if [ -d ${LANGUAGE_DIR} ]; then
-               timestamp=$(find ${LANGUAGE_DIR} -type f -printf '%T@ %p\n' \
-                       | grep -v "./.translation_index" \
-                       | sort -n \
-                       | tail -n 1 \
-                       | cut -f1 -d.
-               )
-       fi
+       timestamp=$(mysqlpipe "SELECT p.id, p.code, l.code AS lang, MAX(u.mtime), UNIX_TIMESTAMP(MAX(u.mtime)) AS tstamp
+               FROM pootle_app_project AS p
+               LEFT JOIN pootle_app_translationproject as tp ON p.id = tp.project_id
+               LEFT JOIN pootle_store_store AS s ON tp.id = s.translation_project_id
+               LEFT JOIN pootle_store_unit AS u ON s.id = u.store_id
+               INNER JOIN pootle_app_language l ON l.id = tp.language_id
+               WHERE ( u.state = 50 OR u.state = 200 )
+               AND p.code = '$PROJECT'
+               AND l.code = '$LANGUAGE'
+               GROUP BY p.id, l.code;" \
+       | awk '{ print $6 }')
 
        if [ -z "$timestamp" ]; then
                echo 0