-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildPhar.php
More file actions
executable file
·29 lines (22 loc) · 828 Bytes
/
Copy pathbuildPhar.php
File metadata and controls
executable file
·29 lines (22 loc) · 828 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
#!/usr/bin/env php
<?php
$dir = getcwd();
$path = explode( DIRECTORY_SEPARATOR, $dir );
array_pop( $path );
$path = implode( DIRECTORY_SEPARATOR, $path );
$archive = new Phar( $dir . DIRECTORY_SEPARATOR . 'WebLab.phar', 0, 'WebLab.phar' );
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ) );
$archive->buildFromIterator( $iterator, $path );
$stub = file_get_contents( $dir . DIRECTORY_SEPARATOR . 'Framework.php' );
$stub .= '
try {
Phar::mapPhar( \'WebLab.phar\' );
} catch( Exception $ex ) {
var_dump( $ex );
}
set_include_path( \'phar://WebLab.phar\' . PATH_SEPARATOR . get_include_path() );
__HALT_COMPILER();';
$archive->setStub( $stub );
$archive->setSignatureAlgorithm( Phar::SHA1 );
rename( 'WebLab.phar', '../WebLab.phar' );
echo "Archive build!\n";