Example #1
0
 public function testDeleteAll()
 {
     $users = $this->database->select(User::class);
     $this->database->delete($users);
     $users = $this->database->select(User::class);
     $this->assertEquals(0, count($users));
 }
Example #2
0
 public function load()
 {
     $db = new Database();
     $db->delete('Users', 'StudentId is not null');
     $db->delete('Students', '1=1');
     $db->select('Settings', 'SrProjectUrl,SrProjectToken');
     $settings = $db->getResult();
     $students = json_decode(file_get_contents($settings['SrProjectUrl'] . '/getAll/' . $settings['SrProjectToken']));
     foreach ($students as $student) {
         $db->insert('Students', array('id' => $student->id, 'Project' => $student->projectTitle, 'Location' => 'TBA'));
         $db->insert('Users', array('Email' => $student->email . '@fiu.edu', 'FirstName' => ucfirst($student->firstName), 'LastName' => ucfirst($student->lastName), 'StudentId' => $student->id, 'Roles' => 'student', 'DefaultRole' => 'student'));
     }
     return true;
 }
Example #3
0
function deleteEquip($id)
{
    $db = new Database();
    $link = $db->connect();
    $result = $db->delete($link, 'equip_type', 'type_id=' . $id);
    return $result;
}
Example #4
0
 protected function do_delete($data)
 {
     $user = $this->user;
     $id = $data['id'];
     Database::delete('note', 'id_user = ? and id = ?', array($user, $id));
     return array('success' => true);
 }
