/** Write blob version of $obj. Returns path written to or false if write was not needed. */
static function write_content(GBContent $obj)
{
# build blob
$blob = $obj->toBlob();
# build destination path
$dstpath = gb::$site_dir . '/' . $obj->name;
# assure destination dir is prepared
$dstpathdir = dirname($dstpath);
if (!is_dir($dstpathdir)) {
self::mkdirs($dstpathdir);
}
# write
file_put_contents($dstpath, $blob, LOCK_EX);
@chmod($dstpath, 0664);
return $dstpath;
}