コード例 #1
0
ファイル: easyblog.php プロジェクト: knigherrant/decopatio
 /**
  * Delete a url from the cache
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function deleteFromCache($id)
 {
     if (!$this->exists()) {
         return;
     }
     $db = EB::db();
     $sql = $db->sql();
     $query = array();
     $query[] = 'SELECT ' . $db->qn('link_id') . ' FROM ' . $db->qn('#__finder_links');
     $query[] = 'WHERE ' . $db->qn('url') . ' LIKE ' . $db->Quote('%option=com_easyblog&view=entry&id=' . $id . '%');
     $query = implode(' ', $query);
     $db->setQuery($query);
     $item = $db->loadResult();
     if (EB::isJoomla30()) {
         $state = $this->indexer->remove($item);
     } else {
         $state = FinderIndexer::remove($item);
     }
     return $state;
 }
コード例 #2
0
ファイル: adapter.php プロジェクト: fur81/zofaxiopeu
 /**
  * Method to remove an item from the index.
  *
  * @param   string  $id  The ID of the item to remove.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function remove($id)
 {
     // Get the item's URL
     $url = $this->db->quote($this->getUrl($id, $this->extension, $this->layout));
     // Get the link ids for the content items.
     $query = $this->db->getQuery(true)->select($this->db->quoteName('link_id'))->from($this->db->quoteName('#__finder_links'))->where($this->db->quoteName('url') . ' = ' . $url);
     $this->db->setQuery($query);
     $items = $this->db->loadColumn();
     // Check the items.
     if (empty($items)) {
         return true;
     }
     // Remove the items.
     foreach ($items as $item) {
         $this->indexer->remove($item);
     }
     return true;
 }
コード例 #3
0
ファイル: adapter.php プロジェクト: vuchannguyen/hoctap
 /**
  * Method to remove an item from the index.
  *
  * @param   string  $id  The ID of the item to remove.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function remove($id)
 {
     JLog::add('FinderIndexerAdapter::remove', JLog::INFO);
     // Get the item's URL
     $url = $this->db->quote($this->getUrl($id, $this->extension, $this->layout));
     // Get the link ids for the content items.
     $query = $this->db->getQuery(true);
     $query->select($this->db->quoteName('link_id'));
     $query->from($this->db->quoteName('#__finder_links'));
     $query->where($this->db->quoteName('url') . ' = ' . $url);
     $this->db->setQuery($query);
     $items = $this->db->loadColumn();
     // Check for a database error.
     if ($this->db->getErrorNum()) {
         // Throw database error exception.
         throw new Exception($this->db->getErrorMsg(), 500);
     }
     // Check the items.
     if (empty($items)) {
         return true;
     }
     // Remove the items.
     foreach ($items as $item) {
         FinderIndexer::remove($item);
     }
     return true;
 }
コード例 #4
0
ファイル: easysocialusers.php プロジェクト: ppantilla/bbninja
 /**
  * Method to remove the link information for items that have been deleted.
  *
  * @param   string  $context  The context of the action being performed.
  * @param   JTable  $table    A JTable object containing the record to be deleted
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 public function onFinderAfterDelete($context, $table)
 {
     if ($context == 'easysocial.users') {
         $id = $table->id;
         $db = FD::db();
         $sql = $db->sql();
         $query = "select `link_id` from `#__finder_links` where `url` like '%option=com_easysocial&view=profile&id={$id}%'";
         $sql->raw($query);
         $db->setQuery($sql);
         $item = $db->loadResult();
         if ($item) {
             // Index the item.
             if (FD::isJoomla30()) {
                 $this->indexer->remove($item);
             } else {
                 FinderIndexer::remove($item);
             }
         }
         return true;
     } elseif ($context == 'com_finder.index') {
         $id = $table->link_id;
     } else {
         return true;
     }
     // Remove the items.
     return $this->remove($id);
 }