Skip to content

Storage Configuration

Lukas Rosenstock edited this page Jan 31, 2016 · 1 revision

In order to archive your posts onto the filesystem, add the following configuration to your plugins in config.php:

'plugins' => array(
	array(
		'class' => 'PhpADNSite\Plugins\ArchivePlugin',
		'config' => array(
			'storage_class' => 'PhpADNSite\PostStorages\FileSystemStorage',
			'storage_config' => array(
				'date_path' => 'Y/m/d'
			)
		)
	),
	// other plugins here ...
),

For date_path you can use anything you can use in PHP's date format functions. This defines the path into which the posts are separated. You can also add base_path to define the base directory for archiving your posts.

It's recommended to add this plugin first and other plugins behind it to make sure all content is archived.

Once you want to switch your site to static mode, i.e. serving posts from the archive instead of the API, change the backend configuration in config.php:

'backend' => array(
	'class' => 'PhpADNSite\Core\StorageClient',
	'config' => array(
		'storage_class' => 'PhpADNSite\PostStorages\FileSystemStorage',
		'storage_config' => array()
	)
)

You should add the same storage_config that you used for archiving. Also remember to remove the ArchivePlugin when using StorageClient!

Clone this wiki locally