Write out the published version of the page to the filesystem.

@return true if the page write was successful
427069
public function writeStaticPage()
    {
        if (!self::config()->enable_static_file) {
            return false;
        }

        // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
        $originalThemes = SSViewer::get_themes();
        try {
            // Restore front-end themes from config
            $themes = SSViewer::config()->get('themes') ?: $originalThemes;
            SSViewer::set_themes($themes);

            // Render page as non-member in live mode
            $response = Member::actAs(null, function () {
                $response = Director::test(Director::makeRelative($this->getAbsoluteLiveLink()));
                return $response;
            });

            $errorContent = $response->getBody();
        } finally {
            // Restore themes
            SSViewer::set_themes($originalThemes);
        }

        // Make sure we have content to save
        if ($errorContent) {
            // Store file content in the default store
            $storeFilename = File::join_paths(
                self::config()->store_filepath,
                $this->getErrorFilename()
            );
            self::get_asset_handler()->setContent($storeFilename, $errorContent);

            return true;
        } else {
            return false;
        }
    }
1052649
public function canWrite()
    {
        $ht = $this->getHTaccessFilename();
        $fs = $this->getFilesystem();

        return (bool) (@$fs->isFile($ht) ? @$fs->isWritable($ht) : @$fs->isWritable(@dirname($ht)));
    }
942513
public void write() {
        logger.info("writing " + users.size() + " users in " + userfilename);
        try {
            Backup.backup(userfilename);
        } catch (IOException e) {
            logger.error("Problem backing up old copy of user file", e);
        }
        try (FileOutputStream fstream = new FileOutputStream(userfilename);
                BufferedOutputStream bstream = new BufferedOutputStream(
                        fstream)) {
            writeTheLines(bstream);
        } catch (IOException e) {
            logger.error("Problem writing user file", e);
        }
    }
426975
public boolean canWrite() throws SftpStatusException, SshException {
		// This is long hand because gcj chokes when it is not? Investigate why
		if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IWUSR) == SftpFileAttributes.S_IWUSR
				|| (getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IWGRP) == SftpFileAttributes.S_IWGRP
				|| (getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IWOTH) == SftpFileAttributes.S_IWOTH) {
			return true;
		}
		return false;
	}
661021
public function write()
    {
        $filename = $this->isFileWritable() ? $this->filename : $this->getCacheFilename();

        return file_put_contents($filename, $this->render());
    }
1240243
public void write() {
        try {
            File prefFile = new File(SystemProperties.getProperty("user.home"), PREF_FILE_NAME);
            write(new FileOutputStream(prefFile));
        } catch (IOException e) {
            if (FindBugs.DEBUG) {
                e.printStackTrace(); // Ignore
            }
        }
    }
1038533
public function publishPage()
    {
        $look = true;
        $parent = $this;
        while($look)
        {
            if ($parent = $parent->getHolder())
            {
                if (is_a($parent, SiteTree::class))
                {
                    $look = false;
                }
            } else {
                $look = false;
            }
        }

        if ($parent->doPublish())
        {
            return _t(__CLASS__ . '.PageAndElementsPublished', 'Page & elements published');
        }
        return _t(__CLASS__ . '.PageAndElementsPublishError', 'There was an error publishing the page');
    }
1222798
public function write()
	{
		// do we have something to write?
		if ( ! empty($this->keys) or ! empty($this->data) or ! empty($this->flash))
		{
			parent::write();

			// rotate the session id if needed
			$this->rotate(false);

			// record the last update time of the session
			$this->keys['updated'] = $this->time->get_timestamp();

			// session payload
			$payload = $this->_serialize(array($this->keys, $this->data, $this->flash));

			// create the session file
			$this->_write_memcached($this->keys['session_id'], $payload);

			// was the session id rotated?
			if ( isset($this->keys['previous_id']) and $this->keys['previous_id'] != $this->keys['session_id'])
			{
				// point the old session file to the new one, we don't want to lose the session
				$payload = $this->_serialize(array('rotated_session_id' => $this->keys['session_id']));
				$this->_write_memcached($this->keys['previous_id'], $payload);
			}

			$this->_set_cookie(array($this->keys['session_id']));
		}

		return $this;
	}