Example #5
0
 public function remove($id)
 {
     $db = new Database();
     $db->delete('Questions', 'id=' . $id);
     $res = $db->getResult();
     return array('success' => $res[0] === 1);
 }
 /**
  * Delete one or more revisions from the database
  * Do this inside a transaction
  *
  * @param array $id Array of revision id values
  * @param Database $dbw Database class (needs to be a master)
  */
 private function deleteRevs($id, &$dbw)
 {
     if (!is_array($id)) {
         $id = [$id];
     }
     $dbw->delete('revision', ['rev_id' => $id], __METHOD__);
 }
 /**
  * @since 2.3
  *
  * @param integer $sid
  * @param array $dependencyList
  */
 public function updateDependencyList($sid, array $dependencyList)
 {
     $this->connection->beginAtomicTransaction(__METHOD__);
     // Before an insert, delete all entries that for the criteria which is
     // cheaper then doing an individual upsert or selectRow, this also ensures
     // that entries are self-corrected for dependencies matched
     $this->connection->delete(SMWSQLStore3::QUERY_LINKS_TABLE, array('s_id' => $sid), __METHOD__);
     if ($sid == 0) {
         return $this->connection->endAtomicTransaction(__METHOD__);
     }
     $inserts = array();
     foreach ($dependencyList as $dependency) {
         $oid = $this->getIdForSubject($dependency);
         if ($oid < 1) {
             continue;
         }
         $inserts[$sid . $oid] = array('s_id' => $sid, 'o_id' => $oid);
     }
     if ($inserts === array()) {
         return $this->connection->endAtomicTransaction(__METHOD__);
     }
     // MW's multi-array insert needs a numeric dimensional array but the key
     // was used with a hash to avoid duplicate entries hence the re-copy
     $inserts = array_values($inserts);
     wfDebugLog('smw', __METHOD__ . ' insert for SID ' . $sid . "\n");
     $this->connection->insert(SMWSQLStore3::QUERY_LINKS_TABLE, $inserts, __METHOD__);
     $this->connection->endAtomicTransaction(__METHOD__);
 }
 /**
  * @since 2.3
  *
  * @param integer $sid
  * @param array $dependencyList
  */
 public function updateDependencyList($sid, array $dependencyList)
 {
     $this->connection->beginAtomicTransaction(__METHOD__);
     // Before an insert, delete all entries that for the criteria which is
     // cheaper then doing an individual upsert or selectRow, this also ensures
     // that entries are self-corrected for dependencies matched
     $this->connection->delete(SMWSQLStore3::QUERY_LINKS_TABLE, array('s_id' => $sid), __METHOD__);
     if ($sid == 0) {
         return $this->connection->endAtomicTransaction(__METHOD__);
     }
     $inserts = array();
     foreach ($dependencyList as $dependency) {
         $oid = $this->getIdForSubject($dependency);
         // If the ID_TABLE didn't contained an valid ID then we create one ourselves
         // to ensure that object entities are tracked from the start
         // This can happen when a query is added with object reference that have not
         // yet been referenced as annotation and therefore do not recognized as
         // value annotation
         if ($oid < 1 && ($oid = $this->tryToMakeIdForSubject($dependency)) < 1) {
             continue;
         }
         $inserts[$sid . $oid] = array('s_id' => $sid, 'o_id' => $oid);
     }
     if ($inserts === array()) {
         return $this->connection->endAtomicTransaction(__METHOD__);
     }
     // MW's multi-array insert needs a numeric dimensional array but the key
     // was used with a hash to avoid duplicate entries hence the re-copy
     $inserts = array_values($inserts);
     wfDebugLog('smw', __METHOD__ . ' insert for SID ' . $sid . "\n");
     $this->connection->insert(SMWSQLStore3::QUERY_LINKS_TABLE, $inserts, __METHOD__);
     $this->connection->endAtomicTransaction(__METHOD__);
 }
 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_HISTORY];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     Database::delete('userhistory', ['user_id' => $context->user->id]);
     $data = [];
     $nodes = $xpath->query('//table//td[@class = \'borderClass\']/..');
     foreach ($nodes as $node) {
         //basic info
         $link = $node->childNodes->item(0)->childNodes->item(0)->getAttribute('href');
         preg_match('/(\\d+)\\/?$/', $link, $matches);
         $media = strpos($link, 'manga') !== false ? Media::Manga : Media::Anime;
         $mediaMalId = intval($matches[0]);
         $progress = Strings::makeInteger($node->childNodes->item(0)->childNodes->item(2)->nodeValue);
         //parse time
         //That's what MAL servers output for MG client
         if (isset($doc->headers['Date'])) {
             date_default_timezone_set('UTC');
             $now = strtotime($doc->headers['Date']);
         } else {
             $now = time();
         }
         date_default_timezone_set('America/Los_Angeles');
         $hour = date('H', $now);
         $minute = date('i', $now);
         $second = date('s', $now);
         $day = date('d', $now);
         $month = date('m', $now);
         $year = date('Y', $now);
         $dateString = $node->childNodes->item(2)->nodeValue;
         if (preg_match('/(\\d*) seconds? ago/', $dateString, $matches)) {
             $second -= intval($matches[1]);
         } elseif (preg_match('/(\\d*) minutes? ago/', $dateString, $matches)) {
             $second -= intval($matches[1]) * 60;
         } elseif (preg_match('/(\\d*) hours? ago/', $dateString, $matches)) {
             $minute -= intval($matches[1]) * 60;
         } elseif (preg_match('/Today, (\\d*):(\\d\\d) (AM|PM)/', $dateString, $matches)) {
             $hour = intval($matches[1]);
             $minute = intval($matches[2]);
             $hour += ($matches[3] == 'PM' and $hour != 12) ? 12 : 0;
         } elseif (preg_match('/Yesterday, (\\d*):(\\d\\d) (AM|PM)/', $dateString, $matches)) {
             $hour = intval($matches[1]);
             $minute = intval($matches[2]);
             $hour += ($matches[3] == 'PM' and $hour != 12) ? 12 : 0;
             $hour -= 24;
         } elseif (preg_match('/(\\d\\d)-(\\d\\d)-(\\d\\d), (\\d*):(\\d\\d) (AM|PM)/', $dateString, $matches)) {
             $year = intval($matches[3]) + 2000;
             $month = intval($matches[1]);
             $day = intval($matches[2]);
             $hour = intval($matches[4]);
             $minute = intval($matches[5]);
             $hour += ($matches[6] == 'PM' and $hour != 12) ? 12 : 0;
         }
         $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
         date_default_timezone_set('UTC');
         $data[] = ['user_id' => $context->user->id, 'mal_id' => $mediaMalId, 'media' => $media, 'progress' => $progress, 'timestamp' => date('Y-m-d H:i:s', $timestamp)];
     }
     Database::insert('userhistory', $data);
 }
 public function process(array $documents, &$context)
 {
     $document = $documents[self::URL_MEDIA];
     $dom = self::getDOM($document);
     $xpath = new DOMXPath($dom);
     Database::delete('mediarelation', ['media_id' => $context->media->id]);
     $data = [];
     foreach ($xpath->query('//table[@class=\'anime_detail_related_anime\']/tr') as $node) {
         $typeMal = strtolower(Strings::removeSpaces($node->childNodes[0]->textContent));
         $type = Strings::makeEnum($typeMal, ['adaptation' => MediaRelation::Adaptation, 'alternative setting' => MediaRelation::AlternativeSetting, 'alternative version' => MediaRelation::AlternativeVersion, 'character' => MediaRelation::Character, 'full story' => MediaRelation::FullStory, 'other' => MediaRelation::Other, 'parent story' => MediaRelation::ParentStory, 'prequel' => MediaRelation::Prequel, 'sequel' => MediaRelation::Sequel, 'side story' => MediaRelation::SideStory, 'spin-off' => MediaRelation::SpinOff, 'summary' => MediaRelation::Summary], null);
         if ($type === null) {
             throw new BadProcessorDocumentException($document, 'unknown relation type: ' . $typeMal);
         }
         $links = $node->childNodes[1]->getElementsByTagName('a');
         foreach ($links as $link) {
             $link = $link->getAttribute('href');
             if (preg_match('#^/(anime|manga)/([0-9]+)/#', $link, $matches)) {
                 $idMal = Strings::makeInteger($matches[2]);
                 if ($matches[1] === 'anime') {
                     $media = Media::Anime;
                 } elseif ($matches[1] === 'manga') {
                     $media = Media::Manga;
                 }
                 $data[] = ['media_id' => $context->media->id, 'mal_id' => $idMal, 'media' => $media, 'type' => $type];
             }
         }
     }
     Database::insert('mediarelation', $data);
     $context->relationData = $data;
 }
