Overview
Comment:Supprimer les fichiers liés à la page wiki
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7656a528352f0ca48a5d9ade9f30a6f8ffcf025f
User & Date: bohwaz on 2015-04-16 15:32:13
Other Links: manifest | tags
Context
2015-04-16
15:35
correction changement de classe à sélection globale check-in: 90733f068b user: bohwaz tags: trunk
15:32
Supprimer les fichiers liés à la page wiki check-in: 7656a52835 user: bohwaz tags: trunk
12:16
Correction pour quand il n'y a aucun exercice ouvert en base check-in: d4816ac9d7 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Wiki.php from [21f2ef0119] to [00f08559c4].

157
158
159
160
161
162
163









164
165
166
167
168

169
170
171
172
173
174
175
    {
        $db = DB::getInstance();

        if ($db->simpleQuerySingle('SELECT COUNT(*) FROM wiki_pages WHERE parent = ?;', false, (int)$id))
        {
            return false;
        }










        $db->simpleExec('DELETE FROM wiki_revisions WHERE id_page = ?;', (int)$id);
        //$db->simpleExec('DELETE FROM wiki_suivi WHERE id_page = ?;', (int)$id); FIXME
        $db->simpleExec('DELETE FROM wiki_recherche WHERE id = ?;', (int)$id);
        $db->simpleExec('DELETE FROM wiki_pages WHERE id = ?;', (int)$id);

        return true;
    }

    public function get($id)
    {
        $db = DB::getInstance();
        return $db->simpleQuerySingle('SELECT *,







>
>
>
>
>
>
>
>
>





>







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    {
        $db = DB::getInstance();

        if ($db->simpleQuerySingle('SELECT COUNT(*) FROM wiki_pages WHERE parent = ?;', false, (int)$id))
        {
            return false;
        }

        // Suppression des fichiers liés
        $files = Fichiers::listLinkedFiles(Fichiers::LIEN_WIKI, $id, null);

        foreach ($files as $file)
        {
            $file = new Fichiers($file['id'], $file);
            $file->remove();
        }

        $db->simpleExec('DELETE FROM wiki_revisions WHERE id_page = ?;', (int)$id);
        //$db->simpleExec('DELETE FROM wiki_suivi WHERE id_page = ?;', (int)$id); FIXME
        $db->simpleExec('DELETE FROM wiki_recherche WHERE id = ?;', (int)$id);
        $db->simpleExec('DELETE FROM wiki_pages WHERE id = ?;', (int)$id);

        return true;
    }

    public function get($id)
    {
        $db = DB::getInstance();
        return $db->simpleQuerySingle('SELECT *,