Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: versions/versions.php

Class Versions - The database abstraction layer for versions

Versions is the storage module that is aiming to implement version control and WiKi within YACS.

One version is a textual object used as a snapshot of an article, category, or section. Anchors are used to reference versioned item (i.e., 'article:123' or 'section:314'). Also, each version has a date of creation, and reference the surfer who generates it.

Basically, YACS maintains a stack of versions. New versions are pushed on the top of the stack. When necessary, an old version may be popped from the stack.

A version may be created on item change, like in the following example:

// save article content before change, and link it to last editor
Versions::save($article'article:123');

// update the article
Articles::put($new_content);


The list of versions related to one item may be retrieved as follows:
// retrieve the list of versions
Versions::list_for_anchor($anchor);


On revert back to a previous version, this version and most recent versions are suppressed from the database:
// restore a past version
Versions::restore($id);


It is also possible to prune one version, and remove older versions as well:
// clean oldies up to a given version
Versions::prune($id);


This script is a reference file of this system.

Licence: GNU Lesser General Public License

Auteurs:

delete_for_anchor() - Delete all versions for a given anchor

function delete_for_anchor($anchor)

get() - Get one version by id

function &get($id)

Unserialize $item['content'] to actually retrieve version content.

get_url() - Get the url to view a version

function get_url($id, $action='view')

By default, a relative URL will be provided (e.g. 'versions/view.php?id=512'), which may be not processed correctly by search engines. If the parameter 'with_friendly_urls' has been set to 'Y' in the configuration panel, this function will return an URL parsable by search engines (e.g. 'versions/view.php/512').

Voir aussi:

list_by_date() - List most recent versions

function &list_by_date($offset=0, $count=10, $variant='full')

Actually list versions by date.

Voir aussi:

list_by_date_for_anchor() - List most recent versions for one anchor

function &list_by_date_for_anchor($anchor, $offset=0, $count=10, $variant=NULL, $capability='?')



Voir aussi:

list_selected() - List selected versions

function &list_selected(&$result, $layout='compact', $capability='?')

Accept following layouts:

restore() - Restore an old version

function restore($id)

This function returns the content of a previous version, and also purges the stack of previous versions.

This function also remember any error in $context['error']

save() - Remember a previous version a new version

function save($fields, $anchor)

On error this function adds a string to $context['error'].

Voir aussi:

setup() - Create tables for versions

function setup()

stat_for_anchor() - Get some statistics for one anchor

function &stat_for_anchor($anchor)



Voir aussi:

Tools
Browse the source of this script
Server software