summaryrefslogtreecommitdiff
path: root/lib/images/fileicons/generate.php
blob: 2dd25eb3375c8f3655cc3981e2639d18778ed574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

// this is not provided by DokuWiki and needs to checked out separately from
// https://github.com/splitbrain/file-icon-generator
require '/home/andi/projects/fileiconbuilder/FileIconBuilder.php';

if('cli' != php_sapi_name()) die('This has to be run from command line');
if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__).'/../../../').'/');
define('NOSESSION', 1);
require_once(DOKU_INC.'inc/init.php');


/**
 * Class DokuFileIconBuilder
 *
 * overwrite mime type loading with loading DokuWiki's mime type config instead
 */
class DokuFileIconBuilder extends FileIconBuilder {

    protected function loadmimetypes(){
        $this->mimetypes = getMimeTypes();
        foreach(array_keys($this->mimetypes) as $ext) {
            $this->mimetypes[$ext] = ltrim($this->mimetypes[$ext], '!');
        }
    }
}


echo "Important: you should enable the commented file types in mime.conf to make sure the icon are generated!\n";

// generate all the icons
$DFIB = new DokuFileIconBuilder();
$DFIB->createAll(__DIR__);

echo "generation done\n";