[TASK] Add section for translated pages to lowlevel statistics page 29/55229/3
authorAnja <aleichsenring@ab-softlab.de>
Fri, 29 Dec 2017 08:44:59 +0000 (09:44 +0100)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Tue, 2 Jan 2018 21:51:24 +0000 (22:51 +0100)
Since table pages holds both default language and translated records,
the statistics don't add up anymore.
By introducing a dedicated value count for translated pages, the
sums are equal with the page tree again.

Resolves: #83444
Releases: master
Change-Id: Ice6edde88a15e9590a86ced78565b180d2546ab7
Reviewed-on: https://review.typo3.org/55229
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php
typo3/sysext/lowlevel/Classes/Controller/DatabaseIntegrityController.php
typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf

index 1dfdd08..ba5fed6 100644 (file)
@@ -53,6 +53,11 @@ class DatabaseIntegrityCheck
      */
     public $page_idArray = [];
 
+    /**
+     * @var array Will hold id/rec pairs from genTree() that are not default language
+     */
+    protected $page_translatedPageIDArray = [];
+
     /**
      * @var array
      */
@@ -92,6 +97,14 @@ class DatabaseIntegrityCheck
      */
     public $lostPagesList = '';
 
+    /**
+     * @return array
+     */
+    public function getPageTranslatedPageIDArray(): array
+    {
+        return $this->page_translatedPageIDArray;
+    }
+
     /**
      * Generates a list of Page-uid's that corresponds to the tables in the tree.
      * This list should ideally include all records in the pages-table.
@@ -107,7 +120,7 @@ class DatabaseIntegrityCheck
         if (!$this->genTree_includeDeleted) {
             $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
         }
-        $queryBuilder->select('uid', 'title', 'doktype', 'deleted', 'hidden')
+        $queryBuilder->select('uid', 'title', 'doktype', 'deleted', 'hidden', 'sys_language_uid')
             ->from('pages')
             ->orderBy('sorting');
         if ($versions) {
@@ -126,7 +139,11 @@ class DatabaseIntegrityCheck
         while ($row = $result->fetch()) {
             $newID = $row['uid'];
             // Register various data for this item:
-            $this->page_idArray[$newID] = $row;
+            if ($row['sys_language_uid'] === 0) {
+                $this->page_idArray[$newID] = $row;
+            } else {
+                $this->page_translatedPageIDArray[$newID] = $row;
+            }
             $this->recStats['all_valid']['pages'][$newID] = $newID;
             if ($row['deleted']) {
                 $this->recStats['deleted']['pages'][$newID] = $newID;
index 5cc9650..8cc6b9e 100644 (file)
@@ -378,6 +378,10 @@ class DatabaseIntegrityController
                 'icon' => $this->iconFactory->getIconForRecord('pages', [], Icon::SIZE_SMALL)->render(),
                 'count' => count($admin->page_idArray)
             ],
+            'translated_pages' => [
+                'icon' => $this->iconFactory->getIconForRecord('pages', [], Icon::SIZE_SMALL)->render(),
+                'count' => count($admin->getPageTranslatedPageIDArray()),
+            ],
             'hidden_pages' => [
                 'icon' => $this->iconFactory->getIconForRecord('pages', ['hidden' => 1], Icon::SIZE_SMALL)->render(),
                 'count' => $admin->recStats['hidden']
index 59178aa..ebfa1a7 100644 (file)
                                <source>Pages</source>
                        </trans-unit>
                        <trans-unit id="total_pages">
-                               <source>Total number of pages</source>
+                               <source>Total number of default language pages</source>
+                       </trans-unit>
+                       <trans-unit id="translated_pages">
+                               <source>Total number of translated pages</source>
                        </trans-unit>
                        <trans-unit id="deleted_pages">
                                <source>Marked-deleted pages</source>