I have a script that runs every time a particular page loads.
Basically, it does a search in the database and saves the values in a file:
$servicos = $db->prepare('SELECT id_servico, UNIX_TIMESTAMP(data) dia, user, cliente, situacao FROM servicos);
$servicos->execute(array());
$servicos_result = $servicos->fetchAll(PDO::FETCH_OBJ);
$out = array();
foreach($servicos_result as $row) {
$out[] = array(
'id' => $row->id_servico,
'user' => $row->loja,
'cliente' => $row->cliente,
'situacao' => $row->situacao,
'start' => $row->dia . '000',
'end' => $row->dia . '000'
);
}
$stringData = json_encode(array('success' => 1, 'result' => $out));
file_put_contents ( "events.json.php" , $stringData );
The problem is that it has taken some time for the file to be updated after some change in the database. That is: it is not updated the first time the page is recalled, but only after a few minutes and attempts.
The file is about 400kb.
Can this be a limitation of the server?