com web/doc: revcheck: files module made more clear: build-ops-sample.php include/init.inc.php include/lib_general.inc.php includ e/lib_proj_lang.inc.php include/lib_revcheck.inc .php www/revcheck.php

[email protected]
Newsgroups php.doc.web
Message-ID <[email protected]>
Commit:    2c5357cd4900872365d077dfac69ab97b883d485
Author:    Sobak <[email protected]>         Tue, 25 Mar 2014 16:26:25 +0100
Parents:   1abf3f06b26309b74b988f65c15c76ae9f6e57e4
Branches:  master

Link:       http://git.php.net/?p=web/doc.git;a=commitdiff;h=2c5357cd4900872365d077dfac69ab97b883d485

Log:
revcheck: files module made more clear

Changed paths:
  M  build-ops-sample.php
  M  include/init.inc.php
  M  include/lib_general.inc.php
  M  include/lib_proj_lang.inc.php
  M  include/lib_revcheck.inc.php
  M  www/revcheck.php
diff_2c5357cd4900872365d077dfac69ab97b883d485.txt (text/plain, 10.1 KB)
diff --git a/build-ops-sample.php b/build-ops-sample.php
index f1ec7ac..d125a92 100644
--- a/build-ops-sample.php
+++ b/build-ops-sample.php
@@ -2,5 +2,4 @@
 // Please read REDAME.md in the same directory to get more info about filling in this file
 
 define('SVN_DIR',     '@SVNDIR@');
-define('DOC_DIR',     '@DOCDIR@'); // ?
 define('SQLITE_DIR',  '@SQLITEDIR@');
\ No newline at end of file
diff --git a/include/init.inc.php b/include/init.inc.php
index 7da6ca5..03169e7 100644
--- a/include/init.inc.php
+++ b/include/init.inc.php
@@ -29,36 +29,5 @@ define('CACHE_BUGS_COUNT', 300); // 300 = 5mins
 // project & language config
 require_once('lib_proj_lang.inc.php');
 
-// get defaults
-list($defaultProject)    = array_keys($PROJECTS);
-list($defaultLanguage)   = array_keys($LANGUAGES);
-$defaultFallbackProject  = 'www';
-$defaultFallbackLanguage = 'en';
-
-// Only allow $_SERVER under apache to make cli scripts work
-if (!isset($inCli) OR $inCli != true) {
-    $inCli = false;
-
-    // set up constants (use defaults if necessary)
-    define('SITE',  isset($project)  ? $project  : $defaultProject);
-    define('LANGC', isset($language) ? $language : $defaultLanguage);
-    define('URI',   isset($uri)      ? preg_replace('@^[/\.]+@', '/' ,$uri) : htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES));
-    define('LANGD', $LANGUAGES[LANGC]);
-
-    if (isset($project)) {
-        $baseURL[] = $project;
-    }
-
-    if (isset($language) && $language != 'all' && $language != 'en') {
-        $baseURL[] = $language;
-    }
-
-    $baseURL = isset($baseURL) ? '/' . implode('/', $baseURL) : '';
-
-    // actually define the constant
-    define('BASE_URL', $baseURL);
-
-}
-
 // general support library
 require_once('lib_general.inc.php');
\ No newline at end of file
diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php
index a942d72..b5f9313 100644
--- a/include/lib_general.inc.php
+++ b/include/lib_general.inc.php
@@ -78,7 +78,7 @@ function nav_tools($lang)
 	$out .= '<ul>';
 	$out .= '<li><a href="revcheck.php?p=translators&amp;lang='.$lang.'">Translators</a></li>';
 	$out .= '<li><a href="revcheck.php?p=filesummary&amp;lang='.$lang.'">File summary</a></li>';
-	$out .= '<li><a href="revcheck.php?p=files&amp;lang='.$lang.'">Files</a></li>';
+	$out .= '<li><a href="revcheck.php?p=files&amp;lang='.$lang.'">Outdated files</a></li>';
 	$out .= '<li><a href="revcheck.php?p=misstags&amp;lang='.$lang.'">Missing revision numbers</a></li>';
 	$out .= '<li><a href="revcheck.php?p=missfiles&amp;lang='.$lang.'">Untranslated files</a></li>';
 	$out .= '<li><a href="revcheck.php?p=oldfiles&amp;lang='.$lang.'">Not in EN tree</a></li>';