Example #11
0
 /**
  * Delete a named variable value.
  * @param string $name Name of the variable to delete.
  */
 public static function delete($name)
 {
     $db = new Database();
     $db->delete('variables', array('name' => $name));
     $cache = Cache::instance();
     $cache->delete("variable-{$name}");
 }
Example #12
0
 /**
  * Merge page histories
  *
  * @param integer $id The page_id
  * @param Title $newTitle The new title
  * @return bool
  */
 private function mergePage($row, Title $newTitle)
 {
     $id = $row->page_id;
     // Construct the WikiPage object we will need later, while the
     // page_id still exists. Note that this cannot use makeTitleSafe(),
     // we are deliberately constructing an invalid title.
     $sourceTitle = Title::makeTitle($row->page_namespace, $row->page_title);
     $sourceTitle->resetArticleID($id);
     $wikiPage = new WikiPage($sourceTitle);
     $wikiPage->loadPageData('fromdbmaster');
     $destId = $newTitle->getArticleID();
     $this->beginTransaction($this->db, __METHOD__);
     $this->db->update('revision', ['rev_page' => $destId], ['rev_page' => $id], __METHOD__);
     $this->db->delete('page', ['page_id' => $id], __METHOD__);
     $this->commitTransaction($this->db, __METHOD__);
     /* Call LinksDeletionUpdate to delete outgoing links from the old title,
      * and update category counts.
      *
      * Calling external code with a fake broken Title is a fairly dubious
      * idea. It's necessary because it's quite a lot of code to duplicate,
      * but that also makes it fragile since it would be easy for someone to
      * accidentally introduce an assumption of title validity to the code we
      * are calling.
      */
     DeferredUpdates::addUpdate(new LinksDeletionUpdate($wikiPage));
     DeferredUpdates::doUpdates();
     return true;
 }
Example #13
0
 public function removeVote($user)
 {
     if (is_object($user) && is_numeric($user->id)) {
         $user = $user->id;
     }
     foreach ($this->possibilities as $possibility) {
         Database::delete('votes', array('possibility' => $possibility->id, 'user' => $user));
     }
 }
Example #14
0
    /**
     * Delete a skill profile
     * @param int $id The skill profile id
     * @return boolean Whether delete a skill profile
     */
    public function delete($id) {
        Database::delete(
            $this->table_rel_profile,
            array(
                'profile_id' => $id
            )
        );

        return parent::delete($id);
    }