1290460
public boolean canWrite()
    {
        if ( ! _strutsConfigFile.canWrite() )
        {
            return false;
        }
        
        try
        {
            //
            // This appears to be the only way to predict whether the file can actually be
            // written to; it may be that canWrite() returns true, but the file permissions
            // (NTFS only?) will cause an exception to be thrown.
            //
            new FileOutputStream( _strutsConfigFile, true ).close();
        }
        catch ( FileNotFoundException e )
        {
            return false;
        }
        catch ( IOException e )
        {
            return false;
        }
        
        return true;
    }
703534
@InService(TableWriterService.class)
  public void writeBlobPage(PageBlob page,
                               int saveSequence,
                               Result<Integer> result)
  {
    SegmentStream sOut = getBlobStream();
    
    int saveLength = 0;
    int saveTail = 0;
    
    if (_blobSizeMax < page.getLength()) {
      _blobSizeMax = page.getLength();
      calculateSegmentSize();
    }
    
    sOut.writePage(this, page, saveLength, saveTail, saveSequence, result);
    
    _isBlobDirty = true;
  }
996790
def regenerateToOutputFile(outFile, checkNoChanges = false)
      executeRubyComponents
      @pageObject.process
      writeRegeneratedFile(outFile, checkNoChanges, checkNoChanges)
    end
52715
public function onAfterRevertToLive()
    {
        // Use an alias to get the updates made by $this->publish
        /** @var SiteTree $stageSelf */
        $stageSelf = Versioned::get_by_stage(self::class, Versioned::DRAFT)->byID($this->ID);
        $stageSelf->writeWithoutVersion();

        // Need to update pages linking to this one as no longer broken
        foreach ($stageSelf->DependentPages() as $page) {
            /** @var SiteTree $page */
            $page->writeWithoutVersion();
        }
    }
721080
public function onAfterWrite()
    {
        $changed = $this->owner->getChangedFields(true, 2);

        if (!$this->owner instanceof Folder && !$this->owner->CurrentVersionID) {
            $this->createVersion();
        }

        if (array_key_exists('Filename', $changed)) {
            if ($changed['Filename']['before'] == null) {
                return;
            }

            $oldDirname = '/' . trim(dirname($changed['Filename']['before']), '/');
            $newDirname = '/' . trim(dirname($changed['Filename']['after']), '/');

            if ($oldDirname == $newDirname) {
                return;
            }

            // First move the _versions directory across.
            $versionsDir = FileVersion::VERSION_FOLDER . '/' . $this->owner->ID;
            $oldVersions = BASE_PATH . $oldDirname . '/' . $versionsDir;
            $newVersions = BASE_PATH . $newDirname . '/' . $versionsDir;

            if (is_dir($oldVersions)) {
                if (!is_dir($newVersions)) {
                    mkdir($newVersions, Config::inst()->get('Filesystem', 'folder_create_mask'), true);
                }

                if (!is_dir($newVersions)) {
                    rename($oldVersions, $newVersions);
                }
            }

            // Then update individual version records to point to the new
            // location.
            foreach ($this->owner->Versions() as $version) {
                if (strpos($version->Filename, $oldDirname) === 0) {
                    $version->Filename = $newDirname . substr($version->Filename, strlen($oldDirname));
                    $version->write();
                }
            }
        }
    }
430814
public function isPublished()
    {
        $id = $this->owner->ID ?: $this->owner->OldID;
        if (!$id) {
            return false;
        }

        // Non-staged objects are considered "published" if saved
        if (!$this->hasStages()) {
            return true;
        }

        $liveVersion = static::get_versionnumber_by_stage($this->owner, Versioned::LIVE, $id);
        return (bool)$liveVersion;
    }
1164337
protected void writeVersion(WritableByteChannel channel) throws IOException {
        ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH);
        version.putInt(STORAGE_VERSION);
        version.flip();
        channel.write(version);
    }
1349227
@Override
	public boolean hasNext() {
		if (isLoopExitCondition()) {
			return false;
		}
		for (;;) {
			if (workingDirectory.files.length == 0) {
				pop();
			}
			if (isLoopExitCondition()) {
				return false;
			}
			workingDirectory.currentFile = workingDirectory.files[workingDirectory.index++];
			if (!workingDirectory.currentFile.isDirectory()) {
				break;
			}
			push(workingDirectory.currentFile);
		}
		return true;
	}
1298333
private function write()
    {
        $cache = serialize($this->records);
        flock($this->file, LOCK_EX);
        rewind($this->file);
        ftruncate($this->file, 0);
        $bytes = fwrite($this->file, $cache);
        flock($this->file, LOCK_UN);

        return $bytes === strlen($cache);
    }