Пример #1
0
#unlink('s3dbupdates.rdf');
###
##
#Read all the file from the current directory
if (@in_array('all', $argv) || @in_array('all', array_keys($_REQUEST))) {
    $cwd = getcwd();
    $rootname = dirname($cwd) . '/' . basename($cwd);
    $model = ModelFactory::getDefaultModel();
    $model = buildDirModel($cwd, $model, $rootname, $user_id, $db);
    $model->saveAs("s3dbupdates.rdf", "rdf");
    chmod("s3dbupdates.rdf", 0777);
    #Header("Location: updates.rdf"); =>To uncomment when finished testing
} else {
    ###
    #Read the old file (old is always moved to extras when there is a new one) and compare it with the most recent one
    $updates = findUpdates('extras/s3dbupdates.bak.rdf', 's3dbupdates.rdf');
    #echo '<pre>';print_r($updates);exit;
    ###
    #Create an item for each file, except if it already exists.
    if (is_array($updates)) {
        $model = ModelFactory::getDefaultModel();
        foreach ($updates as $file => $date) {
            if (filesize($file) > 0) {
                echo "updating " . $file . chr(10);
                $file_id = fileUpdate($file, $user_id, $db);
                #recreate the rdf
                $fstat = lstat($file);
                $lastModified = date('Y-m-d H:i:s', $fstat['mtime']);
                $subjResources = new Resource($GLOBALS['s3db_info']['deployment']['URI'] . 's3dbfiles.php?file_id=' . $file_id);
                $statement = new Statement($subjResources, new Resource('http://purl.org/dc/elements/1.1/date'), new Literal($lastModified));
                $path = new Statement($subjResources, new Resource('http://s3db.org/scripts'), new Literal($file));
Пример #2
0
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
   xmlns:owl="http://www.w3.org/2002/07/owl#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:dcterms="http://purl.org/dc/terms/"
   xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
   xmlns:ns1="http://s3db.org/">

</rdf:RDF>';
        file_put_contents(S3DB_SERVER_ROOT . '/s3dbupdates.rdf', $emptyRDF);
    }
    if (!is_file(S3DB_SERVER_ROOT . '/s3dbupdates.rdf')) {
        return formatReturn($GLOBALS['error_codes']['something_does_not_exist'], "Apache was unable to write to S3DB directory. Please make sure all files under " . S3DB_SERVER_ROOT . " have write permission.", '');
        exit;
    }
    $updates = findUpdates(S3DB_SERVER_ROOT . '/s3dbupdates.rdf', $remoteFile);
    #echo '<pre>';print_r($updates);exit;
} else {
    return formatReturn($GLOBALS['error_codes']['something_does_not_exist'], "Mothership update file could not be read. Please try again later.", $_REQUEST['format'], '');
    exit;
}
###
#Follow the link provided by the mothership, stored as value and place it under the correct path, stored as key
if (is_array($updates)) {
    $paths = array_keys($updates);
    $uris = array_values($updates);
    for ($i = 0; $i < count($updates); $i++) {
        $fid = fopen($uris[$i], "r");
        $filedata = stream_get_contents($fid);
        $oldFile = S3DB_SERVER_ROOT . '/' . $paths[$i];
        $bak = S3DB_SERVER_ROOT . '/' . $paths[$i] . date('dmY', time());
Пример #3
0
Created By Helena F Deus (helenadeus@gmail.com) as part of the S3DB package.
15-Apr-2008
*/
ini_set('display_errors', 0);
if ($_REQUEST['su3d']) {
    ini_set('display_errors', 1);
}
if (file_exists('config.inc.php')) {
    include 'config.inc.php';
} else {
    Header('Location: index.php');
    exit;
}
include 'rdfheader.inc.php';
#include_once('core.header.php');
include 's3dbcore/move2s3db.php';
error_reporting(E_COMPILE_ERROR);
ini_set('display_errors', '1');
ini_set('allow_url_fopen', '1');
ini_set('allow_call_time_pass_reference', '1');
###
#Retrieve the new updates.rdf from the mothership
$url2call = $GLOBALS['s3db_info']['deployment']['mothership'] . '/s3dbupdates.rdf';
###
#Read the old file (old is always moved to extras when there is a new one) and compare it with the most recent one
$updates = findUpdates(S3DB_SERVER_ROOT . '/s3dbupdates.rdf', $url2call);
if (is_array($updates)) {
    file_put_contents('tmpUpdates' . date('Ymd'), serialize($updates));
    Header('Location:' . $GLOBALS['action']['home']);
    exit;
}