Exemple #1
0
<?php

include 'DaseClient.php';
ini_set('memory_limit', '700M');
$user = '******';
$pass = DaseClient::promptForPassword($user);
$REPO = '/home/pkeane/sai_videos';
$c = new DaseClient('south_asia', 'php');
$c->setAuth($user, $pass);
foreach ($c->getFilePaths($REPO) as $fp) {
    $link = matcher($fp, $c);
    if (!$link) {
        print $fp . "\n";
    } else {
        $body = file_get_contents($fp);
        $res = DaseClient::put($link, $body, $user, $pass, DaseClient::getMime($fp));
        print_r($res);
    }
}
//write this anew for each job
//accepts a filepath and returns a media-link
function matcher($fp, $client)
{
    $parts = explode('/', $fp);
    $name = array_pop($parts);
    $sernum = DaseClient::makeSerialNumber($name);
    $item = $client->getBySerialNumber($sernum);
    $a = 'edit-media';
    if ($item) {
        return $client->getDaseUrl() . $item->links->{$a} . "\n";
    } else {
<?php

include 'DaseClient.php';
$user = '******';
$pass = DaseClient::getPassword($user);
$old_waller = new DaseClient('waller_creek');
$new_waller = new DaseClient('waller');
$new_waller->setAuth($user, $pass);
$atts = $old_waller->getCollectionAttributesAtom();
foreach (DaseClient::getLinksByRel($atts, 'edit') as $url) {
    $res = DaseClient::get($url);
    if ('200' == $res[0]) {
        $att_atom = $res[1];
        print $new_waller->postAttributeToCollection($att_atom);
        print "\n";
    }
}