Example #15
0
 public function onProcessingError(&$context)
 {
     if ($context->exception instanceof BadProcessorKeyException) {
         Database::delete('userfriend', ['user_id' => $context->user->id]);
         Database::delete('userhistory', ['user_id' => $context->user->id]);
         Database::delete('usermedia', ['user_id' => $context->user->id]);
         Database::delete('user', ['id' => $context->user->id]);
     }
     throw $context->exception;
 }
Example #16
0
 public function onProcessingError(&$context)
 {
     if ($context->exception instanceof BadProcessorKeyException) {
         Database::delete('mediagenre', ['media_id' => $context->media->id]);
         Database::delete('mediarelation', ['media_id' => $context->media->id]);
         Database::delete('mediarec', ['media_id' => $context->media->id]);
         Database::delete('mangaauthor', ['media_id' => $context->media->id]);
         Database::delete('media', ['id' => $context->media->id]);
     }
     throw $context->exception;
 }
Example #17
0
 public function remove_category($cid)
 {
     $db = new Database();
     if (!$db->connect()) {
         return false;
     }
     if (!$db->delete('categories', 'c_id=' . $cid)) {
         return false;
     }
     $db->disconnect();
     return true;
 }
Example #18
0
 public function send($rec)
 {
     $db = new Database();
     $db->select('JudgeInvitations', 'id', null, "Email = '" . $rec->Email . "'", 'Sent DESC', '1');
     $invite = $db->getResult();
     $isNew = !array_key_exists('id', $invite);
     $id = $isNew ? trim($db->getGUID(), "{}") : $invite['id'];
     if (!$isNew) {
         $db->delete('JudgeInvitations', "id='" . $id . "'");
     }
     $db->insert('JudgeInvitations', array('id' => $id, 'Email' => $rec->Email, 'FirstName' => $rec->FirstName, 'LastName' => $rec->LastName));
     $db->select('JudgeInvitations', 'JudgeInvitations.*,Settings.Subject', 'Settings ON 1=1', "id = '" . $id . "'");
     $invite = null;
     $invite = $db->getResult();
     $sent = mail($rec->Email, $invite['Subject'], self::getEmailBody($id), "From: Masoud Sadjadi <*****@*****.**>\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
     if ($isNew && !$sent) {
         $db->delete('JudgeInvitations', "id = '" . $id . "'");
         $invite = null;
     }
     return array('success' => $sent, 'data' => $invite);
 }
Example #19
0
 protected function link($data)
 {
     $link_ids = Database::get_table('post_update_link', 'id', 'update_id = ?', $this->model->get_id());
     Database::delete('post_update_link_url', Database::array_in('link_id', $link_ids), $link_ids);
     Database::delete('post_update_link', 'update_id = ?', $this->model->get_id());
     $links = Check::link_array($data['link']);
     $links = Transform_Link::parse($links);
     foreach ($links as $link) {
         $link = new Model_Post_Update_Link($link);
         $this->model->add_link($link);
     }
 }
Example #20
0
 /**
  * Destroys the current session.
  *
  * @return  boolean
  */
 protected function _destroy()
 {
     try {
         // Execute the query
         $this->_redis->delete($this->_prefix . $this->_session_id);
         // Delete the cookie
         Cookie::delete($this->_name);
     } catch (Exception $e) {
         // An error occurred, the session has not been deleted
         return FALSE;
     }
     return TRUE;
 }
 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_FRIENDS];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     Database::delete('userfriend', ['user_id' => $context->user->id]);
     $data = [];
     foreach ($xpath->query('//a[contains(@href, \'profile\')]/strong') as $node) {
         $friendName = Strings::removeSpaces($node->nodeValue);
         $data[] = ['user_id' => $context->user->id, 'name' => $friendName];
     }
     Database::insert('userfriend', $data);
 }
 public function process(array $documents, &$context)
 {
     Database::delete('usermedia', ['user_id' => $context->user->id]);
     $context->user->cool = false;
     foreach (Media::getConstList() as $media) {
         $key = $media == Media::Anime ? self::URL_ANIMELIST : self::URL_MANGALIST;
         $isPrivate = strpos($documents[$key]->content, 'This list has been made private by the owner') !== false;
         $key = $media == Media::Anime ? self::URL_ANIMEINFO : self::URL_MANGAINFO;
         $doc = $documents[$key];
         $dom = self::getDOM($doc);
         $xpath = new DOMXPath($dom);
         if ($xpath->query('//myinfo')->length == 0) {
             throw new BadProcessorDocumentException($doc, 'myinfo block is missing');
         }
         if (strpos($doc->content, '</myanimelist>') === false) {
             throw new BadProcessorDocumentException($doc, 'list is only partially downloaded');
         }
         $nodes = $xpath->query('//anime | //manga');
         $data = [];
         foreach ($nodes as $root) {
             $mediaMalId = Strings::makeInteger(self::getNodeValue($xpath, 'series_animedb_id | series_mangadb_id', $root));
             $score = Strings::makeInteger(self::getNodeValue($xpath, 'my_score', $root));
             $startDate = Strings::makeDate(self::getNodeValue($xpath, 'my_start_date', $root));
             $finishDate = Strings::makeDate(self::getNodeValue($xpath, 'my_finish_date', $root));
             $status = Strings::makeEnum(self::getNodeValue($xpath, 'my_status', $root), [1 => UserListStatus::Completing, 2 => UserListStatus::Finished, 3 => UserListStatus::OnHold, 4 => UserListStatus::Dropped, 6 => UserListStatus::Planned], UserListStatus::Unknown);
             $finishedEpisodes = null;
             $finishedChapters = null;
             $finishedVolumes = null;
             switch ($media) {
                 case Media::Anime:
                     $finishedEpisodes = Strings::makeInteger(self::getNodeValue($xpath, 'my_watched_episodes', $root));
                     break;
                 case Media::Manga:
                     $finishedChapters = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_chapters', $root));
                     $finishedVolumes = Strings::makeInteger(self::getNodeValue($xpath, 'my_read_volumes', $root));
                     break;
                 default:
                     throw new BadMediaException();
             }
             $data[] = ['user_id' => $context->user->id, 'mal_id' => $mediaMalId, 'media' => $media, 'score' => $score, 'start_date' => $startDate, 'end_date' => $finishDate, 'finished_episodes' => $finishedEpisodes, 'finished_chapters' => $finishedChapters, 'finished_volumes' => $finishedVolumes, 'status' => $status];
         }
         Database::insert('usermedia', $data);
         $dist = RatingDistribution::fromEntries(ReflectionHelper::arraysToClasses($data));
         $daysSpent = Strings::makeFloat(self::getNodeValue($xpath, '//user_days_spent_watching'));
         $user =& $context->user;
         $user->{Media::toString($media) . '_days_spent'} = $daysSpent;
         $user->{Media::toString($media) . '_private'} = $isPrivate;
         $user->cool |= ($dist->getRatedCount() >= 50 and $dist->getStandardDeviation() >= 1.5);
         R::store($user);
     }
 }
