public function downloadFromCloud()
    {
        if ($this->owner->CloudStatus === 'Live') {
            $bucket   = $this->owner->getCloudBucket();
            if ($bucket) {
                $contents = $bucket->getContents($this->owner);
                $path     = $this->owner->getFullPath();
                Filesystem::makeFolder(dirname($path));
                CloudAssets::inst()->getLogger()->debug("CloudAssets: downloading $path from cloud (size=".strlen($contents).")");
                // if there was an error and we overwrote the local file with empty or null, it could delete the remote
                // file as well. Better to err on the side of not writing locally when we should than that.
                if (!empty($contents)) {
                    file_put_contents($path, $contents);
                }
            }
        }
    }
public function downloadFromCloud()
    {
        if ($this->owner->CloudStatus === 'Live') {
            $bucket   = $this->owner->getCloudBucket();
            if ($bucket) {
                $contents = $bucket->getContents($this->owner);
                $path     = $this->owner->getFullPath();
                Filesystem::makeFolder(dirname($path));
                CloudAssets::inst()->getLogger()->debug("CloudAssets: downloading $path from cloud (size=".strlen($contents).")");
                // if there was an error and we overwrote the local file with empty or null, it could delete the remote
                // file as well. Better to err on the side of not writing locally when we should than that.
                if (!empty($contents)) {
                    file_put_contents($path, $contents);
                }
            }
        }
    }
public function downloadFromCloud ( ) { if ( $ this -> owner -> CloudStatus === 'Live' ) { $ bucket = $ this -> owner -> getCloudBucket ( ) ; if ( $ bucket ) { $ contents = $ bucket -> getContents ( $ this -> owner ) ; $ path = $ this -> owner -> getFullPath ( ) ; Filesystem :: makeFolder ( dirname ( $ path ) ) ; CloudAssets :: inst ( ) -> getLogger ( ) -> debug ( "CloudAssets: downloading $path from cloud (size=" . strlen ( $ contents ) . ")" ) ; // if there was an error and we overwrote the local file with empty or null, it could delete the remote // file as well. Better to err on the side of not writing locally when we should than that. if ( ! empty ( $ contents ) ) { file_put_contents ( $ path , $ contents ) ; } } } }
If this file is stored in the cloud, downloads the cloud
copy and replaces whatever is local.
If this file is stored in the cloud downloads the cloud copy and replaces whatever is local .