protected function deleteDocumentsByHash(array $hashes)
 {
     $atom_table = new DivinerLiveAtom();
     $symbol_table = new DivinerLiveSymbol();
     $conn_w = $symbol_table->establishConnection('w');
     $strings = array();
     foreach ($hashes as $hash) {
         $strings[] = qsprintf($conn_w, '%s', $hash);
     }
     foreach (PhabricatorLiskDAO::chunkSQL($strings, ', ') as $chunk) {
         queryfx($conn_w, 'UPDATE %T SET graphHash = NULL, nodeHash = NULL
       WHERE graphHash IN (%Q)', $symbol_table->getTableName(), $chunk);
     }
     queryfx($conn_w, 'DELETE a FROM %T a LEFT JOIN %T s
     ON a.symbolPHID = s.phid
     WHERE s.graphHash IS NULL', $atom_table->getTableName(), $symbol_table->getTableName());
 }
Example #2
0
 protected function loadPage()
 {
     $table = new DivinerLiveSymbol();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $table->loadAllFromArray($data);
 }
 private function renderFullSignature(DivinerLiveSymbol $symbol, $is_link = false)
 {
     switch ($symbol->getType()) {
         case DivinerAtom::TYPE_CLASS:
         case DivinerAtom::TYPE_INTERFACE:
         case DivinerAtom::TYPE_METHOD:
         case DivinerAtom::TYPE_FUNCTION:
             break;
         default:
             return $symbol->getTitle();
     }
     $atom = $symbol->getAtom();
     $out = array();
     if ($atom) {
         if ($atom->getProperty('final')) {
             $out[] = 'final';
         }
         if ($atom->getProperty('abstract')) {
             $out[] = 'abstract';
         }
         if ($atom->getProperty('access')) {
             $out[] = $atom->getProperty('access');
         }
         if ($atom->getProperty('static')) {
             $out[] = 'static';
         }
     }
     switch ($symbol->getType()) {
         case DivinerAtom::TYPE_CLASS:
         case DivinerAtom::TYPE_INTERFACE:
             $out[] = $symbol->getType();
             break;
         case DivinerAtom::TYPE_FUNCTION:
             switch ($atom->getLanguage()) {
                 case 'php':
                     $out[] = $symbol->getType();
                     break;
             }
             break;
         case DivinerAtom::TYPE_METHOD:
             switch ($atom->getLanguage()) {
                 case 'php':
                     $out[] = DivinerAtom::TYPE_FUNCTION;
                     break;
             }
             break;
     }
     $anchor = null;
     switch ($symbol->getType()) {
         case DivinerAtom::TYPE_METHOD:
             $anchor = $symbol->getType() . '/' . $symbol->getName();
             break;
         default:
             break;
     }
     $out[] = phutil_tag($anchor ? 'a' : 'span', array('class' => 'diviner-atom-signature-name', 'href' => $anchor ? '#' . $anchor : null, 'name' => $is_link ? null : $anchor), $symbol->getName());
     $out = phutil_implode_html(' ', $out);
     if ($atom) {
         $parameters = $atom->getProperty('parameters');
         if ($parameters !== null) {
             $pout = array();
             foreach ($parameters as $parameter) {
                 $pout[] = idx($parameter, 'name', '...');
             }
             $out = array($out, '(' . implode(', ', $pout) . ')');
         }
     }
     return phutil_tag('span', array('class' => 'diviner-atom-signature'), $out);
 }