Example #1
0
 /**
  * Purge shURL records from the database
  * either all of them or the currently selected set
  * as per user filter settings in meta manager
  *
  * @param string $type either 'all' or 'selected'
  */
 public function purgePageids($type)
 {
     // make sure we use latest user state
     $this->_updateContextData();
     // call the appropriate sub-method to get the db query
     $methodName = '_getPurgeQuery' . ucfirst($type);
     if (is_callable(array($this, $methodName))) {
         $deleteQuery = $this->{$methodName}();
     } else {
         $this->setError('Invalid method call _purge' . $type);
         return;
     }
     // then run the query
     if (!empty($deleteQuery)) {
         // perform deletion
         try {
             ShlDbHelper::query($deleteQuery);
         } catch (Exception $e) {
             $this->setError('Internal database error # ' . $e->getMessage());
         }
         // reset limit and limitstart variables, to avoid
         // issue when displaying again results
         $this->_setState('limitstart', 0);
         $this->_setState('limit', 0);
     } else {
         $this->setError(JText::_('COM_SH404SEF_NORECORDS'));
     }
 }
 private function _shDeletetable($tableName)
 {
     $db = ShlDbHelper::getDb();
     $query = 'drop table ' . $db->quoteName('#__' . $tableName);
     try {
         ShlDbHelper::query($query);
     } catch (Exception $e) {
         echo $e->getMessage() . '<br />';
     }
 }