Changeset 1366
- Timestamp:
- Sep 12, 2010, 2:44:04 AM (10 years ago)
- Location:
- cpc/trunk/project
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/config/doctrine/schema.yml
r1360 r1366 569 569 Timestampable: ~ 570 570 Taggable: ~ 571 Solrable: 572 title: [titre] 573 description: [contenu, annexe, signataires] 574 moretags: [Parlementaires, categorie, type, Organisme] 575 date: date 571 576 columns: 572 577 id: … … 589 594 organisme_id: integer 590 595 signataires: string 596 contenu: string 591 597 relations: 592 598 Parlementaires: -
cpc/trunk/project/lib/model/doctrine/Texteloi.class.php
r1361 r1366 168 168 } 169 169 170 170 171 public function getAuteursString() { 171 172 if ($this->type === "Texte de la commission") … … 201 202 return $str; 202 203 } 204 205 public function getContenu() { 206 $c = $this->_get('contenu'); 207 return gzinflate(base64_decode($c)); 208 } 209 210 public function setContenu($c) { 211 return $this->_set('contenu', base64_encode(gzdeflate($c))); 212 } 213 214 public function getLink() { 215 sfProjectConfiguration::getActive()->loadHelpers(array('Url')); 216 return url_for('@homepage'); 217 } 218 219 public function getPersonne() { 220 return ''; 221 } 203 222 } -
cpc/trunk/project/lib/model/solr/SolrCommands.class.php
r1332 r1366 44 44 } 45 45 sem_acquire($this->semaphore); 46 if (!$this->file) { 47 touch($lockfile); 48 sem_release($this->semaphore); 49 return $lockfile; 46 if ($this->file) { 47 fclose($this->file); 48 $this->file = null; 50 49 } 51 fclose($this->file); 52 $this->file = null; 53 rename($this->getFileCommands(), $this->getFileCommands().'.lock'); 50 rename($this->getFileCommands(), $lockfile); 54 51 sem_release($this->semaphore); 55 52 return $lockfile; -
cpc/trunk/project/lib/model/solr/SolrConnector.class.php
r1332 r1366 31 31 $file = SolrCommands::getInstance()->getCommandContent(); 32 32 foreach(file($file) as $line) { 33 echo "$line\n"; 33 34 if (preg_match('/(UPDATE|DELETE) : (.+)/', $line, $matches)) { 34 35 $obj = json_decode($matches[2]); -
cpc/trunk/project/lib/task/loadDocumentsTask.class.php
r1359 r1366 21 21 foreach(file($dir.$file) as $line) { 22 22 $json = json_decode($line); 23 if (!$json || !$json->source || !$json->legislature || !$json->id || !$json->numero || !$json->date_depot || !$json->dossier || !$json->type) { 24 echo "ERROR json : $line\n"; 23 if (!$json ) 24 { 25 echo "ERROR json : $dir$file\n"; 25 26 continue; 26 27 } 28 if (!$json->source) 29 {echo "source missing\n"; continue;} 30 if (!$json->legislature) 31 {echo "legislature missing\n"; continue;} 32 if (!$json->id) 33 {echo "source id\n"; continue;} 34 if (!$json->numero) 35 {echo "source numero\n"; continue;} 36 if(!$json->date_depot) 37 {echo "source date_depot\n"; continue;} 38 if (!$json->dossier) 39 {echo "source dossier\n"; continue;} 40 if (!$json->type) 41 {echo "source type\n"; continue;} 27 42 $doc = Doctrine::getTable('TexteLoi')->find($json->id); 28 43 if (!$doc) { … … 52 67 foreach (explode('.', $json->motscles) as $tag) 53 68 $doc->addTag($tag); 69 if ($json->contenu) 70 $doc->setContenu($json->contenu); 54 71 $doc->save(); 55 72 $doc->free(); 73 echo "$dir$file DONE\n"; 56 74 } 57 75 // unlink($dir.$file); 58 76 } 59 77 closedir($dh);
Note: See TracChangeset
for help on using the changeset viewer.