svn: /web/doc-editor/trunk/php/ File.php RepositoryFetcher.php RepositoryManager.php TranslationStatistic.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sun, 14 Mar 2010 12:23:05 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=296180

Log:
Fix the way we compute statistic. Now, the summary is right

Changed paths:
    U   web/doc-editor/trunk/php/File.php
    U   web/doc-editor/trunk/php/RepositoryFetcher.php
    U   web/doc-editor/trunk/php/RepositoryManager.php
    U   web/doc-editor/trunk/php/TranslationStatistic.php
svn-diffs-296180.txt (text/x-diff, 11 KB)
Modified: web/doc-editor/trunk/php/File.php
===================================================================
--- web/doc-editor/trunk/php/File.php	2010-03-14 12:19:48 UTC (rev 296179)
+++ web/doc-editor/trunk/php/File.php	2010-03-14 12:23:05 UTC (rev 296180)
@@ -278,7 +278,7 @@
             'en-rev'     => 0,
             'maintainer' => 'NULL',
             'reviewed'   => 'NULL',
-            'status'     => 'NULL',
+            'status'     => '-',
             'xmlid'      => 'NULL',
             'content'    => $content
         );

Modified: web/doc-editor/trunk/php/RepositoryFetcher.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryFetcher.php	2010-03-14 12:19:48 UTC (rev 296179)
+++ web/doc-editor/trunk/php/RepositoryFetcher.php	2010-03-14 12:23:05 UTC (rev 296180)
@@ -69,14 +69,21 @@
      */
     public function getModifies()
     {
+        $am = AccountManager::getInstance();
+
         $s = sprintf(
-            'SELECT `id`, `lang`, `path`, `name`, `revision`,
-            `en_revision`, `maintainer`, `reviewed` FROM `pendingCommit` WHERE
-            `project` = "%s" AND
-            ( `lang`="%s" OR `lang`="en" ) ',
-            AccountManager::getInstance()->project,
-            AccountManager::getInstance()->vcsLang
+            'SELECT
+                `id`, `lang`, `path`, `name`, `revision`, `en_revision`, `maintainer`, `reviewed`
+             FROM
+                `pendingCommit`
+             WHERE
+                `project` = "%s" AND
+                ( `lang`="%s" OR `lang`="en" ) ',
+
+            $am->project,
+            $am->vcsLang
         );
+
         $r = DBConnection::getInstance()->query($s);

         $infos = array();
@@ -95,15 +102,23 @@
      */
     public function getModifiesById($id)
     {
+        $am = AccountManager::getInstance();
+
         $ids = is_array($id) ? implode($id, ',') : $id;

         $s = sprintf(
-            'SELECT * FROM `pendingCommit` WHERE
-            `project` = "%s" AND
-            (`lang`="%s" OR `lang`="en") AND `id` IN (%s)',
-            AccountManager::getInstance()->project,
-            AccountManager::getInstance()->vcsLang, $ids
+            'SELECT *
+             FROM
+                `pendingCommit`
+             WHERE
+                `project` = "%s" AND
+               (`lang`="%s" OR `lang`="en") AND `id` IN (%s)',
+
+            $am->project,
+            $am->vcsLang,
+            $ids
         );
+
         $r = DBConnection::getInstance()->query($s);

         $infos = array();
@@ -123,8 +138,17 @@
         $project = $ac->project;

         $s = sprintf(
-            'SELECT count(*) as total FROM `files` WHERE `project`="%s" AND `lang` = "%s" AND `revision` != `en_revision` AND `revision` != 0',
-            $project, $vcsLang
+            'SELECT
+                count(*) as total
+             FROM
+                `files`
+             WHERE
+                `project`   = "%s" AND
+                `lang`      = "%s"  AND
+                `revision` != `en_revision` AND
+                `status` is not null',
+            $project,
+            $vcsLang
         );
         $r = DBConnection::getInstance()->query($s);
         $a = $r->fetch_object();
@@ -149,8 +173,19 @@
         $m = $this->getModifies();

         $s = sprintf(
-            'SELECT * FROM `files` WHERE `project`="%s" AND `lang` = "%s" AND `revision` != `en_revision` AND `revision` != 0  %s',
-            $project, $vcsLang, $limit
+            'SELECT
+                *
+             FROM
+                `files`
+             WHERE
+                `project`="%s" AND
+                `lang` = "%s" AND
+                `revision` != `en_revision` AND
+                `status` is not NULL
+                %s',
+            $project,
+            $vcsLang,
+            $limit
         );
         $r = DBConnection::getInstance()->query($s);

@@ -211,8 +246,16 @@

         $m = $this->getModifies();
         $s = sprintf(
-            'SELECT count(*) as total FROM `files` WHERE `project`="%s" AND `lang` = "%s" AND reviewed != \'yes\'',
-            $project, $vcsLang
+            'SELECT
+                count(*) as total
+             FROM
+                `files`
+             WHERE
+                `project`="%s" AND
+                `lang` = "%s" AND
+                reviewed != \'yes\'',
+            $project,
+            $vcsLang
         );
         $r = DBConnection::getInstance()->query($s);
         $a = $r->fetch_object();
@@ -235,8 +278,21 @@

         $m = $this->getModifies();
         $s = sprintf(
-            'SELECT * FROM `files` WHERE `project`="%s" AND `lang` = "%s" AND reviewed != \'yes\' ORDER BY `path`, `name` %s',
-            $project, $vcsLang, $limit
+            'SELECT
+                *
+             FROM
+                `files`
+             WHERE
+                `project`="%s" AND
+                `lang` = "%s" AND
+                reviewed != \'yes\'
+             ORDER BY
+                `path`,
+                `name`
+                %s',
+            $project,
+            $vcsLang,
+            $limit
         );
         $r = DBConnection::getInstance()->query($s);

@@ -321,7 +377,20 @@
         $vcsLang = $ac->vcsLang;
         $project = $ac->project;

-        $s = sprintf('SELECT count(*) as total FROM `files` WHERE `project`="%s" AND `lang`="%s" AND `status` is NULL AND `revision` is NULL', $project, $vcsLang);
+        $s = sprintf('
+            SELECT
+                count(*) as total
+            FROM
+                `files`
+            WHERE
+                `project`="%s" AND
+                `lang`="%s" AND
+                `status` is NULL AND
+                `revision` is NULL',
+            $project,
+            $vcsLang
+        );
+
         $r = DBConnection::getInstance()->query($s);
         $a = $r->fetch_object();

@@ -342,7 +411,22 @@
         $limit = ( $ac->userConf->newFileNbDisplay ) ? 'LIMIT '.$ac->userConf->newFileNbDisplay : '';

         $m = $this->getModifies();
-        $s = sprintf('SELECT `id`, `path`, `name` FROM `files` WHERE `project`="%s" AND `lang`="%s" AND `status` is NULL AND `revision` is NULL %s', $project, $vcsLang, $limit);
+        $s = sprintf('
+            SELECT
+                `id`, `path`, `name`
+            FROM
+                `files`
+            WHERE
+                `project`="%s" AND
+                `lang`="%s" AND
+                `status` is NULL AND
+                `revision` is NULL
+                %s',
+            $project,
+            $vcsLang,
+            $limit
+        );
+
         $r = DBConnection::getInstance()->query($s);

         $node = array();

Modified: web/doc-editor/trunk/php/RepositoryManager.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryManager.php	2010-03-14 12:19:48 UTC (rev 296179)
+++ web/doc-editor/trunk/php/RepositoryManager.php	2010-03-14 12:23:05 UTC (rev 296180)
@@ -1090,8 +1090,9 @@
      */
     public function applyRevCheck($path = '/')
     {
-        $appConf = AccountManager::getInstance()->appConf;
-        $project = AccountManager::getInstance()->project;
+        $am      = AccountManager::getInstance();
+        $appConf = $am->appConf;
+        $project = $am->project;

         if ($dh = @opendir($appConf[$project]['vcs.path'].'en'.$path)) {

@@ -1126,7 +1127,7 @@
                 $tmp = explode('/', $f->path);

                 // Only for Php project
-                if( AccountManager::getInstance()->project == 'php' ) {
+                if( $am->project == 'php' ) {
                     $check_doc = new ToolsCheckDoc();
                     $ToolsCheckDocResult = $check_doc->checkDoc($infoEN['content'], $f->path);
                 } else {
@@ -1145,7 +1146,7 @@
                 $query = sprintf(
                     'INSERT INTO `files` (`project`, `lang`, `xmlid`, `path`, `name`, `revision`, `size`, `mdate`, `maintainer`, `status`, `check_oldstyle`,  `check_undoc`, `check_roleerror`, `check_badorder`, `check_noseealso`, `check_noreturnvalues`, `check_noparameters`, `check_noexamples`, `check_noerrors`)
                         VALUES ("%s", "%s", "%s", "%s", "%s", "%s", %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
-                    AccountManager::getInstance()->project,
+                    $am->project,
                     'en', $xmlid, $f->path, $f->name, $en_revision, $en_size, $en_date, 'NULL', 'NULL',
                     $ToolsCheckDocResult['check_oldstyle'],
                     $ToolsCheckDocResult['check_undoc'],
@@ -1191,7 +1192,7 @@
                         $query = sprintf(
                             'INSERT INTO `files` (`project`, `lang`, `xmlid`, `path`, `name`, `revision`, `en_revision`, `reviewed`, `size`, `size_diff`, `mdate`, `mdate_diff`, `maintainer`, `status`)
                                 VALUES ("%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", %s, %s, %s, %s, "%s", "%s")',
-                            AccountManager::getInstance()->project,
+                            $am->project,
                             $lang, $xmlid, $lang_file->path, $lang_file->name,
                             $revision, $en_revision, $reviewed,
                             $size, $size_diff, $date, $date_diff,
@@ -1211,10 +1212,13 @@
                         }
                     } else {
                         $query = sprintf(
-                            'INSERT INTO `files` (`project`, `lang`, `path`, `name`)
-                                VALUES ("%s", "%s", "%s", "%s")',
-                            AccountManager::getInstance()->project,
-                            $lang, $lang_file->path, $lang_file->name
+                            'INSERT INTO `files` (`project`, `lang`, `path`, `name`, `size`)
+                                VALUES ("%s", "%s", "%s", "%s", %s)',
+                            $am->project,
+                            $lang,
+                            $lang_file->path,
+                            $lang_file->name,
+                            $en_size
                         );
                         DBConnection::getInstance()->query($query);
                     }

Modified: web/doc-editor/trunk/php/TranslationStatistic.php
===================================================================
--- web/doc-editor/trunk/php/TranslationStatistic.php	2010-03-14 12:19:48 UTC (rev 296179)
+++ web/doc-editor/trunk/php/TranslationStatistic.php	2010-03-14 12:23:05 UTC (rev 296180)
@@ -130,7 +130,7 @@
                 `files`
             WHERE
                 ' . $where . '
-                (`en_revision` != `revision` AND `revision` != 0 )
+                `en_revision` != `revision`
             AND
                 `size` is not NULL
             AND
@@ -181,9 +181,8 @@
              WHERE
                  ' . $where . '
                  `revision` is NULL AND
-                 `size` is NULL AND
-                 `project` = \''.$project.'\' AND
-                 ( `status` != "NotInEN" OR `status` IS NULL )
+                 `status` is NULL AND
+                 `project` = \''.$project.'\'
        ';

        $r = DBConnection::getInstance()->query($s);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.