public function onAppDownloadedMergeBinRun(Downloaded $event)
    {
        // remove startup files
        $this->fs->remove([
            $this->root_dir.'bin/AnimeDB_Run.vbs',
            $this->root_dir.'bin/AnimeDB_Stop.vbs',
            $this->root_dir.'AnimeDB_Run.vbs',
            $this->root_dir.'AnimeDB_Stop.vbs',
        ]);

        if (defined('PHP_WINDOWS_VERSION_BUILD')) {
            // application has not yet has the monitor
            if (!$this->fs->exists($this->root_dir.'/config.ini')) {
                $monitor = sys_get_temp_dir().'/'.basename($this->monitor);
                // download monitor if need
                if (!$this->fs->exists($monitor)) {
                    $this->fs->copy($this->monitor, $monitor);
                }
                // unzip
                if ($this->zip->open($monitor) !== true) {
                    throw new \RuntimeException('Failed unzip monitor');
                }
                $this->zip->extractTo($event->getPath());
                $this->zip->close();
            }

            // copy params if need
            $old_file = $this->root_dir.'/config.ini';
            $new_file = $event->getPath().'/config.ini';
            if ($this->fs->exists($new_file) && $this->fs->exists($old_file) &&
                is_readable($new_file) &&
                md5_file($old_file) != md5_file($new_file)
            ) {
                $old_body = file_get_contents($old_file);
                $new_body = $tmp_body = file_get_contents($new_file);

                $new_body = $this->copyParam($old_body, $new_body, 'addr=%s'.PHP_EOL, self::DEFAULT_ADDRESS);
                $new_body = $this->copyParam($old_body, $new_body, 'port=%s'.PHP_EOL, self::DEFAULT_PORT);
                $new_body = $this->copyParam($old_body, $new_body, 'php=%s'.PHP_EOL, self::DEFAULT_PHP);

                if ($new_body != $tmp_body) {
                    file_put_contents($new_file, $new_body);
                }
            }
        }
    }
public function onAppDownloadedMergeBinRun(Downloaded $event)
    {
        // remove startup files
        $this->fs->remove([
            $this->root_dir.'bin/AnimeDB_Run.vbs',
            $this->root_dir.'bin/AnimeDB_Stop.vbs',
            $this->root_dir.'AnimeDB_Run.vbs',
            $this->root_dir.'AnimeDB_Stop.vbs',
        ]);

        if (defined('PHP_WINDOWS_VERSION_BUILD')) {
            // application has not yet has the monitor
            if (!$this->fs->exists($this->root_dir.'/config.ini')) {
                $monitor = sys_get_temp_dir().'/'.basename($this->monitor);
                // download monitor if need
                if (!$this->fs->exists($monitor)) {
                    $this->fs->copy($this->monitor, $monitor);
                }
                // unzip
                if ($this->zip->open($monitor) !== true) {
                    throw new \RuntimeException('Failed unzip monitor');
                }
                $this->zip->extractTo($event->getPath());
                $this->zip->close();
            }

            // copy params if need
            $old_file = $this->root_dir.'/config.ini';
            $new_file = $event->getPath().'/config.ini';
            if ($this->fs->exists($new_file) && $this->fs->exists($old_file) &&
                is_readable($new_file) &&
                md5_file($old_file) != md5_file($new_file)
            ) {
                $old_body = file_get_contents($old_file);
                $new_body = $tmp_body = file_get_contents($new_file);

                $new_body = $this->copyParam($old_body, $new_body, 'addr=%s'.PHP_EOL, self::DEFAULT_ADDRESS);
                $new_body = $this->copyParam($old_body, $new_body, 'port=%s'.PHP_EOL, self::DEFAULT_PORT);
                $new_body = $this->copyParam($old_body, $new_body, 'php=%s'.PHP_EOL, self::DEFAULT_PHP);

                if ($new_body != $tmp_body) {
                    file_put_contents($new_file, $new_body);
                }
            }
        }
    }
public function onAppDownloadedMergeBinRun ( Downloaded $ event ) { // remove startup files $ this -> fs -> remove ( [ $ this -> root_dir . 'bin/AnimeDB_Run.vbs' , $ this -> root_dir . 'bin/AnimeDB_Stop.vbs' , $ this -> root_dir . 'AnimeDB_Run.vbs' , $ this -> root_dir . 'AnimeDB_Stop.vbs' , ] ) ; if ( defined ( 'PHP_WINDOWS_VERSION_BUILD' ) ) { // application has not yet has the monitor if ( ! $ this -> fs -> exists ( $ this -> root_dir . '/config.ini' ) ) { $ monitor = sys_get_temp_dir ( ) . '/' . basename ( $ this -> monitor ) ; // download monitor if need if ( ! $ this -> fs -> exists ( $ monitor ) ) { $ this -> fs -> copy ( $ this -> monitor , $ monitor ) ; } // unzip if ( $ this -> zip -> open ( $ monitor ) !== true ) { throw new \ RuntimeException ( 'Failed unzip monitor' ) ; } $ this -> zip -> extractTo ( $ event -> getPath ( ) ) ; $ this -> zip -> close ( ) ; } // copy params if need $ old_file = $ this -> root_dir . '/config.ini' ; $ new_file = $ event -> getPath ( ) . '/config.ini' ; if ( $ this -> fs -> exists ( $ new_file ) && $ this -> fs -> exists ( $ old_file ) && is_readable ( $ new_file ) && md5_file ( $ old_file ) != md5_file ( $ new_file ) ) { $ old_body = file_get_contents ( $ old_file ) ; $ new_body = $ tmp_body = file_get_contents ( $ new_file ) ; $ new_body = $ this -> copyParam ( $ old_body , $ new_body , 'addr=%s' . PHP_EOL , self :: DEFAULT_ADDRESS ) ; $ new_body = $ this -> copyParam ( $ old_body , $ new_body , 'port=%s' . PHP_EOL , self :: DEFAULT_PORT ) ; $ new_body = $ this -> copyParam ( $ old_body , $ new_body , 'php=%s' . PHP_EOL , self :: DEFAULT_PHP ) ; if ( $ new_body != $ tmp_body ) { file_put_contents ( $ new_file , $ new_body ) ; } } } }
Merge bin AnimeDB_Run.vbs commands.

@param Downloaded $event
Merge bin AnimeDB_Run . vbs commands .