public function add(array $data)
    {
        $result = null;
        $this->hook->attach('module.backup.add.before', $data, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $version = null;
        if (isset($data['version'])) {
            $version = $data['version'];
        }

        if ($this->exists($data['id'], $version)) {
            return false;
        }

        if (empty($data['user_id'])) {
            $data['user_id'] = $this->user->getId();
        }

        $data['created'] = GC_TIME;
        $result = $this->db->insert('backup', $data);

        $this->hook->attach('module.backup.add.after', $data, $result, $this);
        return $result;
    }
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('module.backup.add.before', $data, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $version = null;
        if (isset($data['version'])) {
            $version = $data['version'];
        }

        if ($this->exists($data['id'], $version)) {
            return false;
        }

        if (empty($data['user_id'])) {
            $data['user_id'] = $this->user->getId();
        }

        $data['created'] = GC_TIME;
        $result = $this->db->insert('backup', $data);

        $this->hook->attach('module.backup.add.after', $data, $result, $this);
        return $result;
    }
public function add ( array $ data ) { $ result = null ; $ this -> hook -> attach ( 'module.backup.add.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ version = null ; if ( isset ( $ data [ 'version' ] ) ) { $ version = $ data [ 'version' ] ; } if ( $ this -> exists ( $ data [ 'id' ] , $ version ) ) { return false ; } if ( empty ( $ data [ 'user_id' ] ) ) { $ data [ 'user_id' ] = $ this -> user -> getId ( ) ; } $ data [ 'created' ] = GC_TIME ; $ result = $ this -> db -> insert ( 'backup' , $ data ) ; $ this -> hook -> attach ( 'module.backup.add.after' , $ data , $ result , $ this ) ; return $ result ; }
Adds a backup to the database
@param array $data
@return boolean|integer
Adds a backup to the database