/** * Saves all uncached lang codes */ public function saveAllCache() { if (count($this->_changedTemplates)) { foreach ($this->_changedTemplates as $template => $lastValue) { $this->_saveCacheFor($template); } } $cnf = rad_lang::getCacheNotFound(); if (!empty($cnf)) { $cacheToSave = array(); foreach ($cnf as $code => $id) { foreach ($id as $idf) { if (!empty($idf) and isset($idf['template']) and !empty($idf['language']) and !empty($code)) { $cacheToSave[$idf['template']][$idf['language']][] = $code; } } } foreach ($cacheToSave as $template => $idc) { $filename = $this->_template2fn($template) . 'nf'; $idc = array($template => $idc); if (file_exists($filename)) { $ids = array_merge(array($template => (array) json_decode(file_get_contents($filename))), $idc); } $fh = fopen($filename, 'w+'); fwrite($fh, json_encode($idc) . "\r\n"); fclose($fh); } } }