Possible fix for #2100 - scheduler user is not created. There is now a more verbose output when this step is taken, and also there were previous steps, that if they failed, would prevent this step from happening; so this has been fixed as well. Converted more functions to static functions because thats what they were in the first place...they were just pretending to be member functions.
This commit is contained in:
parent
a3db3c3865
commit
425212bfb8
|
@ -24,19 +24,6 @@ define('ALIBERR_BADSMEMB', 21);
|
||||||
class Subjects {
|
class Subjects {
|
||||||
//class Subjects extends ObjClasses {
|
//class Subjects extends ObjClasses {
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param object $dbc
|
|
||||||
* @param array $config
|
|
||||||
* @return this
|
|
||||||
*/
|
|
||||||
// public function __construct(&$dbc, $config)
|
|
||||||
// {
|
|
||||||
// parent::__construct($dbc, $config);
|
|
||||||
// } // constructor
|
|
||||||
|
|
||||||
|
|
||||||
/* ======================================================= public methods */
|
/* ======================================================= public methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +66,6 @@ class Subjects {
|
||||||
*
|
*
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* optional, default: null
|
|
||||||
* @return boolean|PEAR_Error
|
* @return boolean|PEAR_Error
|
||||||
*/
|
*/
|
||||||
public static function RemoveSubj($login, $uid=NULL)
|
public static function RemoveSubj($login, $uid=NULL)
|
||||||
|
@ -533,7 +519,7 @@ class Subjects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $mid;
|
return $mid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -574,7 +560,7 @@ class Subjects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$r = $CC_DBC->query("COMMIT");
|
$r = $CC_DBC->query("COMMIT");
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -681,56 +667,5 @@ class Subjects {
|
||||||
}
|
}
|
||||||
} // fn test
|
} // fn test
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create tables + initialize
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
// public function install()
|
|
||||||
// {
|
|
||||||
// parent::install();
|
|
||||||
// $CC_DBC->query("CREATE TABLE {$this->subjTable} (
|
|
||||||
// id int not null PRIMARY KEY,
|
|
||||||
// login varchar(255) not null default'',
|
|
||||||
// pass varchar(255) not null default'',
|
|
||||||
// type char(1) not null default 'U',
|
|
||||||
// realname varchar(255) not null default'',
|
|
||||||
// lastlogin timestamp,
|
|
||||||
// lastfail timestamp
|
|
||||||
// )");
|
|
||||||
// $CC_DBC->query("CREATE UNIQUE INDEX {$this->subjTable}_id_idx
|
|
||||||
// ON {$this->subjTable} (id)");
|
|
||||||
// $CC_DBC->query("CREATE UNIQUE INDEX {$this->subjTable}_login_idx
|
|
||||||
// ON {$this->subjTable} (login)");
|
|
||||||
// $CC_DBC->createSequence("{$this->subjTable}_id_seq");
|
|
||||||
//
|
|
||||||
// $CC_DBC->query("CREATE TABLE {$this->smembTable} (
|
|
||||||
// id int not null PRIMARY KEY,
|
|
||||||
// uid int not null default 0,
|
|
||||||
// gid int not null default 0,
|
|
||||||
// level int not null default 0,
|
|
||||||
// mid int
|
|
||||||
// )");
|
|
||||||
// $CC_DBC->query("CREATE UNIQUE INDEX {$this->smembTable}_id_idx
|
|
||||||
// ON {$this->smembTable} (id)");
|
|
||||||
// $CC_DBC->createSequence("{$this->smembTable}_id_seq");
|
|
||||||
// } // fn install
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Drop tables etc.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
// public function uninstall()
|
|
||||||
// {
|
|
||||||
// global $CC_CONFIG, $CC_DBC;
|
|
||||||
// $CC_DBC->query("DROP TABLE ".$CC_CONFIG['subjTable']);
|
|
||||||
// $CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id_seq");
|
|
||||||
// $CC_DBC->query("DROP TABLE ".$CC_CONFIG['smembTable']);
|
|
||||||
// $CC_DBC->dropSequence($CC_CONFIG['smembTable']."_id_seq");
|
|
||||||
// parent::uninstall();
|
|
||||||
// } // fn uninstall
|
|
||||||
|
|
||||||
} // class Subjects
|
} // class Subjects
|
||||||
?>
|
?>
|
|
@ -142,7 +142,7 @@ class Archive extends XR_LocStor {
|
||||||
$realfile = tempnam($this->accessDir, 'searchjob_');
|
$realfile = tempnam($this->accessDir, 'searchjob_');
|
||||||
@chmod($realfile, 0660);
|
@chmod($realfile, 0660);
|
||||||
$len = file_put_contents($realfile, serialize($results));
|
$len = file_put_contents($realfile, serialize($results));
|
||||||
$acc = $this->bsAccess($realfile, '', NULL, 'download');
|
$acc = BasicStor::bsAccess($realfile, '', NULL, 'download');
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class Archive extends XR_LocStor {
|
||||||
}
|
}
|
||||||
$fname = "transported_playlist.lspl";
|
$fname = "transported_playlist.lspl";
|
||||||
$id = BasicStor::IdFromGunid($gunid);
|
$id = BasicStor::IdFromGunid($gunid);
|
||||||
$acc = $this->bsAccess($plfpath, 'lspl', NULL, 'download');
|
$acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download');
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ class Archive extends XR_LocStor {
|
||||||
$res = $this->releasePlaylist(NULL/*$sessid*/, $token);
|
$res = $this->releasePlaylist(NULL/*$sessid*/, $token);
|
||||||
return $res;
|
return $res;
|
||||||
case "playlistPkg":
|
case "playlistPkg":
|
||||||
$res = $this->bsRelease($token, 'download');
|
$res = BasicStor::bsRelease($token, 'download');
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ class Archive extends XR_LocStor {
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
case "searchjob":
|
case "searchjob":
|
||||||
$res = $this->bsRelease($token, 'download');
|
$res = BasicStor::bsRelease($token, 'download');
|
||||||
return $res;
|
return $res;
|
||||||
case "file":
|
case "file":
|
||||||
return array();
|
return array();
|
||||||
|
|
|
@ -56,9 +56,13 @@ if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['token'])) {
|
||||||
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
||||||
}
|
}
|
||||||
|
|
||||||
$tc = $gb->bsCheckToken($token, 'put');
|
$tc = BasicStor::bsCheckToken($token, 'put');
|
||||||
if(PEAR::isError($tc)){ http_error(500, $ex->getMessage()); }
|
if (PEAR::isError($tc)) {
|
||||||
if(!$tc){ http_error(403, "put.php: Token not valid ($token)."); }
|
http_error(500, $ex->getMessage());
|
||||||
|
}
|
||||||
|
if (!$tc) {
|
||||||
|
http_error(403, "put.php: Token not valid ($token).");
|
||||||
|
}
|
||||||
|
|
||||||
header("Content-type: text/plain");
|
header("Content-type: text/plain");
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @author $Author$
|
* Mass import of audio files.
|
||||||
|
*
|
||||||
|
* @author Tomas Hlava <th@red2head.com>
|
||||||
|
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
|
* @package Campcaster
|
||||||
|
* @subpackage StorageAdmin
|
||||||
|
* @copyright 2006 MDLF, Inc.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
|
* @link http://www.campware.org
|
||||||
*/
|
*/
|
||||||
ini_set('memory_limit', '64M');
|
ini_set('memory_limit', '64M');
|
||||||
set_time_limit(30);
|
set_time_limit(0);
|
||||||
header("Content-type: text/plain");
|
//header("Content-type: text/plain");
|
||||||
echo "\n#StorageServer import script:\n";
|
echo "===========================\n";
|
||||||
//echo date('H:i:s')."\n";
|
echo "\nStorageServer Import Script\n";
|
||||||
|
echo "===========================\n";
|
||||||
$start = intval(date('U'));
|
$start = intval(date('U'));
|
||||||
|
|
||||||
require_once('conf.php');
|
require_once('conf.php');
|
||||||
|
@ -15,9 +24,7 @@ require_once("$storageServerPath/var/conf.php");
|
||||||
require_once('DB.php');
|
require_once('DB.php');
|
||||||
require_once("$storageServerPath/var/GreenBox.php");
|
require_once("$storageServerPath/var/GreenBox.php");
|
||||||
|
|
||||||
//PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
|
|
||||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||||
//PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s\n");
|
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
|
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
|
||||||
if (PEAR::isError($CC_DBC)) {
|
if (PEAR::isError($CC_DBC)) {
|
||||||
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
||||||
|
@ -57,7 +64,7 @@ if (PEAR::isError($r)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (is_null($r)) {
|
if (is_null($r)) {
|
||||||
$r = $gb->bsCreateFolder($gb->storId, 'import');
|
$r = BasicStor::bsCreateFolder($gb->storId, 'import');
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n";
|
echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -69,11 +76,16 @@ $parid = $r;
|
||||||
$stdin = fopen('php://stdin', 'r');
|
$stdin = fopen('php://stdin', 'r');
|
||||||
while ($filename = fgets($stdin, 2048)) {
|
while ($filename = fgets($stdin, 2048)) {
|
||||||
$filename = rtrim($filename);
|
$filename = rtrim($filename);
|
||||||
if (!preg_match('/\.(ogg|wav|mp3|mpg|mpeg)$/', strtolower($filename), $var)) {
|
if (!preg_match('/\.(ogg|mp3)$/i', $filename, $var)) {
|
||||||
// echo "File extension not supported - skipping file\n";
|
// echo "File extension not supported - skipping file\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo "$filename: ";
|
echo "Importing: $filename\n";
|
||||||
|
|
||||||
|
$md5sum = md5_file($filename);
|
||||||
|
echo " * MD5: $md5sum\n";
|
||||||
|
|
||||||
|
// Look up md5sum in database
|
||||||
|
|
||||||
$mdata = camp_get_audio_metadata($filename, $testonly);
|
$mdata = camp_get_audio_metadata($filename, $testonly);
|
||||||
if (PEAR::isError($mdata)) {
|
if (PEAR::isError($mdata)) {
|
||||||
|
@ -105,13 +117,12 @@ while ($filename = fgets($stdin, 2048)) {
|
||||||
echo "======================= ";
|
echo "======================= ";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "OK\n";
|
echo " * OK\n";
|
||||||
$filecount++;
|
$filecount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($stdin);
|
fclose($stdin);
|
||||||
$end = intval(date('U'));
|
$end = intval(date('U'));
|
||||||
//echo date('H:i:s')."\n";
|
|
||||||
$time = $end - $start;
|
$time = $end - $start;
|
||||||
if ($time > 0) {
|
if ($time > 0) {
|
||||||
$speed = round(($filecount+$g_errors)/$time, 1);
|
$speed = round(($filecount+$g_errors)/$time, 1);
|
||||||
|
|
|
@ -17,26 +17,28 @@ require_once "$storageServerPath/var/BasicStor.php";
|
||||||
require_once "$storageServerPath/var/Prefs.php";
|
require_once "$storageServerPath/var/Prefs.php";
|
||||||
|
|
||||||
/* =========================================================== misc functions */
|
/* =========================================================== misc functions */
|
||||||
function ls_restore_processObject($el){
|
function ls_restore_processObject($el)
|
||||||
|
{
|
||||||
$res = array(
|
$res = array(
|
||||||
'name' => $el->attrs['name']->val,
|
'name' => $el->attrs['name']->val,
|
||||||
'type' => $el->name,
|
'type' => $el->name,
|
||||||
);
|
);
|
||||||
switch($res['type']){
|
switch ($res['type']) {
|
||||||
case'folder':
|
case 'folder':
|
||||||
foreach($el->children as $i=>$o){
|
foreach ($el->children as $i => $o) {
|
||||||
$res['children'][] = ls_restore_processObject($o);
|
$res['children'][] = ls_restore_processObject($o);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$res['gunid'] = $el->attrs['id']->val;
|
$res['gunid'] = $el->attrs['id']->val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ls_restore_checkErr($r, $ln=''){
|
function ls_restore_checkErr($r, $ln='')
|
||||||
if(PEAR::isError($r)){
|
{
|
||||||
|
if (PEAR::isError($r)) {
|
||||||
echo "ERROR $ln: ".$r->getMessage()." ".$r->getUserInfo()."\n";
|
echo "ERROR $ln: ".$r->getMessage()." ".$r->getUserInfo()."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -44,32 +46,44 @@ function ls_restore_checkErr($r, $ln=''){
|
||||||
|
|
||||||
function ls_restore_restoreObject($obj, $parid, $reallyInsert=TRUE){
|
function ls_restore_restoreObject($obj, $parid, $reallyInsert=TRUE){
|
||||||
global $tmpdir, $bs;
|
global $tmpdir, $bs;
|
||||||
switch($obj['type']){
|
switch ($obj['type']) {
|
||||||
case"folder";
|
case "folder";
|
||||||
if($reallyInsert){
|
if ($reallyInsert) {
|
||||||
if(VERBOSE) echo " creating folder {$obj['name']} ...\n";
|
if (VERBOSE) {
|
||||||
$r = $bs->bsCreateFolder($parid, $obj['name']);
|
echo " creating folder {$obj['name']} ...\n";
|
||||||
|
}
|
||||||
|
$r = BasicStor::bsCreateFolder($parid, $obj['name']);
|
||||||
ls_restore_checkErr($r, __LINE__);
|
ls_restore_checkErr($r, __LINE__);
|
||||||
}else $r=$parid;
|
} else {
|
||||||
if(isset($obj['children']) && is_array($obj['children'])){
|
$r = $parid;
|
||||||
foreach($obj['children'] as $i=>$ch){
|
}
|
||||||
|
if (isset($obj['children']) && is_array($obj['children'])) {
|
||||||
|
foreach ($obj['children'] as $i => $ch) {
|
||||||
ls_restore_restoreObject($ch, $r);
|
ls_restore_restoreObject($ch, $r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case"audioClip";
|
case "audioClip";
|
||||||
case"webstream";
|
case "webstream";
|
||||||
case"playlist";
|
case "playlist";
|
||||||
$gunid = $obj['gunid'];
|
$gunid = $obj['gunid'];
|
||||||
if(is_null($gunid)) break;
|
if (is_null($gunid)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$gunid3 = substr($gunid, 0, 3);
|
$gunid3 = substr($gunid, 0, 3);
|
||||||
$mediaFile = "$tmpdir/stor/$gunid3/$gunid";
|
$mediaFile = "$tmpdir/stor/$gunid3/$gunid";
|
||||||
# echo "X1 $gunid, $gunid3, $mediaFile\n";
|
# echo "X1 $gunid, $gunid3, $mediaFile\n";
|
||||||
if(!file_exists($mediaFile)) $mediaFile = NULL;
|
if (!file_exists($mediaFile)) {
|
||||||
|
$mediaFile = NULL;
|
||||||
|
}
|
||||||
$mdataFile = "$tmpdir/stor/$gunid3/$gunid.xml";
|
$mdataFile = "$tmpdir/stor/$gunid3/$gunid.xml";
|
||||||
if(!file_exists($mdataFile)) $mdataFile = NULL;
|
if (!file_exists($mdataFile)) {
|
||||||
if($reallyInsert){
|
$mdataFile = NULL;
|
||||||
if(VERBOSE) echo " creating file {$obj['name']} ...\n";
|
}
|
||||||
|
if ($reallyInsert) {
|
||||||
|
if (VERBOSE) {
|
||||||
|
echo " creating file {$obj['name']} ...\n";
|
||||||
|
}
|
||||||
$r = $bs->bsPutFile($parid, $obj['name'],
|
$r = $bs->bsPutFile($parid, $obj['name'],
|
||||||
$mediaFile, $mdataFile, $obj['gunid'],
|
$mediaFile, $mdataFile, $obj['gunid'],
|
||||||
strtolower($obj['type']));
|
strtolower($obj['type']));
|
||||||
|
|
|
@ -33,7 +33,7 @@ class AccessRecur {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
$plRes = $r;
|
$plRes = $r;
|
||||||
$r = StoredFile::recallByGunid($ppa->ls, $plid);
|
$r = StoredFile::recallByGunid($plid);
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ class Backup
|
||||||
# post procedures
|
# post procedures
|
||||||
$this->token = $token;
|
$this->token = $token;
|
||||||
$this->setEnviroment();
|
$this->setEnviroment();
|
||||||
$this->gb->bsRelease($token,ACCESS_TYPE);
|
BasicStor::bsRelease($token, ACCESS_TYPE);
|
||||||
Backup::rRmDir($this->tmpDir);
|
Backup::rRmDir($this->tmpDir);
|
||||||
unlink($this->statusFile);
|
unlink($this->statusFile);
|
||||||
unlink($this->tmpFile);
|
unlink($this->tmpFile);
|
||||||
|
@ -301,7 +301,7 @@ class Backup
|
||||||
foreach ($this->ids as $i=>$item) {
|
foreach ($this->ids as $i=>$item) {
|
||||||
$gunid = $item['gunid'];
|
$gunid = $item['gunid'];
|
||||||
// get a stored file object of this gunid
|
// get a stored file object of this gunid
|
||||||
$sf = StoredFile::recallByGunid($this->gb, $gunid);
|
$sf = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($sf)) {
|
if (PEAR::isError($sf)) {
|
||||||
return $sf;
|
return $sf;
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ class Backup
|
||||||
*/
|
*/
|
||||||
private function genToken()
|
private function genToken()
|
||||||
{
|
{
|
||||||
$acc = $this->gb->bsAccess($this->tmpFile, BACKUP_EXT, null, ACCESS_TYPE);
|
$acc = BasicStor::bsAccess($this->tmpFile, BACKUP_EXT, null, ACCESS_TYPE);
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,17 +47,17 @@ class BasicStor {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new folder
|
* Create a virtual folder in the database.
|
||||||
*
|
*
|
||||||
* @param int $parid
|
* @param int $parid
|
||||||
* Parent id
|
* Parent id
|
||||||
* @param string $folderName
|
* @param string $folderName
|
||||||
* Name for new folder
|
* Name for new folder
|
||||||
* @return unknown
|
* @return int
|
||||||
* id of new folder
|
* id of new folder
|
||||||
* @exception PEAR_Error
|
* @exception PEAR_Error
|
||||||
*/
|
*/
|
||||||
public function bsCreateFolder($parid, $folderName)
|
public static function bsCreateFolder($parid, $folderName)
|
||||||
{
|
{
|
||||||
return BasicStor::AddObj($folderName , 'Folder', $parid);
|
return BasicStor::AddObj($folderName , 'Folder', $parid);
|
||||||
}
|
}
|
||||||
|
@ -91,10 +91,10 @@ class BasicStor {
|
||||||
if (PEAR::isError($id)) {
|
if (PEAR::isError($id)) {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
$ac = StoredFile::insert($this, $id, $fileName,
|
$ac = StoredFile::insert($id, $fileName,
|
||||||
$mediaFileLP, $mdataFileLP, $mdataLoc, $gunid, $ftype);
|
$mediaFileLP, $mdataFileLP, $mdataLoc, $gunid, $ftype);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
$res = $this->removeObj($id);
|
$res = BasicStor::RemoveObj($id);
|
||||||
// catch constraint violations
|
// catch constraint violations
|
||||||
switch ($ac->getCode()) {
|
switch ($ac->getCode()) {
|
||||||
case -3:
|
case -3:
|
||||||
|
@ -127,7 +127,7 @@ class BasicStor {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "playlist":
|
case "playlist":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
// catch nonerror exception:
|
// catch nonerror exception:
|
||||||
//if($ac->getCode() != GBERR_FOBJNEX)
|
//if($ac->getCode() != GBERR_FOBJNEX)
|
||||||
|
@ -231,7 +231,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsReplaceFile($id, $mediaFileLP, $mdataFileLP, $mdataLoc='file')
|
public function bsReplaceFile($id, $mediaFileLP, $mdataFileLP, $mdataLoc='file')
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ class BasicStor {
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
// full delete:
|
// full delete:
|
||||||
if (!$CC_CONFIG['useTrash'] || $forced) {
|
if (!$CC_CONFIG['useTrash'] || $forced) {
|
||||||
$res = $this->removeObj($id, $forced);
|
$res = BasicStor::RemoveObj($id, $forced);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
// move to trash:
|
// move to trash:
|
||||||
|
@ -278,7 +278,7 @@ class BasicStor {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "playlist":
|
case "playlist":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ class BasicStor {
|
||||||
* 'put'|'access'|'download'
|
* 'put'|'access'|'download'
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function bsCheckToken($token, $type='put')
|
public static function bsCheckToken($token, $type='put')
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$cnt = $CC_DBC->getOne("
|
$cnt = $CC_DBC->getOne("
|
||||||
|
@ -368,7 +368,7 @@ class BasicStor {
|
||||||
* @return array
|
* @return array
|
||||||
* array with: seekable filehandle, access token
|
* array with: seekable filehandle, access token
|
||||||
*/
|
*/
|
||||||
public function bsAccess($realFname, $ext, $gunid, $type='access',
|
public static function bsAccess($realFname, $ext, $gunid, $type='access',
|
||||||
$parent='0', $owner=NULL)
|
$parent='0', $owner=NULL)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
@ -438,10 +438,10 @@ class BasicStor {
|
||||||
* owner: int, local subject id of token owner
|
* owner: int, local subject id of token owner
|
||||||
* realFname: string, real local pathname of accessed file
|
* realFname: string, real local pathname of accessed file
|
||||||
*/
|
*/
|
||||||
public function bsRelease($token, $type='access')
|
public static function bsRelease($token, $type='access')
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
if (!$this->bsCheckToken($token, $type)) {
|
if (!BasicStor::bsCheckToken($token, $type)) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"BasicStor::bsRelease: invalid token ($token)"
|
"BasicStor::bsRelease: invalid token ($token)"
|
||||||
);
|
);
|
||||||
|
@ -512,7 +512,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsOpenDownload($id, $part='media', $parent='0')
|
public function bsOpenDownload($id, $part='media', $parent='0')
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ class BasicStor {
|
||||||
"BasicStor::bsOpenDownload: unknown part ($part)"
|
"BasicStor::bsOpenDownload: unknown part ($part)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$acc = $this->bsAccess($realfile, $ext, $gunid, 'download', $parent);
|
$acc = BasicStor::bsAccess($realfile, $ext, $gunid, 'download', $parent);
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
@ -560,12 +560,12 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsCloseDownload($token, $part='media')
|
public function bsCloseDownload($token, $part='media')
|
||||||
{
|
{
|
||||||
if (!$this->bsCheckToken($token, 'download')) {
|
if (!BasicStor::bsCheckToken($token, 'download')) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"BasicStor::bsCloseDownload: invalid token ($token)"
|
"BasicStor::bsCloseDownload: invalid token ($token)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$r = $this->bsRelease($token, 'download');
|
$r = BasicStor::bsRelease($token, 'download');
|
||||||
if (PEAR::isError($r)){
|
if (PEAR::isError($r)){
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ class BasicStor {
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$token = StoredFile::NormalizeGunid($token);
|
$token = StoredFile::NormalizeGunid($token);
|
||||||
if (!$this->bsCheckToken($token, 'put')) {
|
if (!BasicStor::bsCheckToken($token, 'put')) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"BasicStor::bsClosePut: invalid token ($token)",
|
"BasicStor::bsClosePut: invalid token ($token)",
|
||||||
GBERR_TOKEN
|
GBERR_TOKEN
|
||||||
|
@ -690,7 +690,7 @@ class BasicStor {
|
||||||
public function bsCheckPut($token)
|
public function bsCheckPut($token)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
if (!$this->bsCheckToken($token, 'put')) {
|
if (!BasicStor::bsCheckToken($token, 'put')) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
"BasicStor::bsCheckPut: invalid token ($token)"
|
"BasicStor::bsCheckPut: invalid token ($token)"
|
||||||
);
|
);
|
||||||
|
@ -787,7 +787,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
public function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsGetMetadata($id)
|
public function bsGetMetadata($id)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -829,9 +829,9 @@ class BasicStor {
|
||||||
public function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
public function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
|
||||||
{
|
{
|
||||||
if (is_null($gunid)) {
|
if (is_null($gunid)) {
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
} else {
|
} else {
|
||||||
$ac = StoredFile::recallByGunid($this, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
}
|
}
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
|
@ -862,7 +862,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
// public function bsGetMetadataValue($id, $category, $lang=NULL, $deflang=NULL)
|
// public function bsGetMetadataValue($id, $category, $lang=NULL, $deflang=NULL)
|
||||||
// {
|
// {
|
||||||
// $ac = StoredFile::recall($this, $id);
|
// $ac = StoredFile::recall($id);
|
||||||
// if (PEAR::isError($ac)) {
|
// if (PEAR::isError($ac)) {
|
||||||
// return $ac;
|
// return $ac;
|
||||||
// }
|
// }
|
||||||
|
@ -886,7 +886,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsGetMetadataValue($id, $category = null)
|
public function bsGetMetadataValue($id, $category = null)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ class BasicStor {
|
||||||
public function bsSetMetadataValue($id, $category, $value,
|
public function bsSetMetadataValue($id, $category, $value,
|
||||||
$lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE)
|
$lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -996,7 +996,7 @@ class BasicStor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($regen) {
|
if ($regen) {
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,7 @@ class BasicStor {
|
||||||
mkdir($tmpdc);
|
mkdir($tmpdc);
|
||||||
}
|
}
|
||||||
foreach ($gunids as $i => $it) {
|
foreach ($gunids as $i => $it) {
|
||||||
$ac = StoredFile::recallByGunid($this, $it['gunid']);
|
$ac = StoredFile::recallByGunid($it['gunid']);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -1206,7 +1206,7 @@ class BasicStor {
|
||||||
@rmdir($tmpdp);
|
@rmdir($tmpdp);
|
||||||
@rmdir($tmpd);
|
@rmdir($tmpd);
|
||||||
unlink($tmpn);
|
unlink($tmpn);
|
||||||
$acc = $this->bsAccess($tmpf, 'tar', NULL/*gunid*/, 'access');
|
$acc = BasicStor::bsAccess($tmpf, 'tar', NULL/*gunid*/, 'access');
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
@ -1224,7 +1224,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsExportPlaylistClose($token)
|
public function bsExportPlaylistClose($token)
|
||||||
{
|
{
|
||||||
$r = $this->bsRelease($token, 'access');
|
$r = BasicStor::bsRelease($token, 'access');
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -1465,7 +1465,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function bsAnalyzeFile($id)
|
public function bsAnalyzeFile($id)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -1546,9 +1546,9 @@ class BasicStor {
|
||||||
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
|
||||||
{
|
{
|
||||||
if ($byGunid) {
|
if ($byGunid) {
|
||||||
$ac = StoredFile::recallByGunid($this, $id);
|
$ac = StoredFile::recallByGunid($id);
|
||||||
} else {
|
} else {
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
}
|
}
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
// catch some exceptions
|
// catch some exceptions
|
||||||
|
@ -1618,7 +1618,7 @@ class BasicStor {
|
||||||
return $uid;
|
return $uid;
|
||||||
}
|
}
|
||||||
if (Subjects::IsGroup($uid) === FALSE) {
|
if (Subjects::IsGroup($uid) === FALSE) {
|
||||||
$fid = $this->bsCreateFolder($this->storId, $login);
|
$fid = BasicStor::bsCreateFolder($this->storId, $login);
|
||||||
if (PEAR::isError($fid)) {
|
if (PEAR::isError($fid)) {
|
||||||
return $fid;
|
return $fid;
|
||||||
}
|
}
|
||||||
|
@ -1635,7 +1635,7 @@ class BasicStor {
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
$pfid = $this->bsCreateFolder($fid, 'public');
|
$pfid = BasicStor::bsCreateFolder($fid, 'public');
|
||||||
if (PEAR::isError($pfid)) {
|
if (PEAR::isError($pfid)) {
|
||||||
return $pfid;
|
return $pfid;
|
||||||
}
|
}
|
||||||
|
@ -1926,7 +1926,7 @@ class BasicStor {
|
||||||
return $p_subjid;
|
return $p_subjid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ac = StoredFile::recallByGunid($this, $p_playlistId);
|
$ac = StoredFile::recallByGunid($p_playlistId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -1953,7 +1953,7 @@ class BasicStor {
|
||||||
*/
|
*/
|
||||||
public function isEdited($p_playlistId)
|
public function isEdited($p_playlistId)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recallByGunid($this, $p_playlistId);
|
$ac = StoredFile::recallByGunid($p_playlistId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -1983,7 +1983,7 @@ class BasicStor {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "playlist":
|
case "playlist":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -2010,7 +2010,7 @@ class BasicStor {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "playlist":
|
case "playlist":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -2037,8 +2037,8 @@ class BasicStor {
|
||||||
* Optionaly remove virtual file with the same name and add new one.<br>
|
* Optionaly remove virtual file with the same name and add new one.<br>
|
||||||
* Redefined from parent class.
|
* Redefined from parent class.
|
||||||
*
|
*
|
||||||
* @return unknown
|
* @return int
|
||||||
* ID
|
* Database ID of the object.
|
||||||
*/
|
*/
|
||||||
public static function AddObj($name, $type, $parid=1, $aftid=NULL, $param='')
|
public static function AddObj($name, $type, $parid=1, $aftid=NULL, $param='')
|
||||||
{
|
{
|
||||||
|
@ -2046,7 +2046,7 @@ class BasicStor {
|
||||||
if (PEAR::isError($exid)) {
|
if (PEAR::isError($exid)) {
|
||||||
return $exid;
|
return $exid;
|
||||||
}
|
}
|
||||||
//if(!is_null($exid)){ $this->removeObj($exid); }
|
//if(!is_null($exid)){ BasicStor::RemoveObj($exid); }
|
||||||
$name2 = $name;
|
$name2 = $name;
|
||||||
for ( ;
|
for ( ;
|
||||||
$xid = M2tree::GetObjId($name2, $parid),
|
$xid = M2tree::GetObjId($name2, $parid),
|
||||||
|
@ -2070,24 +2070,24 @@ class BasicStor {
|
||||||
* Unconditional delete
|
* Unconditional delete
|
||||||
* @return true|PEAR_Error
|
* @return true|PEAR_Error
|
||||||
*/
|
*/
|
||||||
public function removeObj($id, $forced=FALSE)
|
public static function RemoveObj($id, $forced=FALSE)
|
||||||
{
|
{
|
||||||
switch ($ot = BasicStor::GetObjType($id)) {
|
switch ($ot = BasicStor::GetObjType($id)) {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "playlist":
|
case "playlist":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
if ($ac->isEdited() && !$forced) {
|
if ($ac->isEdited() && !$forced) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
'BasicStor.php: removeObj: is edited'
|
'BasicStor::RemoveObj(): is edited'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($ac->isAccessed() && !$forced) {
|
if ($ac->isAccessed() && !$forced) {
|
||||||
return PEAR::raiseError(
|
return PEAR::raiseError(
|
||||||
'BasicStor.php: removeObj: is accessed'
|
'BasicStor::RemoveObj(): is accessed'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$ac->delete();
|
$ac->delete();
|
||||||
|
@ -2383,13 +2383,13 @@ class BasicStor {
|
||||||
$o[] = $this->addSubj('test4', 'a');
|
$o[] = $this->addSubj('test4', 'a');
|
||||||
|
|
||||||
$o[] = $t1hd = M2tree::GetObjId('test1', $this->storId);
|
$o[] = $t1hd = M2tree::GetObjId('test1', $this->storId);
|
||||||
$o[] = $t1d1 = $this->bsCreateFolder($t1hd, 'test1_folder1');
|
$o[] = $t1d1 = BasicStor::bsCreateFolder($t1hd, 'test1_folder1');
|
||||||
$o[] = $this->bsCreateFolder($t1hd, 'test1_folder2');
|
$o[] = BasicStor::bsCreateFolder($t1hd, 'test1_folder2');
|
||||||
$o[] = $this->bsCreateFolder($t1d1, 'test1_folder1_1');
|
$o[] = BasicStor::bsCreateFolder($t1d1, 'test1_folder1_1');
|
||||||
$o[] = $t1d12 = $this->bsCreateFolder($t1d1, 'test1_folder1_2');
|
$o[] = $t1d12 = BasicStor::bsCreateFolder($t1d1, 'test1_folder1_2');
|
||||||
|
|
||||||
$o[] = $t2hd = M2tree::GetObjId('test2', $this->storId);
|
$o[] = $t2hd = M2tree::GetObjId('test2', $this->storId);
|
||||||
$o[] = $this->bsCreateFolder($t2hd, 'test2_folder1');
|
$o[] = BasicStor::bsCreateFolder($t2hd, 'test2_folder1');
|
||||||
|
|
||||||
$o[] = $this->bsPutFile($t1hd, 'file1.mp3', "$exdir/ex1.mp3", '', NULL, 'audioclip');
|
$o[] = $this->bsPutFile($t1hd, 'file1.mp3', "$exdir/ex1.mp3", '', NULL, 'audioclip');
|
||||||
$o[] = $this->bsPutFile($t1d12, 'file2.wav', "$exdir/ex2.wav", '', NULL, 'audioclip');
|
$o[] = $this->bsPutFile($t1d12, 'file2.wav', "$exdir/ex2.wav", '', NULL, 'audioclip');
|
||||||
|
@ -2467,64 +2467,96 @@ class BasicStor {
|
||||||
* initData - initialize
|
* initData - initialize
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function initData()
|
public function initData($p_verbose = false)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$this->rootId = M2tree::GetRootNode();
|
$this->rootId = M2tree::GetRootNode();
|
||||||
$this->storId = BasicStor::AddObj('StorageRoot', 'Folder', $this->rootId);
|
$this->storId = BasicStor::AddObj('StorageRoot', 'Folder', $this->rootId);
|
||||||
$this->wd = $this->storId;
|
$this->wd = $this->storId;
|
||||||
// user root init
|
|
||||||
$rootUid = Subjects::AddSubj('root', $CC_CONFIG['tmpRootPass']);
|
if (!Subjects::GetSubjId('root')) {
|
||||||
$res = Alib::AddPerm($rootUid, '_all', $this->rootId, 'A');
|
if ($p_verbose) {
|
||||||
if (PEAR::isError($res)) {
|
echo " * Creating user 'root'...";
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
$res = Alib::AddPerm($rootUid, 'subjects', $this->rootId, 'A');
|
|
||||||
if (PEAR::isError($res)) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
$fid = $this->bsCreateFolder($this->storId, 'root');
|
|
||||||
if (PEAR::isError($fid)) {
|
|
||||||
return $fid;
|
|
||||||
}
|
|
||||||
if ($CC_CONFIG['useTrash']) {
|
|
||||||
$tfid = $this->bsCreateFolder(
|
|
||||||
$this->storId, $CC_CONFIG["TrashName"]);
|
|
||||||
if (PEAR::isError($tfid)) {
|
|
||||||
return $tfid;
|
|
||||||
}
|
}
|
||||||
}
|
// Create user 'root'.
|
||||||
$allid = Subjects::AddSubj($CC_CONFIG['AllGr']);
|
$rootUid = Subjects::AddSubj('root', $CC_CONFIG['tmpRootPass']);
|
||||||
if (PEAR::isError($allid)) {
|
$res = Alib::AddPerm($rootUid, '_all', $this->rootId, 'A');
|
||||||
return $allid;
|
|
||||||
}
|
|
||||||
Subjects::AddSubjectToGroup('root', $CC_CONFIG['AllGr']);
|
|
||||||
Alib::AddPerm($allid, 'read', $this->rootId, 'A');
|
|
||||||
$admid = Subjects::AddSubj($CC_CONFIG['AdminsGr']);
|
|
||||||
if (PEAR::isError($admid)) {
|
|
||||||
return $admid;
|
|
||||||
}
|
|
||||||
$r = Subjects::AddSubjectToGroup('root', $CC_CONFIG['AdminsGr']);
|
|
||||||
if (PEAR::isError($r)) {
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
$res = Alib::AddPerm($admid, '_all', $this->rootId, 'A');
|
|
||||||
if (PEAR::isError($res)) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
if (!$CC_CONFIG['isArchive']) {
|
|
||||||
$stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']);
|
|
||||||
if (PEAR::isError($stPrefGr)) {
|
|
||||||
return $stPrefGr;
|
|
||||||
}
|
|
||||||
Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']);
|
|
||||||
// user scheduler init
|
|
||||||
Subjects::AddSubj('scheduler', $CC_CONFIG['schedulerPass']);
|
|
||||||
$res = Alib::AddPerm($rootUid, 'read', $this->rootId, 'A');
|
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
$r = Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['AllGr']);
|
$res = Alib::AddPerm($rootUid, 'subjects', $this->rootId, 'A');
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
$allid = Subjects::AddSubj($CC_CONFIG['AllGr']);
|
||||||
|
if (PEAR::isError($allid)) {
|
||||||
|
return $allid;
|
||||||
|
}
|
||||||
|
Subjects::AddSubjectToGroup('root', $CC_CONFIG['AllGr']);
|
||||||
|
Alib::AddPerm($allid, 'read', $this->rootId, 'A');
|
||||||
|
$admid = Subjects::AddSubj($CC_CONFIG['AdminsGr']);
|
||||||
|
if (PEAR::isError($admid)) {
|
||||||
|
return $admid;
|
||||||
|
}
|
||||||
|
$r = Subjects::AddSubjectToGroup('root', $CC_CONFIG['AdminsGr']);
|
||||||
|
if (PEAR::isError($r)) {
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
$res = Alib::AddPerm($admid, '_all', $this->rootId, 'A');
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo "done.\n";
|
||||||
|
}
|
||||||
|
} elseif ($p_verbose) {
|
||||||
|
echo " * Skipping: user 'root' already exists.\n";
|
||||||
|
}
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo " * Creating storage root directory...";
|
||||||
|
}
|
||||||
|
$fid = BasicStor::bsCreateFolder($this->storId, 'root');
|
||||||
|
if (PEAR::isError($fid)) {
|
||||||
|
return $fid;
|
||||||
|
}
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo "done.\n";
|
||||||
|
}
|
||||||
|
if ($CC_CONFIG['useTrash']) {
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo " * Creating trashcan...";
|
||||||
|
}
|
||||||
|
$tfid = BasicStor::bsCreateFolder($this->storId, $CC_CONFIG["TrashName"]);
|
||||||
|
if (PEAR::isError($tfid)) {
|
||||||
|
return $tfid;
|
||||||
|
}
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo "done.\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$CC_CONFIG['isArchive']) {
|
||||||
|
if (!Subjects::GetSubjId('scheduler')) {
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo " * Creating user 'scheduler'...";
|
||||||
|
}
|
||||||
|
$stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']);
|
||||||
|
if (PEAR::isError($stPrefGr)) {
|
||||||
|
return $stPrefGr;
|
||||||
|
}
|
||||||
|
Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']);
|
||||||
|
// Create the user named 'scheduler'.
|
||||||
|
Subjects::AddSubj('scheduler', $CC_CONFIG['schedulerPass']);
|
||||||
|
$res = Alib::AddPerm($rootUid, 'read', $this->rootId, 'A');
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
$r = Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['AllGr']);
|
||||||
|
if ($p_verbose) {
|
||||||
|
echo "done.\n";
|
||||||
|
}
|
||||||
|
} else if ($p_verbose) {
|
||||||
|
echo " * Skipping: user 'scheduler' already exists.\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class GreenBox extends BasicStor {
|
||||||
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
return $this->bsCreateFolder($parid, $folderName);
|
return BasicStor::bsCreateFolder($parid, $folderName);
|
||||||
} // fn createFolder
|
} // fn createFolder
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class GreenBox extends BasicStor {
|
||||||
// return $res;
|
// return $res;
|
||||||
// }
|
// }
|
||||||
// $gunid = BasicStor::GunidFromId($id);
|
// $gunid = BasicStor::GunidFromId($id);
|
||||||
// $r = $this->bsAccess(NULL, '', $gunid, 'access');
|
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
|
||||||
// if (PEAR::isError($r)) {
|
// if (PEAR::isError($r)) {
|
||||||
// return $r;
|
// return $r;
|
||||||
// }
|
// }
|
||||||
|
@ -152,7 +152,7 @@ class GreenBox extends BasicStor {
|
||||||
*/
|
*/
|
||||||
// function releaseFile($token, $sessid='')
|
// function releaseFile($token, $sessid='')
|
||||||
// {
|
// {
|
||||||
// $r = $this->bsRelease($token, 'access');
|
// $r = BasicStor::bsRelease($token, 'access');
|
||||||
// if (PEAR::isError($r)) {
|
// if (PEAR::isError($r)) {
|
||||||
// return $r;
|
// return $r;
|
||||||
// }
|
// }
|
||||||
|
@ -344,7 +344,7 @@ class GreenBox extends BasicStor {
|
||||||
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +591,7 @@ class GreenBox extends BasicStor {
|
||||||
public function getPlaylistArray($id, $sessid)
|
public function getPlaylistArray($id, $sessid)
|
||||||
{
|
{
|
||||||
$gunid = BasicStor::GunidFromId($id);
|
$gunid = BasicStor::GunidFromId($id);
|
||||||
$pl = StoredFile::recall($this, $id);
|
$pl = StoredFile::recall($id);
|
||||||
if (PEAR::isError($pl)) {
|
if (PEAR::isError($pl)) {
|
||||||
return $pl;
|
return $pl;
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ class GreenBox extends BasicStor {
|
||||||
if (PEAR::isError($gunid)) {
|
if (PEAR::isError($gunid)) {
|
||||||
return $gunid;
|
return $gunid;
|
||||||
}
|
}
|
||||||
$ac = StoredFile::recallByGunid($this, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class LocStor extends BasicStor {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// test if specified gunid exists:
|
// test if specified gunid exists:
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (!PEAR::isError($ac)) {
|
if (!PEAR::isError($ac)) {
|
||||||
// gunid exists - do replace
|
// gunid exists - do replace
|
||||||
$oid = $ac->getId();
|
$oid = $ac->getId();
|
||||||
|
@ -81,12 +81,10 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($oid)) {
|
if (PEAR::isError($oid)) {
|
||||||
return $oid;
|
return $oid;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::insert(
|
$ac =& StoredFile::insert($oid, '', '', $metadata,
|
||||||
$this, $oid, '', '', $metadata, 'string',
|
'string', $gunid, $ftype);
|
||||||
$gunid, $ftype
|
|
||||||
);
|
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
$res = $this->removeObj($oid);
|
$res = BasicStor::RemoveObj($oid);
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
|
@ -117,7 +115,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
protected function storeAudioClipClose($sessid, $token)
|
protected function storeAudioClipClose($sessid, $token)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByToken($this, $token);
|
$ac =& StoredFile::recallByToken($token);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +182,7 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($gunid)) {
|
if (PEAR::isError($gunid)) {
|
||||||
return $gunid;
|
return $gunid;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +209,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
public function accessRawAudioData($sessid, $gunid, $parent='0')
|
public function accessRawAudioData($sessid, $gunid, $parent='0')
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +230,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
public function releaseRawAudioData($sessid, $token)
|
public function releaseRawAudioData($sessid, $token)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByToken($this, $token);
|
$ac =& StoredFile::recallByToken($token);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +337,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
protected function getAudioClip($sessid, $gunid)
|
protected function getAudioClip($sessid, $gunid)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +477,7 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($ex)) {
|
if (PEAR::isError($ex)) {
|
||||||
return $ex;
|
return $ex;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +519,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
protected function deleteAudioClip($sessid, $gunid, $forced=FALSE)
|
protected function deleteAudioClip($sessid, $gunid, $forced=FALSE)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
if ($ac->getCode()==GBERR_FOBJNEX && $forced) {
|
if ($ac->getCode()==GBERR_FOBJNEX && $forced) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -550,7 +548,7 @@ class LocStor extends BasicStor {
|
||||||
*/
|
*/
|
||||||
protected function updateAudioClipMetadata($sessid, $gunid, $metadata)
|
protected function updateAudioClipMetadata($sessid, $gunid, $metadata)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -597,12 +595,12 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($oid)) {
|
if (PEAR::isError($oid)) {
|
||||||
return $oid;
|
return $oid;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::insert($this, $oid, '', '',
|
$ac =& StoredFile::insert($oid, '', '',
|
||||||
dirname(__FILE__).'/emptyPlaylist.xml',
|
dirname(__FILE__).'/emptyPlaylist.xml',
|
||||||
'file', $playlistId, 'playlist'
|
'file', $playlistId, 'playlist'
|
||||||
);
|
);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
$res = $this->removeObj($oid);
|
$res = BasicStor::RemoveObj($oid);
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
if ($fname == '') {
|
if ($fname == '') {
|
||||||
|
@ -651,7 +649,7 @@ class LocStor extends BasicStor {
|
||||||
'LocStor::editPlaylist: playlist already edited'
|
'LocStor::editPlaylist: playlist already edited'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $playlistId);
|
$ac =& StoredFile::recallByGunid($playlistId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -690,7 +688,7 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($playlistId)) {
|
if (PEAR::isError($playlistId)) {
|
||||||
return $playlistId;
|
return $playlistId;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $playlistId);
|
$ac =& StoredFile::recallByGunid($playlistId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -722,7 +720,7 @@ class LocStor extends BasicStor {
|
||||||
if (PEAR::isError($gunid)) {
|
if (PEAR::isError($gunid)) {
|
||||||
return $gunid;
|
return $gunid;
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -766,7 +764,7 @@ class LocStor extends BasicStor {
|
||||||
GBERR_FILENEX
|
GBERR_FILENEX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$ac =& StoredFile::recallByGunid($this, $playlistId);
|
$ac =& StoredFile::recallByGunid($playlistId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,7 +471,7 @@ class LsPlaylistAudioClip
|
||||||
public function outputToSmil(&$pl, $plac, $ind='')
|
public function outputToSmil(&$pl, $plac, $ind='')
|
||||||
{
|
{
|
||||||
$gunid = $plac['attrs']['id'];
|
$gunid = $plac['attrs']['id'];
|
||||||
$ac = StoredFile::recallByGunid($pl->gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ class LsPlaylistAudioClip
|
||||||
public function outputToM3u(&$pl, $plac, $ind='')
|
public function outputToM3u(&$pl, $plac, $ind='')
|
||||||
{
|
{
|
||||||
$gunid = $plac['attrs']['id'];
|
$gunid = $plac['attrs']['id'];
|
||||||
$ac = StoredFile::recallByGunid($pl->gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ class LsPlaylistAudioClip
|
||||||
public function outputToRss(&$pl, $plac, $ind='')
|
public function outputToRss(&$pl, $plac, $ind='')
|
||||||
{
|
{
|
||||||
$gunid = $plac['attrs']['id'];
|
$gunid = $plac['attrs']['id'];
|
||||||
$ac = StoredFile::recallByGunid($pl->gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class MetaData {
|
||||||
* @param string $resDir
|
* @param string $resDir
|
||||||
* resource directory
|
* resource directory
|
||||||
*/
|
*/
|
||||||
public function __construct(&$gb, $gunid, $resDir)
|
public function __construct($gunid, $resDir)
|
||||||
{
|
{
|
||||||
$this->gunid = $gunid;
|
$this->gunid = $gunid;
|
||||||
$this->resDir = $resDir;
|
$this->resDir = $resDir;
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Playlist extends StoredFile {
|
||||||
'file', $plid
|
'file', $plid
|
||||||
);
|
);
|
||||||
if (PEAR::isError($pl)) {
|
if (PEAR::isError($pl)) {
|
||||||
$res = $gb->removeObj($oid);
|
$res = BasicStor::RemoveObj($oid);
|
||||||
return $pl;
|
return $pl;
|
||||||
}
|
}
|
||||||
$fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname );
|
$fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname );
|
||||||
|
@ -225,7 +225,7 @@ class Playlist extends StoredFile {
|
||||||
*/
|
*/
|
||||||
private function getAudioClipInfo($acId)
|
private function getAudioClipInfo($acId)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this->gb, $acId);
|
$ac = StoredFile::recall($acId);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Renderer
|
||||||
$logf = $CC_CONFIG['bufferDir']."/renderer.log";
|
$logf = $CC_CONFIG['bufferDir']."/renderer.log";
|
||||||
file_put_contents($logf, "--- ".date("Ymd-H:i:s")."\n", FILE_APPEND);
|
file_put_contents($logf, "--- ".date("Ymd-H:i:s")."\n", FILE_APPEND);
|
||||||
// open access to output file: /*gunid*/ /*parent*/
|
// open access to output file: /*gunid*/ /*parent*/
|
||||||
$acc = $gb->bsAccess($outf, RENDER_EXT, $plid, 'render', 0, $owner);
|
$acc = BasicStor::bsAccess($outf, RENDER_EXT, $plid, 'render', 0, $owner);
|
||||||
if (PEAR::isError($acc)) {
|
if (PEAR::isError($acc)) {
|
||||||
return $acc;
|
return $acc;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ class Renderer
|
||||||
function rnRender2FileClose(&$gb, $token)
|
function rnRender2FileClose(&$gb, $token)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$r = $gb->bsRelease($token, 'render');
|
$r = BasicStor::bsRelease($token, 'render');
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ class Renderer
|
||||||
*/
|
*/
|
||||||
function rnRender2StorageCore(&$gb, $token)
|
function rnRender2StorageCore(&$gb, $token)
|
||||||
{
|
{
|
||||||
$r = $gb->bsRelease($token, 'render');
|
$r = BasicStor::bsRelease($token, 'render');
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ class Renderer
|
||||||
if (PEAR::isError($id)) {
|
if (PEAR::isError($id)) {
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
$ac = StoredFile::recall($gb, $id);
|
$ac = StoredFile::recall($id);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ class Restore {
|
||||||
return $put;
|
return $put;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ac = StoredFile::recallByGunid($this->gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ class SmilPlaylistAudioElement {
|
||||||
}
|
}
|
||||||
//break;
|
//break;
|
||||||
default:
|
default:
|
||||||
$ac = StoredFile::recallByGunid($gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once "RawMediaData.php";
|
require_once("RawMediaData.php");
|
||||||
require_once "MetaData.php";
|
require_once("MetaData.php");
|
||||||
require_once dirname(__FILE__)."/../../getid3/var/getid3.php";
|
require_once(dirname(__FILE__)."/../../getid3/var/getid3.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoredFile class
|
* StoredFile class
|
||||||
|
@ -26,28 +26,11 @@ require_once dirname(__FILE__)."/../../getid3/var/getid3.php";
|
||||||
* @see RawMediaData
|
* @see RawMediaData
|
||||||
*/
|
*/
|
||||||
class StoredFile {
|
class StoredFile {
|
||||||
/**
|
|
||||||
* @var GreenBox
|
|
||||||
*/
|
|
||||||
public $gb;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DB
|
* @var DB
|
||||||
*/
|
*/
|
||||||
public $dbc;
|
public $dbc;
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of a database table.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
//public $filesTable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of a database table.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
//public $accessTable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique ID for the file.
|
* Unique ID for the file.
|
||||||
*
|
*
|
||||||
|
@ -62,11 +45,6 @@ class StoredFile {
|
||||||
*/
|
*/
|
||||||
private $resDir;
|
private $resDir;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
//private $accessDir;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RawMediaData
|
* @var RawMediaData
|
||||||
*/
|
*/
|
||||||
|
@ -79,27 +57,22 @@ class StoredFile {
|
||||||
|
|
||||||
/* ========================================================== constructor */
|
/* ========================================================== constructor */
|
||||||
/**
|
/**
|
||||||
* Constructor, but shouldn't be externally called
|
* Constructor, but shouldn't be externally called
|
||||||
*
|
*
|
||||||
* @param GreenBox $gb
|
* @param string $gunid
|
||||||
* @param string $gunid
|
* globally unique id of file
|
||||||
* globally unique id of file
|
|
||||||
*/
|
*/
|
||||||
public function __construct(&$gb, $gunid=NULL)
|
public function __construct($gunid=NULL)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
$this->gb =& $gb;
|
|
||||||
//$this->filesTable = $CC_CONFIG['filesTable'];
|
|
||||||
//$this->accessTable= $CC_CONFIG['accessTable'];
|
|
||||||
$this->gunid = $gunid;
|
$this->gunid = $gunid;
|
||||||
if (is_null($this->gunid)) {
|
if (is_null($this->gunid)) {
|
||||||
$this->gunid = StoredFile::CreateGunid();
|
$this->gunid = StoredFile::CreateGunid();
|
||||||
}
|
}
|
||||||
$this->resDir = $this->_getResDir($this->gunid);
|
$this->resDir = $this->_getResDir($this->gunid);
|
||||||
//$this->accessDir = $this->gb->accessDir;
|
|
||||||
$this->rmd = new RawMediaData($this->gunid, $this->resDir);
|
$this->rmd = new RawMediaData($this->gunid, $this->resDir);
|
||||||
$this->md = new MetaData($gb, $this->gunid, $this->resDir);
|
$this->md = new MetaData($this->gunid, $this->resDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +80,6 @@ class StoredFile {
|
||||||
/**
|
/**
|
||||||
* Create instance of StoredFile object and insert new file
|
* Create instance of StoredFile object and insert new file
|
||||||
*
|
*
|
||||||
* @param GreenBox $gb
|
|
||||||
* @param int $oid
|
* @param int $oid
|
||||||
* local object id in the tree
|
* local object id in the tree
|
||||||
* @param string $name
|
* @param string $name
|
||||||
|
@ -117,21 +89,21 @@ class StoredFile {
|
||||||
* @param string $metadata
|
* @param string $metadata
|
||||||
* local path to metadata XML file or XML string
|
* local path to metadata XML file or XML string
|
||||||
* @param string $mdataLoc
|
* @param string $mdataLoc
|
||||||
* 'file'|'string' (optional)
|
* 'file'|'string'
|
||||||
* @param global $gunid
|
* @param global $gunid
|
||||||
* unique id (optional) - for insert file with gunid
|
* unique id - for insert file with gunid
|
||||||
* @param string $ftype
|
* @param string $ftype
|
||||||
* internal file type
|
* internal file type
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* class to be constructed (opt.)
|
* class to be constructed
|
||||||
* @return StoredFile
|
* @return StoredFile
|
||||||
*/
|
*/
|
||||||
public static function &insert(&$gb, $oid, $name,
|
public static function &insert($oid, $name,
|
||||||
$mediaFileLP='', $metadata='', $mdataLoc='file',
|
$mediaFileLP='', $metadata='', $mdataLoc='file',
|
||||||
$gunid=NULL, $ftype=NULL, $className='StoredFile')
|
$gunid=NULL, $ftype=NULL, $className='StoredFile')
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$ac = new $className($gb, ($gunid ? $gunid : NULL));
|
$ac = new $className(($gunid ? $gunid : NULL));
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +156,6 @@ class StoredFile {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
$mime = $ac->rmd->getMime();
|
$mime = $ac->rmd->getMime();
|
||||||
//$gb->debugLog("gunid={$ac->gunid}, mime=$mime");
|
|
||||||
if ($mime !== FALSE) {
|
if ($mime !== FALSE) {
|
||||||
$res = $ac->setMime($mime);
|
$res = $ac->setMime($mime);
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
|
@ -214,16 +185,15 @@ class StoredFile {
|
||||||
* Create instance of StoreFile object and recall existing file.<br>
|
* Create instance of StoreFile object and recall existing file.<br>
|
||||||
* Should be supplied with oid OR gunid - not both.
|
* Should be supplied with oid OR gunid - not both.
|
||||||
*
|
*
|
||||||
* @param GreenBox $gb
|
|
||||||
* @param int $oid
|
* @param int $oid
|
||||||
* optional, local object id in the tree
|
* local object id in the tree
|
||||||
* @param string $gunid
|
* @param string $gunid
|
||||||
* optional, global unique id of file
|
* global unique id of file
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* optional classname to recall
|
* classname to recall
|
||||||
* @return StoredFile
|
* @return StoredFile
|
||||||
*/
|
*/
|
||||||
public static function &recall(&$gb, $oid='', $gunid='', $className='StoredFile')
|
public static function &recall($oid='', $gunid='', $className='StoredFile')
|
||||||
{
|
{
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -246,7 +216,7 @@ class StoredFile {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
$gunid = StoredFile::NormalizeGunid($row['gunid']);
|
$gunid = StoredFile::NormalizeGunid($row['gunid']);
|
||||||
$ac = new $className($gb, $gunid);
|
$ac = new $className($gunid);
|
||||||
$ac->mime = $row['mime'];
|
$ac->mime = $row['mime'];
|
||||||
$ac->name = $row['name'];
|
$ac->name = $row['name'];
|
||||||
$ac->id = $row['id'];
|
$ac->id = $row['id'];
|
||||||
|
@ -259,16 +229,15 @@ class StoredFile {
|
||||||
* Create instance of StoreFile object and recall existing file
|
* Create instance of StoreFile object and recall existing file
|
||||||
* by gunid.
|
* by gunid.
|
||||||
*
|
*
|
||||||
* @param GreenBox $gb
|
|
||||||
* @param string $gunid
|
* @param string $gunid
|
||||||
* optional, global unique id of file
|
* optional, global unique id of file
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* optional classname to recall
|
* optional classname to recall
|
||||||
* @return StoredFile
|
* @return StoredFile
|
||||||
*/
|
*/
|
||||||
public static function &recallByGunid(&$gb, $gunid='', $className='StoredFile')
|
public static function &recallByGunid($gunid='', $className='StoredFile')
|
||||||
{
|
{
|
||||||
return StoredFile::recall($gb, '', $gunid, $className);
|
return StoredFile::recall('', $gunid, $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,14 +245,13 @@ class StoredFile {
|
||||||
* Create instance of StoreFile object and recall existing file
|
* Create instance of StoreFile object and recall existing file
|
||||||
* by access token.
|
* by access token.
|
||||||
*
|
*
|
||||||
* @param GreenBox $gb
|
|
||||||
* @param string $token
|
* @param string $token
|
||||||
* access token
|
* access token
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* optional classname to recall
|
* optional classname to recall
|
||||||
* @return StoredFile
|
* @return StoredFile
|
||||||
*/
|
*/
|
||||||
public static function recallByToken(&$gb, $token, $className='StoredFile')
|
public static function recallByToken($token, $className='StoredFile')
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$gunid = $CC_DBC->getOne("
|
$gunid = $CC_DBC->getOne("
|
||||||
|
@ -299,7 +267,7 @@ class StoredFile {
|
||||||
"StoredFile::recallByToken: invalid token ($token)", GBERR_AOBJNEX);
|
"StoredFile::recallByToken: invalid token ($token)", GBERR_AOBJNEX);
|
||||||
}
|
}
|
||||||
$gunid = StoredFile::NormalizeGunid($gunid);
|
$gunid = StoredFile::NormalizeGunid($gunid);
|
||||||
return StoredFile::recall($gb, '', $gunid, $className);
|
return StoredFile::recall('', $gunid, $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,10 +282,8 @@ class StoredFile {
|
||||||
*/
|
*/
|
||||||
public static function &CopyOf(&$src, $nid)
|
public static function &CopyOf(&$src, $nid)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::insert(
|
$ac = StoredFile::insert($nid, $src->name, $src->_getRealRADFname(),
|
||||||
$src->gb, $nid, $src->name, $src->_getRealRADFname(),
|
'', '', NULL, BasicStor::GetType($src->gunid));
|
||||||
'', '', NULL, BasicStor::GetType($src->gunid)
|
|
||||||
);
|
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
@ -391,7 +357,7 @@ class StoredFile {
|
||||||
{
|
{
|
||||||
$realFname = $this->_getRealRADFname();
|
$realFname = $this->_getRealRADFname();
|
||||||
$ext = $this->_getExt();
|
$ext = $this->_getExt();
|
||||||
$res = $this->gb->bsAccess($realFname, $ext, $this->gunid, 'access', $parent);
|
$res = BasicStor::bsAccess($realFname, $ext, $this->gunid, 'access', $parent);
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +377,7 @@ class StoredFile {
|
||||||
*/
|
*/
|
||||||
public function releaseRawMediaData($token)
|
public function releaseRawMediaData($token)
|
||||||
{
|
{
|
||||||
$res = $this->gb->bsRelease($token);
|
$res = BasicStor::bsRelease($token);
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,7 +287,7 @@ class Transport
|
||||||
switch ($ftype = BasicStor::GetType($gunid)) {
|
switch ($ftype = BasicStor::GetType($gunid)) {
|
||||||
case "audioclip":
|
case "audioclip":
|
||||||
case "webstream":
|
case "webstream":
|
||||||
$ac = StoredFile::recallByGunid($this->gb, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,10 +315,10 @@ if (!camp_db_table_exists($CC_CONFIG['accessTable'])) {
|
||||||
echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n";
|
echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo " * Inserting starting data into tables...";
|
echo " * Inserting starting data into tables...\n";
|
||||||
$gb = new GreenBox();
|
$gb = new GreenBox();
|
||||||
$r = $gb->initData();
|
$r = $gb->initData(true);
|
||||||
echo "done.\n";
|
//echo "done.\n";
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Submodules
|
// Submodules
|
||||||
|
|
|
@ -55,9 +55,13 @@ if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['token'])) {
|
||||||
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");
|
||||||
}
|
}
|
||||||
|
|
||||||
$tc = $gb->bsCheckToken($token, 'put');
|
$tc = BasicStor::bsCheckToken($token, 'put');
|
||||||
if(PEAR::isError($tc)){ http_error(500, $ex->getMessage()); }
|
if (PEAR::isError($tc)) {
|
||||||
if(!$tc){ http_error(403, "put.php: Token not valid ($token)."); }
|
http_error(500, $ex->getMessage());
|
||||||
|
}
|
||||||
|
if (!$tc) {
|
||||||
|
http_error(403, "put.php: Token not valid ($token).");
|
||||||
|
}
|
||||||
|
|
||||||
header("Content-type: text/plain");
|
header("Content-type: text/plain");
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['id'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// stored file recall:
|
// stored file recall:
|
||||||
$ac = StoredFile::recallByGunid($locStor, $gunid);
|
$ac = StoredFile::recallByGunid($gunid);
|
||||||
if (PEAR::isError($ac)) {
|
if (PEAR::isError($ac)) {
|
||||||
switch ($ac->getCode()) {
|
switch ($ac->getCode()) {
|
||||||
case GBERR_DENY:
|
case GBERR_DENY:
|
||||||
|
|
Loading…
Reference in New Issue