<?php
//namespace Util;
//use DirectoryIterator;
class PostInstall {
static function install( $paths )
{
$files = self :: getAllFiles ( $paths ) ;
}
static function getAllFiles( $paths )
{
$result = [ ] ;
foreach ( $paths as $libName => $path ) {
$files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path , RecursiveDirectoryIterator:: SKIP_DOTS ) ) ;
foreach ( $files as $name => $object ) {
if ( ! empty ( $files -> getSubPath ( ) ) ) { $folder = $libName . "/" . $files -> getSubPath ( ) ;
} else {
$folder = $libName ;
}
$result [ $folder ] [ ] = $name ;
}
}
return $result ;
}
static
function copy ( $files ) {
foreach ( $files as $libFolder => $libFiles )
{
$path = __DIR__ . "/../public/media/{$libFolder} " ;
mkdir ( $path , 0700 , true ) ; }
foreach ( $libFiles as $file ) {
}
}
}
}
$paths = [
'videojs' => __DIR__ . '/../vendor/videojs/video.js/dist' ,
'bootstrap' => __DIR__ . '/../vendor/twbs/bootstrap/dist'
] ;
PostInstall:: install ( $paths ) ;
PD9waHAKCi8vbmFtZXNwYWNlIFV0aWw7Ci8vdXNlIERpcmVjdG9yeUl0ZXJhdG9yOwoKY2xhc3MgUG9zdEluc3RhbGwgewoKICAgIHN0YXRpYyBmdW5jdGlvbiBpbnN0YWxsKCRwYXRocykKICAgIHsKICAgICAgICAkZmlsZXMgPSBzZWxmOjpnZXRBbGxGaWxlcygkcGF0aHMpOwogICAgICAgIHNlbGY6OmNvcHkoJGZpbGVzKTsKICAgIH0KCiAgICBzdGF0aWMgZnVuY3Rpb24gZ2V0QWxsRmlsZXMoJHBhdGhzKQogICAgewogICAgICAgICRyZXN1bHQgPSBbXTsKICAgICAgICBmb3JlYWNoICgkcGF0aHMgYXMgJGxpYk5hbWUgPT4gJHBhdGgpIHsKICAgICAgICAgICAgJGZpbGVzID0gbmV3IFJlY3Vyc2l2ZUl0ZXJhdG9ySXRlcmF0b3IobmV3IFJlY3Vyc2l2ZURpcmVjdG9yeUl0ZXJhdG9yKCRwYXRoLCBSZWN1cnNpdmVEaXJlY3RvcnlJdGVyYXRvcjo6U0tJUF9ET1RTKSk7CiAgICAgICAgICAgIGZvcmVhY2goJGZpbGVzIGFzICRuYW1lID0+ICRvYmplY3QpIHsKICAgICAgICAgICAgICAgIGlmICghZW1wdHkoJGZpbGVzLT5nZXRTdWJQYXRoKCkpKSB7CiAgICAgICAgICAgICAgICAgICAgJGZvbGRlciA9ICRsaWJOYW1lIC4gIi8iIC4gJGZpbGVzLT5nZXRTdWJQYXRoKCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICRmb2xkZXIgPSAkbGliTmFtZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICRyZXN1bHRbJGZvbGRlcl1bXSA9ICRuYW1lOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAkcmVzdWx0OwogICAgfQoKICAgIHN0YXRpYyBmdW5jdGlvbiBjb3B5KCRmaWxlcykKICAgIHsKICAgICAgICBmb3JlYWNoICgkZmlsZXMgYXMgJGxpYkZvbGRlciA9PiAkbGliRmlsZXMpCiAgICAgICAgewogICAgICAgICAgICAkcGF0aCA9IF9fRElSX18gLiAiLy4uL3B1YmxpYy9tZWRpYS97JGxpYkZvbGRlcn0iOwogICAgICAgICAgICBpZiAoIWlzX2RpcigkcGF0aCkpIHsKICAgICAgICAgICAgICAgIG1rZGlyKCRwYXRoLCAwNzAwLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmb3JlYWNoICgkbGliRmlsZXMgYXMgJGZpbGUpIHsKICAgICAgICAgICAgICAgIGNvcHkoJGZpbGUsICRwYXRoIC4gIi8iIC4gYmFzZW5hbWUoJGZpbGUpKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQoKJHBhdGhzID0gWwogICAgJ3ZpZGVvanMnICAgPT4gX19ESVJfXyAuICcvLi4vdmVuZG9yL3ZpZGVvanMvdmlkZW8uanMvZGlzdCcsCiAgICAnYm9vdHN0cmFwJyA9PiBfX0RJUl9fIC4gJy8uLi92ZW5kb3IvdHdicy9ib290c3RyYXAvZGlzdCcKXTsKClBvc3RJbnN0YWxsOjppbnN0YWxsKCRwYXRocyk7Cg==