public function execute() { require_once $GLOBALS['rootpath'] . "okapi/locale/locales.php"; $required = Locales::get_required_locales(); $installed = Locales::get_installed_locales(); $missing = array(); foreach ($required as $locale) { if (!in_array($locale, $installed)) { $missing[] = $locale; } } if (count($missing) == 0) { return; } # okay! ob_start(); print "Hi!\n\n"; print "Your system is missing some locales required by OKAPI for proper\n"; print "internationalization support. OKAPI comes with support for different\n"; print "languages. This number (hopefully) will be growing.\n\n"; print "Please take a moment to install the following missing locales:\n\n"; $prefixes = array(); foreach ($missing as $locale) { print " - " . $locale . "\n"; $prefixes[substr($locale, 0, 2)] = true; } $prefixes = array_keys($prefixes); print "\n"; if (count($missing) == 1 && $missing[0] == 'POSIX') { # I don't remember how to install POSIX, probably everyone has it anyway. } else { print "On Debian, try the following:\n\n"; foreach ($prefixes as $lang) { if ($lang != 'PO') { # Two first letters cut from POSIX. print "sudo apt-get install language-pack-" . $lang . "-base\n"; } } print "sudo service apache2 restart\n"; print "\n"; } print "Thanks!\n\n"; print "-- \n"; print "OKAPI Team"; Okapi::mail_admins("Additional setup needed: Missing locales.", ob_get_clean()); }
/** Do 'get' on many keys at once. */ public static function get_many($keys) { $dict = array(); $rs = Db::query("\n select `key`, value\n from okapi_cache\n where\n `key` in ('" . implode("','", array_map('mysql_real_escape_string', $keys)) . "')\n and expires > now()\n "); while ($row = mysql_fetch_assoc($rs)) { try { $dict[$row['key']] = unserialize(gzinflate($row['value'])); } catch (ErrorException $e) { unset($dict[$row['key']]); Okapi::mail_admins("Debug: Unserialize error", "Could not unserialize key '" . $row['key'] . "' from Cache.\n" . "Probably something REALLY big was put there and data has been truncated.\n" . "Consider upgrading cache table to LONGBLOB.\n\n" . "Length of data, compressed: " . strlen($row['value'])); } } if (count($dict) < count($keys)) { foreach ($keys as $key) { if (!isset($dict[$key])) { $dict[$key] = null; } } } return $dict; }
private static function ver57() { ob_start(); print "Hi!\n\n"; print "OKAPI just added additional field (along with an index) 'okapi_syncbase'\n"; print "on your 'cache_logs' AND 'cache_logs_archived' tables. It is required by\n"; print "OKAPI's 'replicate' module to function properly.\n\n"; self::print_common_db_alteration_info(); print "-- \n"; print "OKAPI Team"; Okapi::mail_admins("Database modification notice: caches.okapi_syncbase", ob_get_clean()); }