Beispiel #1
0
 protected function test_file()
 {
     parent::test_file();
     $id = Database::db('api')->get_field('art', 'id', 'md5 = ?', $this->md5);
     if (!empty($id)) {
         throw new ErrorUpload($id, ErrorUpload::ALREADY_EXISTS);
     }
 }
Beispiel #2
0
 protected function check_wiki()
 {
     $tags = Database::db('wiki')->get_vector('page', array('page_title'), 'page_namespace = ?', 500);
     $already_marked = $this->db->get_vector('art_tag', array('name'), 'have_description = ?', 1);
     $tags = array_keys($tags);
     $already_marked = array_keys($already_marked);
     if (empty($already_marked)) {
         $already_marked = array();
     }
     foreach ($tags as $tag) {
         if (!in_array($tag, $already_marked)) {
             $this->db->update('art_tag', array('have_description' => 1), 'name = ?', $tag);
         }
     }
     return memory_get_usage();
 }
Beispiel #3
0
 protected function write_log()
 {
     Database::db('api')->insert('log', array('cookie' => $this->get_cookie(), 'ip' => ip2long($this->get_ip()), 'user' => $this->get_user(), 'api' => get_called_class(), 'params' => json_encode($this->get())));
 }