aboutsummaryrefslogtreecommitdiffstats
path: root/langs/report_test.php
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2014-07-17 21:37:26 +0200
committerfilip <filip.komar@gmail.com>2014-07-17 21:37:26 +0200
commit640dfe1d371f52819e46b76b120d0f9914412131 (patch)
tree936a43ebe2259ce4d63ffe64c8a6e8eefb1b0846 /langs/report_test.php
parentc551633f1c29c15c56a3148fd8e4d8ce90d6bd23 (diff)
downloadwww-640dfe1d371f52819e46b76b120d0f9914412131.tar
www-640dfe1d371f52819e46b76b120d0f9914412131.tar.gz
www-640dfe1d371f52819e46b76b120d0f9914412131.tar.bz2
www-640dfe1d371f52819e46b76b120d0f9914412131.tar.xz
www-640dfe1d371f52819e46b76b120d0f9914412131.zip
added caching to improve report speed
Diffstat (limited to 'langs/report_test.php')
-rw-r--r--langs/report_test.php39
1 files changed, 8 insertions, 31 deletions
diff --git a/langs/report_test.php b/langs/report_test.php
index 952e86a37..85fed269f 100644
--- a/langs/report_test.php
+++ b/langs/report_test.php
@@ -78,14 +78,6 @@
$restore_resources = TRUE;
} else {
$enFiles = array_merge(array('../_nav/langs/en.pot'), get_lang_references('*.lang'), get_lang_references('*.pot')); // added navigation file
-/* START OF A WORKAROUND FOR TIMEOUTS */
- foreach($enFiles as $enFile) {
- if ($restore_languages || ($enFile != 'en/about/license.pot' && $enFile != '../_nav/langs/en.pot')) {
- $enFiles_tmp[] = $enFile;
- }
- }
- $enFiles = $enFiles_tmp;
-/* END OF A WORKAROUND FOR TIMEOUTS */
sort($enFiles);
}
$num_of_enFiles = count($enFiles);
@@ -196,8 +188,7 @@
if ($link == 'about/license') {
require_once('../en/about/license/license.php');
$times[] = time_debug('require_once ' . $l);
- $license_array = read_license_from_vcs($l);
- $license_numbers = array_pop($license_array);
+ $license_numbers = load_license_numbers($l, true);
$test['a'] += $license_numbers["all"]; // add aproximate number of untranslated sentences from license
$num_of_untranslated_strings += $license_numbers["untran"]; // add number of all license sentences
}
@@ -205,13 +196,6 @@
if ($nav) {
$mga = array();
- $local_f = @file_get_contents('../_nav/langs/' . $l . '.po');
- $times[] = time_debug('local_f ' . $l);
- $mognas_f = @file_get_contents('http://nav.mageia.org/langs/' . $l . '.po');
- $times[] = time_debug('mognas_f ' . $l);
- if ($local_f != $mognas_f) {
- $page_not_linked = 'difference in svn <a class="action partial" href="//svnweb.mageia.org/web/www/trunk/_nav/langs/">1</a> &amp; <a class="action partial" href="//svnweb.mageia.org/web/nav/langs/">2</a>';
- }
} else if ($link == 'downloads/get') {
$mga = array(
'A' => 'downloads/get/index.php?q=Mageia-2-dual-CD.iso&amp;d=1', // " style="display: block;
@@ -372,7 +356,6 @@
$thfiles = '<th>' . implode('</th><th>', $lang_line) . '</th>' . PHP_EOL;
if (!$restore_languages && !$restore_resources) {
- echo '<p>Note that <a href="?r=../_nav/langs/en.pot" title="navigation resource">navigation resource</a> and <a href="?r=en/about/license.pot" title="license resource">license resource</a> are currently not shown in this full report as they take a significant amount of time to process.</p>';
$count = '&nbsp;';
}
if ($restore_languages) {
@@ -414,7 +397,6 @@ $times[] = time_debug('end_time');
$sum = 0;
$read_license_from_vcs_ = array();
-$mognas_f_ = array();
$_diff_ = array();
foreach ($times as $time) {
if($time[1] >= 0.01) {
@@ -424,10 +406,6 @@ foreach ($times as $time) {
if ($pos !== false) {
$read_license_from_vcs_[] = array($time[0], $time[1]);
}
- $pos = strpos($time[0], 'mognas_f');
- if ($pos !== false) {
- $mognas_f_[] = array($time[0], $time[1]);
- }
$pos = strpos($time[0], '_diff');
if ($pos !== false) {
$_diff_[] = array($time[0], $time[1]);
@@ -447,11 +425,6 @@ foreach ($read_license_from_vcs_ as $part) {
}
$snails_time += $read_license_from_vcs_time_sum = array_sum($read_license_from_vcs_time);
-foreach ($mognas_f_ as $part) {
- $mognas_f_time[] = $part[1];
-}
-$snails_time += $mognas_f_time_sum = array_sum($mognas_f_time);
-
foreach ($_diff_ as $part) {
$_diff_time[] = $part[1];
}
@@ -466,8 +439,6 @@ echo '<pre>' . PHP_EOL;
echo '</br>' .'rlv: ';
print_r($read_license_from_vcs_time_sum) . '</br>' . PHP_EOL;
-echo '</br>' .'mog: ';
-print_r($mognas_f_time_sum) . '</br>' . PHP_EOL;
echo '</br>' .'dif: ';
print_r($_diff_time_sum) . '</br>' . PHP_EOL;
echo '</br>' .'Sst: ';
@@ -487,4 +458,10 @@ echo '</pre>' . PHP_EOL;
</div>
<script src="/_nav/js/source.js"></script>
</body>
-</html> \ No newline at end of file
+</html><?php
+
+// regenerating cache
+// TODO move it to the cron
+foreach ($otherLangs as $lang) {
+ load_license_numbers($lang);
+} \ No newline at end of file