function load_datasets(array $array) { static $cache = []; echo "+ "; $_mem = memory_get_peak_usage(); $_time = microtime(true); foreach ($array as $ds) { echo "{$ds} "; $cache[$ds] = ryzom_extra_load_dataset(RYZOM_EXTRA_SHEETS_CACHE . '/' . $ds . '.serial'); } echo "\n"; printf("% 15s bytes\n", number_format(memory_get_peak_usage() - $_mem, 2, '.', ',')); }
/** * Return unformatted skilltree list * * @return unknown_type */ function ryzom_skilltree() { static $cache = array(); if (empty($cache)) { $file = sprintf('%s/data/skilltree.serial', RYZOM_EXTRA_PATH); $cache = ryzom_extra_load_dataset($file); } return $cache; }
/** * Load visual_slot.serial file * * @return array */ function ryzom_extra_load_vs() { static $cache = array(); if (empty($cache)) { $file = sprintf('%s/visual_slot.serial', RYZOM_EXTRA_SHEETS_CACHE); $cache = ryzom_extra_load_dataset($file); } return $cache; }
$title_room_other = "item in the bazaar room"; $title_room_material = "material"; $title_room_armory = "weapon"; $title_room_ampli = "magic amplifier"; $title_room_range = "range weapon"; $title_room_jewel = "jewel"; $title_room_dressing = "cloth"; $str_language_fr = "a French Label"; $str_language_en = "an English Label"; $str_language_de = "a German Label"; foreach ($all_lang as $lang) { // include translation file if needed if (!isset($cache[$_ext][$lang])) { // use serialize/unserialize saves lot of memory $file = sprintf('%s/data/words_%s_%s.serial', RYZOM_EXTRA_PATH, $lang, $_ext); $cache[$_ext][$lang] = ryzom_extra_load_dataset($file); } foreach ($all_room as $room) { $title_room = "title_room_" . $room; $str_language = "str_language_" . $lang; $file = FLUKER_LOCAL_PATH . $lang . ".code_" . $room . ".php"; if (!file_exists($file) || is_writable($file)) { $fp = fopen($file, "wb"); if (isset($fp)) { if (fwrite($fp, "<?php\n") === FALSE) { throw new Exception(__("Can not write in the file") . " " . $file . "."); } if (fwrite($fp, "/** \file\n") === FALSE) { throw new Exception(__("Can not write in the file") . " " . $file . "."); } if (fwrite($fp, " * \\brief Translate ryzom code of {${$title_room}} to {${$str_language}}.\n") === FALSE) {
<?php require_once __DIR__ . '/../ryzom_extra.php'; if (!isset($argv[1])) { echo "{$argv[0]} <dataset>\n"; exit; } $dataset = $argv[1]; if (substr($dataset, -7) !== '.serial') { $dataset .= '.serial'; } $file = RYZOM_EXTRA_SHEETS_CACHE . '/' . $dataset; $data = ryzom_extra_load_dataset($file); print_r($data);