-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.php
47 lines (38 loc) · 1.09 KB
/
package.php
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
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env php
<?php
/**
* This creates a PHAR archive of the Common-Inbox.
*
* @author Peter Bubestinger-Steindl
* @copyright
* Copyright 2017, Peter Bubestinger-Steindl
* (License: <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License (v3)</a>)
*
* @see
* - <a href="http://php.net/manual/en/book.phar.php">Official PHAR (=<b>PH</b>p <b>AR</b>chive): Documentation</a>
*/
$setting = 'phar.readonly';
if (ini_get($setting) == true)
{
printf("\nCannot create PHAR: You must configure '%s = 0' in your php.ini first!\n", $setting);
die(1);
}
try
{
printf("Creating PHAR archive...\n");
$target = 'cinbox.phar';
$targetCompressed = $target . '.gz';
$alias = basename($target);
$p = new Phar($target, 0, $alias);
if (file_exists($targetCompressed)) unlink($targetCompressed);
$p2 = $p->compress(Phar::GZ);
$p2->buildFromDirectory('.', '/src|locale/');
$p2->setStub(
$p->createDefaultStub('src/cinbox.php', 'src/cinbox.php')
);
}
catch (Exception $e)
{
printf("Error:\n%s\n", $e->getMessage());
}
?>