Changeset 82748 in spip-zone
- Timestamp:
- May 26, 2014, 1:45:55 PM (7 years ago)
- Location:
- _plugins_/indexer/trunk/Sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/indexer/trunk/Sources/Articles.php
r82452 r82748 11 11 public function getDocuments($start = 0, $end = 0, $column = 'id_article') { 12 12 13 $where = [];13 $where = array(); 14 14 if ($start) $where[] = "$column >= $start"; 15 15 if ($end) $where[] = "$column < $end"; … … 24 24 ); 25 25 26 $documents = [];26 $documents = array(); 27 27 foreach ($all as $article) { 28 28 $documents[] = $this->createDocumentArticle($article); … … 36 36 $id = $article['id_article']; 37 37 38 return new Document( [38 return new Document(array( 39 39 'id' => $this->getObjectId('article', $id), 40 40 'title' => supprimer_numero($article['titre']), … … 44 44 'uri' => generer_url_entite_absolue($id, 'article'), 45 45 'properties' => 46 [46 array( 47 47 'authors' => $this->getAuthorsProperties('article', $id), 48 48 'tags' => $this->getTagsProperties('article', $id), … … 50 50 'id_objet' => $id, 51 51 'lang' => $article['lang'] 52 ]53 ]);52 ) 53 )); 54 54 } 55 55 56 56 57 57 public function getBounds() { 58 return $bornes = sql_fetsel( ['MIN(id_article) AS min', 'MAX(id_article) AS max'], 'spip_articles');58 return $bornes = sql_fetsel(array('MIN(id_article) AS min', 'MAX(id_article) AS max'), 'spip_articles'); 59 59 } 60 60 -
_plugins_/indexer/trunk/Sources/SpipDocuments.php
r82421 r82748 45 45 public function getAuthorsProperties($objet, $id_objet) { 46 46 if ($this->tables_liens) { 47 $auteurs = sql_allfetsel('a.nom', 'spip_auteurs AS a, spip_auteurs_liens AS al', [47 $auteurs = sql_allfetsel('a.nom', 'spip_auteurs AS a, spip_auteurs_liens AS al', array( 48 48 "al.id_objet = " . intval($id_objet), 49 49 "al.objet = " . sql_quote($objet), 50 50 "a.id_auteur = al.id_auteur", 51 ]);51 )); 52 52 } else { 53 $auteurs = sql_allfetsel('a.nom', 'spip_auteurs AS a, spip_auteurs_articles AS al', [53 $auteurs = sql_allfetsel('a.nom', 'spip_auteurs AS a, spip_auteurs_articles AS al', array( 54 54 "al.id_article = " . intval($id_objet), 55 55 "a.id_auteur = al.id_auteur", 56 ]);56 )); 57 57 } 58 58 return array_map('array_shift', $auteurs); … … 62 62 public function getTagsProperties($objet, $id_objet) { 63 63 if ($this->tables_liens) { 64 $tags = sql_allfetsel('m.titre', 'spip_mots AS m, spip_mots_liens AS ml', [64 $tags = sql_allfetsel('m.titre', 'spip_mots AS m, spip_mots_liens AS ml', array( 65 65 "ml.id_objet = " . intval($id_objet), 66 66 "ml.objet = " . sql_quote($objet), 67 67 "m.id_mot = ml.id_mot", 68 ]);68 )); 69 69 } else { 70 $tags = sql_allfetsel('m.titre', 'spip_mots AS m, spip_mots_articles AS ml', [70 $tags = sql_allfetsel('m.titre', 'spip_mots AS m, spip_mots_articles AS ml', array( 71 71 "ml.id_article = " . intval($id_objet), 72 72 "m.id_mot = ml.id_mot", 73 ]);73 )); 74 74 } 75 75 return array_map('array_shift', $tags); … … 78 78 79 79 public function getBounds() { 80 return ['min' => 0, 'max' => 0];80 return array('min' => 0, 'max' => 0); 81 81 } 82 82 … … 89 89 public function getParts($count) { 90 90 $bornes = $this->getBounds(); 91 $parts = [];91 $parts = array(); 92 92 for ($i = $bornes['min']; $i <= $bornes['max']; $i += $count) { 93 $parts[] = [93 $parts[] = array( 94 94 'start' => $i, 95 95 'end' => $i + $count 96 ];96 ); 97 97 } 98 98 return $parts;
Note: See TracChangeset
for help on using the changeset viewer.