Example #23
0
 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_MEDIA];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     Database::delete('mediatag', ['media_id' => $context->media->id]);
     $data = [];
     foreach ($xpath->query('//h2[starts-with(text(), \'Popular Tags\')]/following-sibling::*/a') as $node) {
         $tagName = Strings::removeSpaces($node->textContent);
         $tagCount = Strings::makeInteger($node->getAttribute('title'));
         $data[] = ['media_id' => $context->media->id, 'name' => $tagName, 'count' => $tagCount];
     }
     Database::insert('mediatag', $data);
 }
 private function doRemoveEntityReferencesById($id)
 {
     $this->connection->delete(SQLStore::ID_TABLE, array('smw_id' => $id), __METHOD__);
     $this->connection->delete(SQLStore::PROPERTY_STATISTICS_TABLE, array('p_id' => $id), __METHOD__);
     $this->connection->delete(SQLStore::QUERY_LINKS_TABLE, array('s_id' => $id), __METHOD__);
     $this->connection->delete(SQLStore::QUERY_LINKS_TABLE, array('o_id' => $id), __METHOD__);
     // Avoid Query: DELETE FROM `smw_ft_search` WHERE s_id = '92575'
     // Error: 126 Incorrect key file for table '.\mw@002d25@002d01\smw_ft_search.MYI'; ...
     try {
         $this->connection->delete(SQLStore::FT_SEARCH_TABLE, array('s_id' => $id), __METHOD__);
     } catch (\DBError $e) {
         wfDebugLog('smw', __METHOD__ . ' reported: ' . $e->getMessage());
     }
 }
