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; }
gb::log('did force html'); } else { gb::log('mime type is %s', $post->mimeType); } if (!$post->published) { $post->published = $post->modified; } $post->name = $post->recommendedName(); } else { gb::log('already exists (OK)'); } # was the state actually modified? if ($modified_state) { gb::log('write %s', r($modified_state)); # write to work area gb_admin::write_content($post); } # if the post was created, reload it to find appropriate values if ($created) { $post = GBPost::findByName($post->name, 'work'); $modified_state = array(); foreach ($state_fields as $k => $discard) { if ($k === 'body') { $modified_state[$k] = $post->rawBody(); } else { $v = $post->{$k}; if ($v instanceof GBDateTime) { $v = strval($v); } $modified_state[$k] = $v; }