migration

This commit is contained in:
Claude 2012-08-31 21:48:51 +02:00
parent 2f9a21383b
commit 8725ea8911
2 changed files with 31 additions and 1 deletions

View File

@ -173,6 +173,36 @@ class Main extends CI_Controller
);
$this->dbforge->add_column('pastes', $fields);
}
//todo: remove that after migration
if (!$this->db->field_exists('blocked_at', 'blocked_ips'))
{
$this->load->dbforge();
$fields = array(
'blocked_at' => array(
'type' => 'INT',
'constraint' => 10,
) ,
);
$this->dbforge->add_column('blocked_ips', $fields);
}
if (!$this->db->field_exists('spam_attempts', 'blocked_ips'))
{
$this->load->dbforge();
$fields = array(
'spam_attempts' => array(
'type' => 'INT',
'constraint' => 6,
'default' => 0,
) ,
);
$this->dbforge->add_column('blocked_ips', $fields);
}
//end todo
}
function _form_prep($lang = false, $title = '', $paste = '', $reply = false)

View File

@ -76,7 +76,7 @@ class Spamadmin extends CI_Controller
function blacklist()
{
$this->db->select('ip_address, blocked_at, spam_attempts');
$this->db->order_by('blocked_at', 'desc');
$this->db->order_by('blocked_at desc, ip_address asc');
$query = $this->db->get('blocked_ips');
$data['blocked_ips'] = $query->result_array();