redmine

Fixed error 502

  1 +<?php
  2 +
  3 +$filename = '/opt/tmp/stfcardid2login.json';
  4 +$s = stat($filename);
  5 +
  6 +if ($s === FALSE || (@$s[9]+3600*24) < time()) {
  7 + $apiKey = trim(file_get_contents('/etc/apikey-voip'));
  8 + $subscribers = json_decode(file_get_contents('http://new.voip.mephi.ru/subscribers.json?limit=65535&renderFilter=subscribers&apiKey='.urlencode($apiKey)), 1)['subscribers'];
  9 + foreach ($subscribers as &$subscriber) {
  10 + if (empty($subscriber['Login']['String']))
  11 + continue;
  12 +
  13 + foreach ($subscriber['Appointments'] as &$_a)
  14 + $stfcardid2login[$_a['StfCardId']] = $subscriber['Login']['String'];
  15 + }
  16 +
  17 + if (count($stfcardid2login) > 1000) {
  18 + file_put_contents($filename, json_encode($stfcardid2login));
  19 + }
  20 +}
  21 +
  22 +?>
  1 +#!/bin/bash
  2 +
  3 +cd /var/www/ut.mephi.ru/ut-tex/genpdf
  4 +
  5 +php ./cron.php &
@@ -92,23 +92,9 @@ function stfcardid2login($stfcardid) { @@ -92,23 +92,9 @@ function stfcardid2login($stfcardid) {
92 static $stfcardid2login = array(); 92 static $stfcardid2login = array();
93 93
94 $filename = '/opt/tmp/stfcardid2login.json'; 94 $filename = '/opt/tmp/stfcardid2login.json';
95 -  
96 $s = stat($filename); 95 $s = stat($filename);
97 -  
98 if ($s === FALSE || (@$s[9]+3600*24) < time()) { 96 if ($s === FALSE || (@$s[9]+3600*24) < time()) {
99 - $apiKey = trim(file_get_contents('/etc/apikey-voip')); 97 + system("bash /var/www/ut.mephi.ru/ut-tex/genpdf/cron.sh");
100 - $subscribers = json_decode(file_get_contents('http://new.voip.mephi.ru/subscribers.json?limit=65535&renderFilter=subscribers&apiKey='.urlencode($apiKey)), 1)['subscribers'];  
101 - foreach ($subscribers as &$subscriber) {  
102 - if (empty($subscriber['Login']['String']))  
103 - continue;  
104 -  
105 - foreach ($subscriber['Appointments'] as &$_a)  
106 - $stfcardid2login[$_a['StfCardId']] = $subscriber['Login']['String'];  
107 - }  
108 -  
109 - if (count($stfcardid2login) > 1000) {  
110 - file_put_contents($filename, json_encode($stfcardid2login));  
111 - }  
112 } 98 }
113 99
114 if (empty($stfcardid2login)) { 100 if (empty($stfcardid2login)) {