本文整理汇总了PHP中TranslateUtils::cacheFile方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils::cacheFile方法的具体用法?PHP TranslateUtils::cacheFile怎么用?PHP TranslateUtils::cacheFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslateUtils
的用法示例。
在下文中一共展示了TranslateUtils::cacheFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheFileName
/**
* Returns full path the the cache file.
* @return string
*/
protected function getCacheFileName()
{
return TranslateUtils::cacheFile("translate_groupcache-{$this->group->getId()}-{$this->code}.cdb");
}
示例2: store
protected function store(array $array)
{
$file = TranslateUtils::cacheFile($this->filename);
file_put_contents($file, serialize($array));
}
示例3: writeChanges
/**
* Writes change array as a serialized file into a known place.
* @param array $array Array of changes as returned by processGroup
* indexed by message group id.
* @todo does not belong to this class.
*/
public static function writeChanges($array)
{
// This method is almost identical with MessageIndex::store
/* This will overwrite the previous cache file if any. Once the cache
* file is processed with Special:ManageMessageGroups, it is
* renamed so that it wont be processed again. */
$file = TranslateUtils::cacheFile(SpecialManageGroups::CHANGEFILE);
$cache = CdbWriter::open($file);
$keys = array_keys($array);
$cache->set('#keys', serialize($keys));
foreach ($array as $key => $value) {
$value = serialize($value);
$cache->set($key, $value);
}
$cache->close();
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:22,代码来源:ExternalMessageSourceStateComparator.php
示例4: processSubmit
protected function processSubmit()
{
$req = $this->getRequest();
$out = $this->getOutput();
$jobs = array();
$jobs[] = MessageIndexRebuildJob::newJob();
$changefile = TranslateUtils::cacheFile(self::CHANGEFILE);
$reader = CdbReader::open($changefile);
$groups = unserialize($reader->get('#keys'));
$postponed = array();
foreach ($groups as $groupId) {
$group = MessageGroups::getGroup($groupId);
$changes = unserialize($reader->get($groupId));
foreach ($changes as $code => $subchanges) {
foreach ($subchanges as $type => $messages) {
foreach ($messages as $index => $params) {
$id = self::changeId($groupId, $code, $type, $params['key']);
if ($req->getVal($id) === null) {
// We probably hit the limit with number of post parameters.
$postponed[$groupId][$code][$type][$index] = $params;
continue;
}
if ($type === 'deletion' || $req->getCheck("i/{$id}")) {
continue;
}
$fuzzy = $req->getCheck("f/{$id}") ? 'fuzzy' : false;
$key = $params['key'];
$title = Title::makeTitleSafe($group->getNamespace(), "{$key}/{$code}");
$jobs[] = MessageUpdateJob::newJob($title, $params['content'], $fuzzy);
}
}
if (!isset($postponed[$groupId][$code])) {
$cache = new MessageGroupCache($groupId, $code);
$cache->create();
}
}
}
JobQueueGroup::singleton()->push($jobs);
$reader->close();
rename($changefile, $changefile . '-' . wfTimestamp());
if (count($postponed)) {
$changefile = TranslateUtils::cacheFile(self::CHANGEFILE);
$writer = CdbWriter::open($changefile);
$keys = array_keys($postponed);
$writer->set('#keys', serialize($keys));
foreach ($postponed as $groupId => $changes) {
$writer->set($groupId, serialize($changes));
}
$writer->close();
$this->showChanges(true, $this->getLimit());
} else {
$out->addWikiMsg('translate-smg-submitted');
}
}
示例5: getOldCacheFileName
/**
* Returns full path to the old cache file location.
* @return string
*/
protected function getOldCacheFileName()
{
$cacheFileName = "translate_groupcache-{$this->group->getId()}-{$this->code}.cdb";
return TranslateUtils::cacheFile($cacheFileName);
}
示例6: getReader
protected function getReader()
{
if ($this->reader) {
return $this->reader;
}
$file = TranslateUtils::cacheFile($this->filename);
if (!file_exists($file)) {
// Create an empty index to allow rebuild
$this->store(array());
$this->index = $this->rebuild();
}
return $this->reader = CdbReader::open($file);
}