Airship\Engine\Continuum\Updaters\Cabin::replaceFile PHP Method

replaceFile() protected method

Unique to cabin updating; replace a file with one in the archive
protected replaceFile ( string $filename ) : integer | boolean
$filename string
return integer | boolean
    protected function replaceFile(string $filename)
    {
        $supplier = $this->supplier->getName();
        $pieces = [ROOT, 'Cabin', $supplier, $this->name];
        $cabinRoot = \implode(DIRECTORY_SEPARATOR, $pieces);
        if (\file_exists($cabinRoot . DIRECTORY_SEPARATOR . $filename . '.backup')) {
            \unlink($cabinRoot . DIRECTORY_SEPARATOR . $filename . '.backup');
        }
        \rename($cabinRoot . DIRECTORY_SEPARATOR . $filename, $cabinRoot . DIRECTORY_SEPARATOR . $filename . '.backup');
        return \file_put_contents($cabinRoot . DIRECTORY_SEPARATOR . $filename, \file_get_contents('phar://' . $this->pharAlias . '/' . $filename));
    }