AnselUpgradeSqlng::dataUp PHP Method

dataUp() public method

public dataUp ( )
    public function dataUp()
    {
        $whos = array('creator', 'default', 'guest');
        $perms = array(Horde_Perms::SHOW, Horde_Perms::READ, Horde_Perms::EDIT, Horde_Perms::DELETE);
        $sql = 'INSERT INTO ansel_sharesng (share_id, share_owner, share_parents, share_name, ' . 'share_flags, attribute_name, attribute_desc, attribute_default, ' . 'attribute_default_type, attribute_default_prettythumb, attribute_style, ' . 'attribute_last_modified, attribute_date_created, attribute_images, ' . 'attribute_has_subgalleries, attribute_slug, attribute_age, ' . 'attribute_download, attribute_passwd, attribute_faces, attribute_view_mode';
        $count = 0;
        foreach ($whos as $who) {
            foreach ($perms as $perm) {
                $sql .= ', perm_' . $who . '_' . $perm;
                $count++;
            }
        }
        $sql .= ') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . str_repeat(', ?', $count) . ')';
        foreach ($this->select('SELECT * FROM ansel_shares') as $share) {
            $values = array($share['share_id'], $share['share_owner'], $share['share_parents'], $share['share_name'], $share['share_flags'], $share['attribute_name'], $share['attribute_desc'], $share['attribute_default'], $share['attribute_default_type'], $share['attribute_default_prettythumb'], $share['attribute_style'], $share['attribute_last_modified'], $share['attribute_date_created'], $share['attribute_images'], $share['attribute_has_subgalleries'], $share['attribute_slug'], $share['attribute_age'], $share['attribute_download'], $share['attribute_passwd'], $share['attribute_faces'], $share['attribute_view_mode']);
            foreach ($whos as $who) {
                foreach ($perms as $perm) {
                    $values[] = (bool) ($share['perm_' . $who] & $perm);
                }
            }
            $this->insert($sql, $values, null, 'share_id', $share['share_id']);
        }
        foreach (array('user', 'group') as $what) {
            $sql = 'INSERT INTO ansel_sharesng_' . $what . 's (share_id, ' . $what . '_uid';
            $count = 0;
            foreach ($perms as $perm) {
                $sql .= ', perm_' . $perm;
                $count++;
            }
            $sql .= ') VALUES (?, ?' . str_repeat(', ?', $count) . ')';
            foreach ($this->select('SELECT * FROM ansel_shares_' . $what . 's') as $share) {
                $values = array($share['share_id'], $share[$what . '_uid']);
                foreach ($perms as $perm) {
                    $values[] = (bool) ($share['perm'] & $perm);
                }
                $this->insert($sql, $values);
            }
        }
    }
AnselUpgradeSqlng