-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.php
More file actions
executable file
·32 lines (26 loc) · 757 Bytes
/
Copy pathmake.php
File metadata and controls
executable file
·32 lines (26 loc) · 757 Bytes
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
#!/usr/bin/env php
<?php
if (PHP_SAPI !== 'cli') {
exit("Run for command line only.\n");
}
if (Phar::canWrite() === false) {
exit("Phar can not write, Set \"phar.readonly = Off\" in php.ini.\n");
}
$pharName = dirname(__DIR__) . '/coscmd.phar';
if (file_exists($pharName)) {
unlink($pharName);
}
$phar = new Phar($pharName);
$phar->startBuffering();
$phar->buildFromDirectory(__DIR__, '/^((?!\.git).)*$/');
$phar->compressFiles(Phar::GZ);
$stub = "#!/usr/bin/env php\n";
$stub .= $phar->createDefaultStub('app.php');
$phar->setStub($stub);
$phar->stopBuffering();
$source = __DIR__ . '/config.php';
$destnation = dirname(__DIR__) . '/config.php';
if (!file_exists($destnation)) {
copy($source, $destnation);
}
chmod($pharName, 0755);