Example #25
0
 public function delete($id)
 {
     $db = new Database();
     $db->connect();
     $where = 'id=' . $id;
     $result = $db->delete(static::$tableName, $where);
     $returnValue;
     if ($result) {
         $returnValue = TRUE;
     } else {
         $returnValue = FALSE;
     }
     $db->disconnect();
     return $returnValue;
 }
 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_MEDIA];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     Database::delete('mediagenre', ['media_id' => $context->media->id]);
     $data = [];
     foreach ($xpath->query('//span[starts-with(text(), \'Genres\')]/../a') as $node) {
         preg_match('/=([0-9]+)/', $node->getAttribute('href'), $matches);
         $genreMalId = Strings::makeInteger($matches[1]);
         $genreName = Strings::removeSpaces($node->textContent);
         $data[] = ['media_id' => $context->media->id, 'mal_id' => $genreMalId, 'name' => $genreName];
     }
     Database::insert('mediagenre', $data);
 }
 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_RECS];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     Database::delete('mediarec', ['media_id' => $context->media->id]);
     $data = [];
     foreach ($xpath->query('//h2[starts-with(text(), \'Recommendations\')]/following-sibling::node()[@class=\'borderClass\']') as $node) {
         preg_match('/\\/([0-9]+)/', self::getNodeValue($xpath, './/strong/..', $node, 'href'), $matches);
         $recommendedMalId = Strings::makeInteger($matches[1]);
         $recommendationCount = 1 + Strings::makeInteger(self::getNodeValue($xpath, './/div[@class=\'spaceit\']//strong', $node));
         $data[] = ['media_id' => $context->media->id, 'mal_id' => $recommendedMalId, 'count' => $recommendationCount];
     }
     Database::insert('mediarec', $data);
 }
 public function process(array $documents, &$context)
 {
     $document = $documents[self::URL_RECS];
     $dom = self::getDOM($document);
     $xpath = new DOMXPath($dom);
     Database::delete('mediarec', ['media_id' => $context->media->id]);
     $data = [];
     foreach ($xpath->query('//div[@class = \'borderClass\']') as $node) {
         preg_match('#/([0-9]+)/#', self::getNodeValue($xpath, './/strong/..', $node, 'href'), $matches);
         $idMal = Strings::makeInteger($matches[1]);
         $count = 1 + Strings::makeInteger(self::getNodeValue($xpath, './/div[@class = \'spaceit\']//strong', $node));
         $data[] = ['media_id' => $context->media->id, 'mal_id' => $idMal, 'count' => $count];
     }
     Database::insert('mediarec', $data);
 }
Example #29
0
 /**
  * Purge the objectcache table
  */
 public function purgeCache()
 {
     global $wgLocalisationCacheConf;
     # We can't guarantee that the user will be able to use TRUNCATE,
     # but we know that DELETE is available to us
     $this->output("Purging caches...");
     $this->db->delete('objectcache', '*', __METHOD__);
     if ($wgLocalisationCacheConf['manualRecache']) {
         $this->rebuildLocalisationCache();
     }
     $blobStore = new MessageBlobStore();
     $blobStore->clear();
     $this->db->delete('module_deps', '*', __METHOD__);
     $this->output("done.\n");
 }
 /**
  * Process delete form. Receive POST data as parameter.
  *
  * @param array post
  * @return void
  */
 private function _delete($post = array())
 {
     if (count($post) > 0) {
         // get pk name and value
         $pk = $this->acme_controller_model->get_pk_name($this->table_name);
         $pk_value = $this->input->post('pk_value');
         // old data to log
         $old_data = $this->db->get_where($this->table_name, array($pk => $pk_value))->row_array(0);
         // log delete
         $this->logger->db_log(lang('Record delete'), 'delete', $this->table_name, $old_data);
         // Removes
         $this->db->delete($this->table_name, array($pk => $pk_value));
     }
     redirect($this->controller);
 }