Exemple #1
0
 /**
  * @param $entry
  * @param $source
  */
 function makeLink($entry, $source)
 {
     if (isset($this->prefixRewrites[$source]) && isset($entry[0]) && isset($this->prefixRewrites[$source][$entry[0]])) {
         $entry[0] = $this->prefixRewrites[$source][$entry[0]];
     }
     if (!array_key_exists("iw_prefix", $entry)) {
         $entry = array("iw_prefix" => $entry[0], "iw_url" => $entry[1], "iw_local" => $entry[2]);
     }
     if (array_key_exists($source, $this->prefixRewrites) && array_key_exists($entry['iw_prefix'], $this->prefixRewrites[$source])) {
         $entry['iw_prefix'] = $this->prefixRewrites[$source][$entry['iw_prefix']];
     }
     if (!array_key_exists("iw_local", $entry)) {
         $entry["iw_local"] = null;
     }
     if (!array_key_exists("iw_url", $entry)) {
         $entry["iw_url"] = '';
     }
     if ($this->dbFile) {
         $this->dbFile->set("{$source}:{$entry['iw_prefix']}", trim("{$entry['iw_local']} {$entry['iw_url']}"));
     } else {
         $this->output("{$source}:{$entry['iw_prefix']} {$entry['iw_url']} {$entry['iw_local']}\n");
     }
     # Add to list of prefixes
     $this->prefixLists[$source][$entry['iw_prefix']] = 1;
 }
 public function set($key, $value)
 {
     if (is_null($this->writer)) {
         throw new MWException(__CLASS__ . ': must call startWrite() before calling set()');
     }
     try {
         $this->writer->set($key, serialize($value));
     } catch (CdbException $e) {
         throw new MWException($e->getMessage());
     }
 }