diff --git a/include/lib_proj_lang.inc.php b/include/lib_proj_lang.inc.php
index d9c6f77..e080dde 100644
--- a/include/lib_proj_lang.inc.php
+++ b/include/lib_proj_lang.inc.php
@@ -24,14 +24,6 @@ $Id$
 
 // split from lib_general.inc.php
 
-// Map of supported documentation types to CVS module names
-$PROJECTS = array(
-// project => (Name, local folder, cvs module)
-    'www'      => array('Documentation',         '',        ''),
-    'php'      => array('PHP Documentation',     DOC_DIR,  'phpdoc/en'),
-    'phd'      => array('phd',                   '',        ''),
-);
-
 // Supported languages
 $LANGUAGES = array(
     'en'    => 'English',
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 59f0c4a..cbc094d 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -78,11 +78,7 @@ function get_outdated_files($idx, $lang, $dir)
         a.name as file, 
         a.maintainer as maintainer, 
         c.revision as en_rev, 
-        c.size as en_size, 
-        a.size as trans_size,
         a.revision as trans_rev,
-        a.mdate as trans_date,
-        c.mdate as en_date,
         b.name AS name, 
         a.dir as dir 
     FROM 
@@ -103,17 +99,13 @@ function get_outdated_files($idx, $lang, $dir)
     AND
         a.dir = "' . (int)$dir . '"
     AND
-        a.revision != c.revision order by b.name';
+        a.revision != c.revision ORDER BY b.name';
     $result = sqlite_query($idx, $sql);
     $tmp = array();
     while ($r = sqlite_fetch_array($result, SQLITE_ASSOC)) {
         $tmp[] = array(
         'name' => $r['name'],
-        'en_date' => $r['en_date'],
-        'trans_date' => $r['trans_date'],
         'en_rev' => $r['en_rev'],
-        'en_size' => $r['en_size'],
-        'trans_size' => $r['trans_size'],
         'trans_rev' => $r['trans_rev'],
         'status' => $r['status'],
         'maintainer' => $r['maintainer'],
@@ -132,11 +124,7 @@ function get_outdated_translator_files($idx, $lang, $user)
         a.name as file,
         a.maintainer as maintainer,
         c.revision as en_rev,
-        c.size as en_size,
-        a.size as trans_size,
         a.revision as trans_rev,
-        a.mdate as trans_date,
-        c.mdate as en_date,
         b.name AS name,
         a.dir as dir
     FROM
@@ -157,17 +145,13 @@ function get_outdated_translator_files($idx, $lang, $user)
     AND
         a.maintainer = \'' . sqlite_escape_string($user) . '\'
     AND
-        a.revision != c.revision order by b.name';
+        a.revision != c.revision ORDER BY b.name';
     $result = sqlite_query($idx, $sql);
     $tmp = array();
     while ($r = sqlite_fetch_array($result, SQLITE_ASSOC)) {
         $tmp[] = array(
         'name' => $r['name'],
-        'en_date' => $r['en_date'],
-        'trans_date' => $r['trans_date'],
         'en_rev' => $r['en_rev'],
-        'en_size' => $r['en_size'],
-        'trans_size' => $r['trans_size'],
         'trans_rev' => $r['trans_rev'],
         'status' => $r['status'],
         'maintainer' => $r['maintainer'],
diff --git a/www/revcheck.php b/www/revcheck.php
index 5b8bf2e..d8855ba 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -247,6 +247,12 @@ TRANSLATORS_HEAD;
 			echo '<p>No files</p>';
 		}
 		else {
+			echo '<p>This tool allows you to check which files in your translation need update. To show the list ';
+			echo 'choose a directory (it doesn\'t works recursively) or translator.</p>';
+			echo '<p>When you click on the filename you will see plaintext diff showing changes between revisions so ';
+			echo 'you will know what has changed in English version and what informations you need to update.<br>';
+			echo 'You can also click on [diff] to show colored diff. If filename is not a link it means that revision ';
+			echo 'number in your translation is unavailable for this file (and you should fix it).</p>';
 			echo '<p>Choose a directory:</p>';
 			echo '<form method="get" action="revcheck.php"><p><select name="dir">';
 			foreach ($dirs as $id => $name) {
@@ -296,68 +302,38 @@ TRANSLATORS_HEAD;
 	<tr>
 	<th rowspan="2">Translated file</th>
 	<th colspan="2">Revision</th>
-	<th colspan="3">Size in kB</th>
-	<th colspan="3">Age in days</th>
 	<th rowspan="2">Maintainer</th>
 	<th rowspan="2">Status</th>
 	</tr>
 	<tr>
 	<th>en</th>
 	<th>$lang</th>
-	<th>en</th>
-	<th>$lan</th>
-	<th>diff</th>
-	<th>en</th>
-	<th>$lang</th>
-	<th>diff</th>
 	</tr>
-	<tr><th colspan="12">{$outdated[0]['name']}</th></tr>
+	<tr><th colspan="5">{$outdated[0]['name']}</th></tr>
 END_OF_MULTILINE;
 				$last_dir = false;
 				$prev_name = $outdated[0]['name'];
 
 				foreach ($outdated as $r) {
 					if ($r['name'] != $prev_name) {
-					   echo '<tr><th colspan="12">'.$r['name'].'</th></tr>';
+					   echo '<tr><th colspan="5">'.$r['name'].'</th></tr>';
 					   $prev_name = $r['name'];
 					}
-					$r['en_date'] = intval((time() - $r['en_date']) / 86400);
-					$r['trans_date'] = intval((time() - $r['trans_date']) / 86400);
-					// Make decision on file category by revision, date and size
-					$rev_diff  = intval($r['en_rev']) - intval($r['trans_rev']);
-					$size_diff = intval($r['en_size']) - intval($r['trans_size']);
-					$date_diff = $r['en_date'] - $r['trans_date'];
-					if ($r['trans_rev'] === 'n/a') {
-						$status_mark = REV_NOREV;
-					}
-					elseif ($rev_diff > 0 || $size_diff >= ALERT_SIZE || $date_diff <= ALERT_DATE) {
-						$status_mark = REV_CRITICAL;
-					}
-					else {
-						// We need a value here for the CSS, default to 'old'
-						$status_mark = REV_OLD;
-					}
 
 					// Make the maintainer a link, if we have that maintainer in the list
 					if ($r['maintainer'] && $r["maintainer"] != 'nobody') {
-						$r["maintainer"] = '<a href="?p=translators#maint-' . $r['maintainer'] . '">' . $r["maintainer"] . '</a>';
+						$r["maintainer"] = '<a href="?p=translators&amp;lang=' . $lang . '">' . $r["maintainer"] . '</a>';
 					}
 
 					// If we have a 'numeric' revision diff and it is not zero,
 					// make a link to the SVN repository's diff script
 					if ($r['trans_rev'] !== 'n/a') {
-						$r['short_name'] = '<a href="http://svn.php.net/viewvc/' .
-						$PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
-						"?r1=" . $r["trans_rev"] .
-						"&amp;r2=" . $r["en_rev"] .
-						'&amp;view=patch">' . $r['file'] . '</a>';
-
-						// Add a [NoWS] link
-						$r['short_name'] .= ' <a href="http://svn.php.net/viewvc/' .
-						$PROJECTS[$project][2] . '/trunk/' . $r['name'] . '/' . $r['file'] .
-						'?r1=' . $r['trans_rev'] .
-						'&amp;r2=' . $r['en_rev'] .
-						'">[NoWS]</a>';
+						$r['short_name'] = '<a href="http://svn.php.net/viewvc/phpdoc/en/trunk' . $r['name'] . '/' . $r['file'] .
+						'?r1=' . $r['trans_rev'] . '&amp;r2=' . $r['en_rev'] . '&amp;view=patch">' . $r['file'] . '</a>';
+
+						// Add a [diff] link
+						$r['short_name'] .= ' <a href="http://svn.php.net/viewvc/phpdoc/en/trunk' . $r['name'] . '/' . $r['file'] .
+						'?r1=' . $r['trans_rev'] . '&amp;r2=' . $r['en_rev'] . '">[diff]</a>';
 					}
 					else {
 						$r['short_name'] = $r['file'];
@@ -368,15 +344,8 @@ END_OF_MULTILINE;
 					"<td>{$r['short_name']}</td>".
 					"<td>{$r['en_rev']}</td>" .
 					"<td>{$r['trans_rev']}</td>" .
-					"<td> {$r['en_size']}</td>" .
-					"<td> {$r['trans_size']}</td>" .
-					"<td align=\"right\"><strong>" . $size_diff . "</strong></td>" .
-					"<td> {$r['en_date']}</td>" .
-					"<td> {$r['trans_date']}</td>" .
-					"<td align=\"right\"><strong>" . $date_diff . "</strong></td>" .
 					"<td> {$r['maintainer']}</td>" .
 					"<td> {$r['status']}</td></tr>\n";
-
 				}
 				echo '</table>';
 			}
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.