semalt-blocker /scripts/compact.php

Language PHP Lines 31
MD5 Hash 3d8fa910c533e918c1560b6b8fc00dda
Repository https://gitlab.com/nabble/semalt-blocker.git View Raw File
 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
<?php
/**
 * Compact semalt-blocker for non-composer installs
 */

require_once('./../vendor/technosophos/PHPCompressor/src/lib/compactor.php');

$source = "./sources.php";
$target = "./../compact/semaltblocker.php";

print "Compacting semalt-blocker";

$compactor = new Compactor($target);

// Use filters like this (Useable for things like stripping debug-only logging):
$compactor->setFilter(function ($in)
{
    $in = str_replace('require "./../vendor/true/punycode/src/Punycode.php";', '', $in);
    $in = str_replace('require "./../src/SemaltBlocker/Domainparser.php";', '', $in);
    $in = str_replace('require "./../src/SemaltBlocker/Updater.php";', '', $in);
    $in = str_replace('require "./../src/SemaltBlocker/Blocker.php";', '', $in);
    $in = str_replace("'./../../domains/blocked'", "'blocked'", $in);
    return $in;
});
$compactor->compactAll($source);

$compactor->report();
$compactor->close();

print "Testing test.php output:" . PHP_EOL;
passthru('php ./../compact/test.php');
Back to Top