diff --git a/.zfproject.xml b/.zfproject.xml index f2620db70..12959c77e 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -56,6 +56,9 @@ + + + @@ -174,6 +177,8 @@ + + @@ -215,6 +220,7 @@ + diff --git a/application/configs/ACL.php b/application/configs/ACL.php index 61f657bae..7803aa471 100644 --- a/application/configs/ACL.php +++ b/application/configs/ACL.php @@ -15,6 +15,7 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('playlist')) ->add(new Zend_Acl_Resource('plupload')) ->add(new Zend_Acl_Resource('schedule')) + ->add(new Zend_Acl_Resource('api')) ->add(new Zend_Acl_Resource('search')); /** Creating permissions */ @@ -23,11 +24,12 @@ $ccAcl->allow('guest', 'index') ->allow('guest', 'error') ->allow('guest', 'library') ->allow('guest', 'search') + ->allow('guest', 'api') ->allow('host', 'plupload') ->allow('host', 'playlist') ->allow('host', 'schedule'); $aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl); -$front = Zend_Controller_Front::getInstance(); +$front = Zend_Controller_Front::getInstance(); $front->registerPlugin($aclPlugin); diff --git a/application/configs/conf.php b/application/configs/conf.php index 0a97c14c4..7779721b5 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -25,6 +25,8 @@ $CC_CONFIG = array( 'apiKey' => array('AAA'), + 'apiPath' => "/api/", + 'baseFilesDir' => __DIR__."/../../files", // main directory for storing binary media files 'storageDir' => __DIR__.'/../../files/stor', @@ -162,4 +164,13 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'] .PATH_SEPARATOR.$CC_CONFIG['zendPath'] .PATH_SEPARATOR.$old_include_path); +//$dsn = $CC_CONFIG['dsn']; +//$CC_DBC = DB::connect($dsn, TRUE); +//if (PEAR::isError($CC_DBC)) { +// echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n"; +// exit(1); +//} +//$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); + + ?> \ No newline at end of file diff --git a/application/models/Playlist.php b/application/models/Playlist.php index a0ec8385d..78333a88b 100644 --- a/application/models/Playlist.php +++ b/application/models/Playlist.php @@ -102,7 +102,14 @@ class Playlist { } - /** + public static function findPlaylistByName($p_name) + { + $res = CcPlaylistQuery::create()->findByDbName($p_name); + return $res; + } + + + /** * Fetch instance of Playlist object.
* * @param string $id @@ -414,7 +421,7 @@ class Playlist { if (is_null($media) || PEAR::isError($media)) { return $media; } - + $metadata = $media->getMetadata(); $length = $metadata["length"]; @@ -425,7 +432,7 @@ class Playlist { // insert at end of playlist. if (is_null($p_position)) $p_position = $this->getNextPos(); - + // insert default values if parameter was empty $p_cuein = !is_null($p_cuein) ? $p_cuein : '00:00:00.000000'; $p_cueout = !is_null($p_cueout) ? $p_cueout : $length; @@ -434,9 +441,9 @@ class Playlist { $sql = "SELECT INTERVAL '{$p_cueout}' - INTERVAL '{$p_cuein}'"; $r = $con->query($sql); $p_cliplength = $r->fetchColumn(0); - + $res = $this->insertPlaylistElement($this->id, $p_mediaId, $p_position, $p_cliplength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut); - + return TRUE; } @@ -629,7 +636,7 @@ class Playlist { $sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'"; $r = $con->query($sql); $cliplength = $r->fetchColumn(0); - + $row->setDbCuein($cueIn); $row->setDBCliplength($cliplength); } diff --git a/application/models/Schedule.php b/application/models/Schedule.php index fa80671f3..76a028061 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -401,6 +401,26 @@ class Schedule { return $t[0]."-".$t[1]."-".$t[2]." ".$t[3].":".$t[4].":00"; } + /** + * Return true if the input string is in the format YYYY-MM-DD-HH-mm + * + * @param string $p_time + * @return boolean + */ + public static function ValidPypoTimeFormat($p_time) + { + $t = explode("-", $p_time); + if (count($t) != 5) { + return false; + } + foreach ($t as $part) { + if (!is_numeric($part)) { + return false; + } + } + return true; + } + /** * Converts a time value as a string (with format HH:MM:SS.mmmmmm) to * millisecs. diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php index 052885be6..9925fcc63 100644 --- a/application/models/StoredFile.php +++ b/application/models/StoredFile.php @@ -1697,7 +1697,7 @@ class StoredFile { { global $CC_CONFIG; return "http://".$CC_CONFIG["storageUrlHost"] - .$CC_CONFIG["apiPath"]."get_media.php?file=" + .$CC_CONFIG["apiPath"]."getMedia/file/" .$this->gunid.".".$this->getFileExtension(); } diff --git a/backend/.htaccess b/backend/.htaccess deleted file mode 100644 index ba3404cb8..000000000 --- a/backend/.htaccess +++ /dev/null @@ -1,12 +0,0 @@ -DirectoryIndex index.php -Options +FollowSymLinks -Indexes - - - - AddType application/x-httpd-php .php - - php_flag magic_quotes_gpc On - php_flag register_globals Off - - - diff --git a/backend/AccessRecur.php b/backend/AccessRecur.php deleted file mode 100644 index ae78c8807..000000000 --- a/backend/AccessRecur.php +++ /dev/null @@ -1,184 +0,0 @@ -ls =& $ls; - $this->sessid = $sessid; - } - - - public static function accessPlaylist(&$ls, $sessid, $plid, $parent='0') - { - $ppa = new AccessRecur($ls, $sessid); - $r = $ls->accessPlaylist($sessid, $plid, FALSE, $parent); - if (PEAR::isError($r)) { - return $r; - } - $plRes = $r; - $r = StoredFile::RecallByGunid($plid); - if (is_null($r) || PEAR::isError($r)) { - return $r; - } - $ac = $r; - $r = $ac->md->genPhpArray(); - if (PEAR::isError($r)) { - return $r; - } - $pla = $r; - $r = $ppa->processPlaylist($pla, $plRes['token']); - if (PEAR::isError($r)) { - return $r; - } - $plRes['content'] = $r; - return $plRes; - } - - - public static function releasePlaylist(&$ls, $sessid, $token) - { - global $CC_CONFIG, $CC_DBC; - $ppa = new AccessRecur($ls, $sessid); - $r = $CC_DBC->getAll(" - SELECT to_hex(token)as token2, to_hex(gunid)as gunid - FROM ".$CC_CONFIG['accessTable']." - WHERE parent=x'{$token}'::bigint - "); - if (PEAR::isError($r)) { - return $r; - } - $arr = $r; - foreach ($arr as $i => $item) { - extract($item); // token2, gunid - $r = BasicStor::GetType($gunid); - if (PEAR::isError($r)) { - return $r; - } - $ftype = $r; - # echo "$ftype/$token2\n"; - switch (strtolower($ftype)) { - case "audioclip": - $r = $ppa->ls->releaseRawAudioData($ppa->sessid, $token2); - if (PEAR::isError($r)) { - return $r; - } - # var_dump($r); - break; - case "playlist": - $r = $ppa->releasePlaylist($ppa->ls, $ppa->sessid, $token2); - if (PEAR::isError($r)) { - return $r; - } - # var_dump($r); - break; - default: - } - } - $r = $ppa->ls->releasePlaylist($ppa->sessid, $token, FALSE); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - private function processPlaylist($pla, $parent) - { - $res = array(); - foreach ($pla['children'] as $ple) { - switch ($ple['elementname']) { - case "playlistElement": - $r = $this->processPlaylistElement($ple, $parent); - if (PEAR::isError($r)) { - return $r; - } - // $res = array_merge($res, $r); - $res[] = $r; - break; - default: - } - } - return $res; - } - - - private function processAudioClip($gunid, $parent) - { - $r = $this->ls->accessRawAudioData($this->sessid, $gunid, $parent); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - private function processPlaylistElement($ple, $parent='0') - { - foreach ($ple['children'] as $ac) { - switch ($ac['elementname']) { - case "audioClip": - $r = $this->processAudioClip($ac['attrs']['id'], $parent); - if (PEAR::isError($r)) { - return $r; - } - return $r; - case "playlist": - // if(empty($ac['children'])){ - $r = $this->accessPlaylist($this->ls, $this->sessid, - $ac['attrs']['id'], $parent); - if (PEAR::isError($r)) { - if ($r->getCode() != GBERR_NOTF) { - return $r; - } else { - $r = $this->processPlaylist($ac, $parent); - if (PEAR::isError($r)) { - return $r; - } - $r = array( - 'content' => $r, - 'url' => NULL, - 'token' => NULL, - 'chsum' => NULL, - 'size' => NULL, - 'warning' => 'inline playlist?', - ); - } - } - return $r; - /* - }else{ - $r = $this->processPlaylist($ac, $parent); - if(PEAR::isError($r)) return $r; - $res = array( - 'content' => $r, - 'url' => NULL, - 'token' => NULL, - 'chsum' => NULL, - 'size' => NULL, - 'warning' => 'inline playlist', - ); - return $res; - } - */ - break; - default: - } - } - return array(); - } - -} // class AccessRecur -?> \ No newline at end of file diff --git a/backend/Alib.php b/backend/Alib.php deleted file mode 100644 index b9e16d6ca..000000000 --- a/backend/Alib.php +++ /dev/null @@ -1,622 +0,0 @@ -query($sql); - if (PEAR::isError($r)) { - return $r; - } - Subjects::SetTimeStamp($login, FALSE); - return $sessid; - } // fn login - - - /** - * Logout and destroy session - * - * @param string $sessid - * @return true|PEAR_Error - */ - public static function Logout($sessid) - { - global $CC_CONFIG, $CC_DBC; - $ct = Alib::CheckAuthToken($sessid); - if ($ct === FALSE) { - return PEAR::raiseError("Alib::logout: not logged ($sessid)", - ALIBERR_NOTLOGGED, PEAR_ERROR_RETURN); - } elseif (PEAR::isError($ct)) { - return $ct; - } else { - $sql = "DELETE FROM ".$CC_CONFIG['sessTable'] - ." WHERE sessid='$sessid'"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - } // fn logout - - - /** - * Return true if the token is valid - * - * @param string $sessid - * @return boolean|PEAR_Error - */ - private static function CheckAuthToken($sessid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['sessTable'] - ." WHERE sessid='$sessid'"; - $c = $CC_DBC->getOne($sql); - return ($c == 1 ? TRUE : (PEAR::isError($c) ? $c : FALSE )); - } //fn checkAuthToken - - - /** - * Set valid token in alib object - * - * @param string $sessid - * @return TRUE|PEAR_Error - */ - // public function setAuthToken($sessid) - // { - // $r = $this->checkAuthToken($sessid); - // if (PEAR::isError($r)) { - // return $r; - // } - // if (!$r) { - // return PEAR::raiseError("ALib::setAuthToken: invalid token ($sessid)"); - // } - // //$this->sessid = $sessid; - // return TRUE; - // } // fn setAuthToken - - - /* -------------------------------------------------------- authorization */ - /** - * Insert permission record - * - * @param int $sid - * local user/group id - * @param string $action - * @param int $oid - * local object id - * @param string $type - * 'A'|'D' (allow/deny) - * @return int - * local permission id - */ - public static function AddPerm($sid, $action, $oid, $type='A') - { - global $CC_CONFIG, $CC_DBC; - $permid = $CC_DBC->nextId($CC_CONFIG['permSequence']); - $sql = "INSERT INTO ".$CC_CONFIG['permTable']." (permid, subj, action, obj, type)" - ." VALUES ($permid, $sid, '$action', $oid, '$type')"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return($r); - } - return $permid; - } // fn addPerm - - - /** - * Remove permission record - * - * @param int $permid - * local permission id - * @param int $subj - * local user/group id - * @param int $obj - * local object id - * @return boolean|PEAR_Error - */ - public static function RemovePerm($permid=NULL, $subj=NULL, $obj=NULL) - { - global $CC_CONFIG, $CC_DBC; - $ca = array(); - if ($permid) { - $ca[] = "permid=$permid"; - } - if ($subj) { - $ca[] = "subj=$subj"; - } - if ($obj) { - $ca[] = "obj=$obj"; - } - $cond = join(" AND ", $ca); - if (!$cond) { - return TRUE; - } - $sql = "DELETE FROM ".$CC_CONFIG['permTable']." WHERE $cond"; - return $CC_DBC->query($sql); - } // fn removePerm - - - /** - * Return object related with permission record - * - * @param int $permid - * local permission id - * @return int - * local object id - */ - public static function GetPermOid($permid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT obj FROM ".$CC_CONFIG['permTable']." WHERE permid=$permid"; - $res = $CC_DBC->getOne($sql); - return $res; - } // fn GetPermOid - - - /** - * Check if specified subject have permission to specified action - * on specified object - * - * Look for sequence of corresponding permissions and order it by - * relevence, then test the most relevant for result. - * High relevence have direct permission (directly for specified subject - * and object. Relevance order is done by level distance in the object - * tree, level distance in subjects (user/group system). - * Similar way is used for permissions related to object classes. - * But class-related permissions have lower priority then - * object-tree-related. - * Support for object classes can be disabled by USE_ALIB_CLASSES const. - * - * @param int $sid - * subject id (user or group id) - * @param string $action - * from set defined in config - * @param int $oid - * object id (default: root node) - * @return boolean|PEAR_Error - */ - public static function CheckPerm($sid, $action, $oid=NULL) - { - return TRUE; - // global $CC_DBC; - // global $CC_CONFIG; - // if (!is_numeric($sid)) { - // return FALSE; - // } - //// if (is_null($oid) or $oid=='') { - //// $oid = M2tree::GetRootNode(); - //// } - //// if (PEAR::isError($oid)) { - //// return $oid; - //// } - // if (!is_numeric($oid)) { - // return FALSE; - // } - // // query construction - // // shortcuts: - // // p: permTable, - // // s: subjTable, m smembTable, - // // t: treeTable ts: structTable, - // // c: classTable, cm: cmembTable - // // main query elements: - // $q_flds = "m.level , p.subj, s.login, action, p.type, p.obj"; - // $q_from = $CC_CONFIG['permTable']." p "; - // // joins for solving users/groups: - // $q_join = "LEFT JOIN ".$CC_CONFIG['subjTable']." s ON s.id=p.subj "; - // $q_join .= "LEFT JOIN ".$CC_CONFIG['smembTable']." m ON m.gid=p.subj "; - // $q_cond = "p.action in('_all', '$action') AND - // (s.id=$sid OR m.uid=$sid) "; - // // coalesce -1 for higher priority of nongroup rows: - // // action DESC order for lower priority of '_all': - // $q_ordb = "ORDER BY coalesce(m.level,-1), action DESC, p.type DESC"; - // $q_flds0 = $q_flds; - // $q_from0 = $q_from; - // $q_join0 = $q_join; - // $q_cond0 = $q_cond; - // $q_ordb0 = $q_ordb; - // // joins for solving object tree: - // $q_flds .= ", t.name, ts.level as tlevel"; - // //$q_join .= "LEFT JOIN ".$CC_CONFIG['treeTable']." t ON t.id=p.obj "; - // //$q_join .= "LEFT JOIN ".$CC_CONFIG['structTable']." ts ON ts.parid=p.obj "; - // //$q_cond .= " AND (t.id=$oid OR ts.objid=$oid)"; - // // action DESC order is hack for lower priority of '_all': - // $q_ordb = "ORDER BY coalesce(ts.level,0), m.level, action DESC, p.type DESC"; - // // query by tree: - // $query1 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb"; - // $r1 = $CC_DBC->getAll($query1); - // if (PEAR::isError($r1)) { - // return($r1); - // } - // // if there is row with type='A' on the top => permit - // //$AllowedByTree = - // // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='A'); - // //$DeniedByTree = - // // (is_array($r1) && count($r1)>0 && $r1[0]['type']=='D'); - // - // if (!USE_ALIB_CLASSES) { - // return $AllowedbyTree; - // } - // - // // joins for solving object classes: - // $q_flds = $q_flds0.", c.cname "; - // $q_join = $q_join0."LEFT JOIN ".$CC_CONFIG['classTable']." c ON c.id=p.obj "; - // $q_join .= "LEFT JOIN ".$CC_CONFIG['cmembTable']." cm ON cm.cid=p.obj "; - // $q_cond = $q_cond0." AND (c.id=$oid OR cm.objid=$oid)"; - // $q_ordb = $q_ordb0; - // // query by class: - // $query2 = "SELECT $q_flds FROM $q_from $q_join WHERE $q_cond $q_ordb"; - // $r2 = $CC_DBC->getAll($query2); - // if (PEAR::isError($r2)) { - // return $r2; - // } - // $AllowedByClass = - // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='A'); - // // not used now: - // // $DeniedByClass = - // // (is_array($r2) && count($r2)>0 && $r2[0]['type']=='D'); - // $res = ($AllowedByTree || (!$DeniedByTree && $AllowedByClass)); - // return $res; - } // fn CheckPerm - - - /* ---------------------------------------------------------- object tree */ - - /** - * Remove all permissions on object and then remove object itself - * - * @param int $id - * @return void|PEAR_Error - */ - public static function RemoveObj($id) - { - $r = Alib::RemovePerm(NULL, NULL, $id); - return $r; - } // fn removeObj - - /* --------------------------------------------------------- users/groups */ - - /** - * Remove all permissions of subject and then remove subject itself - * - * @param string $login - * @return void|PEAR_Error - */ - public static function RemoveSubj($login) - { - global $CC_CONFIG, $CC_DBC; - $uid = Subjects::GetSubjId($login); - if (PEAR::isError($uid)) { - return $uid; - } - if (is_null($uid)){ - return $CC_DBC->raiseError("Alib::removeSubj: Subj not found ($login)", - ALIBERR_NOTEXISTS, PEAR_ERROR_RETURN); - } - $r = Alib::RemovePerm(NULL, $uid); - if (PEAR::isError($r)) { - return $r; - } - return Subjects::RemoveSubj($login, $uid); - } // fn RemoveSubj - - - /* ------------------------------------------------------------- sessions */ - /** - * Get login from session id (token) - * - * @param string $sessid - * @return string|PEAR_Error - */ - public static function GetSessLogin($sessid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT login FROM ".$CC_CONFIG['sessTable']." WHERE sessid='$sessid'"; - $r = $CC_DBC->getOne($sql); - if (PEAR::isError($r)) { - return $r; - } - if (is_null($r)){ - return PEAR::raiseError("Alib::GetSessLogin:". - " invalid session id ($sessid)", - ALIBERR_NOTEXISTS, PEAR_ERROR_RETURN); - } - return $r; - } // fn GetSessLogin - - - /** - * Get user id from session id. - * - * @param string $p_sessid - * @return int|PEAR_Error - */ - public static function GetSessUserId($p_sessid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT userid FROM ".$CC_CONFIG['sessTable']." WHERE sessid='$p_sessid'"; - $r = $CC_DBC->getOne($sql); - if (PEAR::isError($r)) { - return $r; - } - if (is_null($r)) { - return PEAR::raiseError("Alib::getSessUserId:". - " invalid session id ($p_sessid)", - ALIBERR_NOTEXISTS, PEAR_ERROR_RETURN); - } - return $r; - } // fn getSessUserId - - - /* --------------------------------------------------------- info methods */ - /** - * Get all permissions on object. - * - * @param int $id - * @return array|null|PEAR_Error - */ - public static function GetObjPerms($id) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT s.login, p.* FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['subjTable']." s" - ." WHERE s.id=p.subj AND p.obj=$id"; - return $CC_DBC->getAll($sql); - } // fn GetObjPerms - - - /** - * Get all permissions of subject. - * - * @param int $sid - * @return array - */ - public static function GetSubjPerms($sid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT *" - ." FROM ".$CC_CONFIG['permTable'] - ." WHERE p.subj=$sid"; - // $sql = "SELECT t.name, t.type as otype , p.*" - // ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['treeTable']." t" - // ." WHERE t.id=p.obj AND p.subj=$sid"; - $a1 = $CC_DBC->getAll($sql); - return $a1; - } // fn GetSubjPerms - - - /* ------------------------ info methods related to application structure */ - /* (this part should be added/rewritten to allow defining/modifying/using - * application structure) - * (only very simple structure definition - in $CC_CONFIG - supported now) - */ - - /** - * Get all actions - * - * @return array - */ - public static function GetAllActions() - { - global $CC_CONFIG; - return $CC_CONFIG['allActions']; - } // fn GetAllActions - - - /** - * Get all allowed actions on specified object type. - * - * @param string $type - * @return array - */ - public static function GetAllowedActions($type) - { - global $CC_CONFIG; - return $CC_CONFIG['allowedActions'][$type]; - } // fn GetAllowedActions - - - /* ====================================================== private methods */ - - /** - * Create new session id. Return the new session ID. - * - * @return string - */ - private static function _createSessid() - { - global $CC_CONFIG, $CC_DBC; - for ($c = 1; $c > 0; ){ - $sessid = md5(uniqid(rand())); - $sql = "SELECT count(*) FROM ".$CC_CONFIG['sessTable'] - ." WHERE sessid='$sessid'"; - $c = $CC_DBC->getOne($sql); - if (PEAR::isError($c)) { - return $c; - } - } - return $sessid; - } // fn _createSessid - - - /* =============================================== test and debug methods */ - - /** - * Dump all permissions for debug - * - * @param string $indstr - * indentation string - * @param string $ind - * actual indentation - * @return string - */ - public static function DumpPerms($indstr=' ', $ind='') - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT s.login, p.action, p.type" - ." FROM ".$CC_CONFIG['permTable']." p, ".$CC_CONFIG['subjTable']." s" - ." WHERE s.id=p.subj" - ." ORDER BY p.permid"; - $arr = $CC_DBC->getAll($sql); - if (PEAR::isError($arr)) { - return $arr; - } - $r = $ind.join(', ', array_map(create_function('$v', - 'return "{$v[\'login\']}/{$v[\'action\']}/{$v[\'type\']}";' - ), - $arr - ))."\n"; - return $r; - } // fn dumpPerms - - - /** - * Delete everything form the permission table and session table. - * - * @return void - */ - public static function DeleteData() - { - global $CC_CONFIG, $CC_DBC; - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['permTable']); - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['sessTable']); - Subjects::DeleteData(); - } // fn deleteData - - - /** - * Insert test permissions - * - * @return array - */ - public static function TestData() - { - global $CC_CONFIG, $CC_DBC; - $tdata = Subjects::TestData(); - $t =& $tdata['tree']; - $c =& $tdata['classes']; - $s =& $tdata['subjects']; - $CC_DBC->setErrorHandling(PEAR_ERROR_PRINT); - $perms = array( - array($s['root'], '_all', $t['root'], 'A'), - array($s['test1'], '_all', $t['pa'], 'A'), - array($s['test1'], 'read', $t['s2b'], 'D'), - array($s['test2'], 'addChilds', $t['pa'], 'D'), - array($s['test2'], 'read', $t['i2'], 'A'), - array($s['test2'], 'edit', $t['s1a'], 'A'), - array($s['test1'], 'addChilds', $t['s2a'], 'D'), - array($s['test1'], 'addChilds', $t['s2c'], 'D'), - array($s['gr2'], 'addChilds', $t['i2'], 'A'), - array($s['test3'], '_all', $t['t1'], 'D'), - ); - if (USE_ALIB_CLASSES){ - $perms[] = array($s['test3'], 'read', $c['cl_sa'], 'D'); - $perms[] = array($s['test4'], 'editPerms', $c['cl2'], 'A'); - } - foreach ($perms as $p){ - $o[] = $r = Alib::AddPerm($p[0], $p[1], $p[2], $p[3]); - if (PEAR::isError($r)) { - return $r; - } - } - $tdata['perms'] = $o; - return $tdata; - } // fn testData - - - /** - * Make basic test - * - * @return boolean|PEAR_Error - */ - public static function Test() - { - $p = Subjects::test(); - if (PEAR::isError($p)) { - return $p; - } - Alib::DeleteData(); - $tdata = Alib::TestData(); - if (PEAR::isError($tdata)) { - return $tdata; - } - $test_correct = "root/_all/A, test1/_all/A, test1/read/D,". - " test2/addChilds/D, test2/read/A, test2/edit/A,". - " test1/addChilds/D, test1/addChilds/D, gr2/addChilds/A,". - " test3/_all/D"; - if (USE_ALIB_CLASSES){ - $test_correct .= ", test3/read/D, test4/editPerms/A"; - } - $test_correct .= "\nno, yes\n"; - $r = Alib::DumpPerms(); - if (PEAR::isError($r)) { - return $r; - } - $test_dump = $r. - (Alib::CheckPerm( - $tdata['subjects']['test1'], 'read', - $tdata['tree']['t1'] - )? 'yes':'no').", ". - (Alib::CheckPerm( - $tdata['subjects']['test1'], 'addChilds', - $tdata['tree']['i2'] - )? 'yes':'no')."\n" - ; - Alib::RemovePerm($tdata['perms'][1]); - Alib::RemovePerm($tdata['perms'][3]); - $test_correct .= "root/_all/A, test1/read/D,". - " test2/read/A, test2/edit/A,". - " test1/addChilds/D, test1/addChilds/D, gr2/addChilds/A,". - " test3/_all/D"; - if (USE_ALIB_CLASSES) { - $test_correct .= ", test3/read/D, test4/editPerms/A"; - } - $test_correct .= "\n"; - $test_dump .= Alib::DumpPerms(); - Alib::DeleteData(); - if ($test_dump == $test_correct) { - $test_log .= "alib: OK\n"; - return TRUE; - } else { - return PEAR::raiseError('Alib::test', 1, PEAR_ERROR_DIE, '%s'. - "
\ncorrect:\n{$test_correct}\n".
-                "dump:\n{$test_dump}\n
\n"); - } - } // fn test - -} // class Alib -?> \ No newline at end of file diff --git a/backend/Backup.php b/backend/Backup.php deleted file mode 100755 index c05500264..000000000 --- a/backend/Backup.php +++ /dev/null @@ -1,487 +0,0 @@ -gb =& $gb; - $this->token = null; - $this->logFile = $CC_CONFIG['bufferDir'].'/'.ACCESS_TYPE.'.log'; - $this->addLogItem("-I- ".date("Ymd-H:i:s")." construct\n"); - } - - - /** - * Open a backup - * Create a backup file (tarball) - * - * @param string $sessid - * @param array $criteria - * struct - see search criteria - * @return array - * hasharray with field: - * token string: backup token - */ - public function openBackup($sessid, $criteria='') - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." openBackup - sessid:$sessid\n"); - } - $this->sessid = $sessid; - $this->criteria = $criteria; - - // get ids (and real filenames) which files match with criteria - $srch = $this->gb->localSearch($this->criteria,$this->sessid); - if (PEAR::isError($srch)) { - return $srch; - } - $this->setIDs($srch); - - // get real filenames - if (is_array($this->ids)) { - $this->setFilenames(); - - $this->setEnviroment(true); - - // write a status file - file_put_contents($this->statusFile, 'working'); - - // save the metafile to tmpdir - $hostname = trim(`hostname`); - $ctime = time(); - $ctime_f = date("Ymd-H:i:s"); - file_put_contents("{$this->tmpDirMeta}/storage.xml", - "\n". - "\n" - ); - - // copy all file to tmpdir - $this->copyAllFiles(); - - // do everything - $this->doIt(); - - return array('token'=>$this->token); - } else { - return false; - } - } - - - /** - * Check the status of backup. - * - * @param unknown $token - * @return array - * status : string - susccess | working | fault - * faultString: string - description of fault - * token : stirng - backup token - * url : string - access url - * tmpfile : string - access filename - */ - public function checkBackup($token) - { - global $CC_CONFIG; - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." checkBackup - token:$token\n"); - } - $this->token = $token; - $this->setEnviroment(); - $status = file_get_contents($this->statusFile); - if (strpos($status,'fault')!==false) { - list($status,$faultString) = explode('|',$status); - } - switch ($status) { - case 'success': - $r['url'] = BasicStor::GetUrlPart()."access/$token.".BACKUP_EXT; - $r['tmpfile'] = $CC_CONFIG['accessDir']."/$token.".BACKUP_EXT; - case 'working': - case 'fault': - $r['status'] = $status; - $r['faultString'] = $faultString; - $r['token'] = $token; - break; - } - return $r; - } - - - /** - * Close a backup - * - * @param unknown $token - * @return boolean - */ - public function closeBackup($token) - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." closeBackup - token:$token\n"); - } - # post procedures - $this->token = $token; - $this->setEnviroment(); - BasicStor::bsRelease($token, ACCESS_TYPE); - Backup::rRmDir($this->tmpDir); - unlink($this->statusFile); - unlink($this->tmpFile); - if (is_file($this->tmpName)) { - unlink($this->tmpName); - } - return !is_file($this->tmpFile); - } - - - /** - * list of unclosed backups - * - * @param string $stat - * if this parameter is not set, then return with all unclosed backups - * @return array of hasharray with field: - * status : string - susccess | working | fault - * token : stirng - backup token - * url : string - access url - */ - public function listBackups($stat='') - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." listBackups - stat:$stat\n"); - } - // open temporary dir - $tokens = BasicStor::GetTokensByType(ACCESS_TYPE); - // echo 'tokens:'; print_r($tokens); echo ''; - foreach ($tokens as $token) { - $st = $this->checkBackup($token); - if ($stat=='' || $st['status']==$stat) { - $r[] = $st; - } - } - return $r; - } - - - /** - * Set the ids from searchResult - * - * @param array $searchResult : array of gunids - */ - private function setIDs($searchResult) - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." setIDs\n"); - } - if (is_array($searchResult['results'])) { - $this->ids = $searchResult['results']; - } else { - $this->addLogItem("-E- ".date("Ymd-H:i:s")." setIDs - the parameter is not array!\n"); - return PEAR::raiseError('The IDs variable isn\'t array.'); - } - } - - - /** - * Set the filenames from ids. - * - */ - private function setFilenames() - { - // if ($this->loglevel=='debug') { - // $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames\n"); - // } - // if (is_array($this->ids)) { - // foreach ($this->ids as $i => $item) { - // $gunid = $item['gunid']; - // // get a stored file object of this gunid - // $sf = StoredFile::RecallByGunid($gunid); - // if (is_null($sf) || PEAR::isError($sf)) { - // return $sf; - // } - // $lid = BasicStor::IdFromGunid($gunid); - // if (($res = BasicStor::Authorize('read', $lid, $this->sessid)) !== TRUE) { - // $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - authorize gunid:$gunid\n"); - // return PEAR::raiseError('Backup::setFilenames : Authorize ... error.'); - // } - // // if the file is a playlist then it has only a meta file - // if (strtolower($sf->md->format) != 'playlist') { - // $this->filenames[] = array( - // 'filename' => $sf->getRealFileName(), - // 'format' => $sf->md->format - // ); - // } - // $this->filenames[] = array( - // 'filename' => $sf->getRealMetadataFileName(), - // 'format' => $sf->md->format - // ); - // if ($this->loglevel=='debug') { - // $this->addLogItem("-I- ".date("Ymd-H:i:s")." setFilenames - add file: {$sf->md->format}|".$sf->getRealMetadataFileName()."\n"); - // } - // } - // return $this->filenames; - // } else { - // $this->addLogItem("-E- ".date("Ymd-H:i:s")." setFilenames - The IDs variable isn't array.\n"); - // return PEAR::raiseError('Backup::setFilenames : The IDs variable isn\'t array.'); - // } - } - - - /** - * Create the tarball - call the shell script - * - */ - private function doIt() - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." doIt\n"); - } - $command = dirname(__FILe__)."/../bin/backup.sh" - ." {$this->tmpDir}" - ." {$this->tmpFile}" - ." {$this->statusFile}" - ." >> {$this->logFile} &"; - $res = system("$command"); - sleep(2); - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." doIt - command:$command\n"); - } - } - - - /** - * Copy the real files into the tmp dirs to tar they. - * - */ - private function copyAllFiles() - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." copyAllFiles\n"); - } - //echo 'this->filenames:'; print_r($this->filenames); echo ''; - if (is_array($this->filenames)) { - foreach ($this->filenames as $v) { - # get the filename from full path - $fn = substr($v['filename'],strrpos($v['filename'],'/')); - switch (strtolower($v['format'])) { - case 'playlist': - # if playlist then copy to the playlist dir - copy($v['filename'],$this->tmpDirPlaylist.$fn); - break; - case 'audioclip': - # if audioclip then copy to the audioclip dir - copy($v['filename'],$this->tmpDirClip.$fn); - break; - } - } - } - } - - - /** - * Figure out the enviroment to the backup - * - */ - private function setEnviroment($createDir=false) - { - global $CC_CONFIG; - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." setEnviroment - createDirs:$createDir\n"); - } - // create temporary directories - if (is_null($this->token) && $createDir) { - $this->tmpName = tempnam($CC_CONFIG['bufferDir'], ACCESS_TYPE.'_'); - $this->tmpFile = $this->tmpName.'.'.BACKUP_EXT; - $this->tmpDir = $this->tmpName.'.dir'; - $this->tmpDirPlaylist = $this->tmpDir. '/playlist'; - $this->tmpDirClip = $this->tmpDir. '/audioClip'; - $this->tmpDirMeta = $this->tmpDir. '/meta-inf'; - touch($this->tmpFile); - mkdir($this->tmpDir); - mkdir($this->tmpDirPlaylist); - mkdir($this->tmpDirClip); - mkdir($this->tmpDirMeta); - $this->genToken(); - } else { - $symlink = $CC_CONFIG['accessDir'].'/'.$this->token.'.'.BACKUP_EXT; - if (is_link($symlink) && is_file(readlink($symlink))) { - $this->tmpName = str_replace('.tar','',readlink($symlink)); - $this->tmpFile = $this->tmpName.'.'.BACKUP_EXT; - $this->tmpDir = $this->tmpName.'.dir'; - $this->tmpDirPlaylist = $this->tmpDir. '/playlist'; - $this->tmpDirClip = $this->tmpDir. '/audioClip'; - $this->tmpDirMeta = $this->tmpDir. '/meta-inf'; - } else { - $this->addLogItem("-E- ".date("Ymd-H:i:s")." setEnviroment - Corrupt symbolic link.\n"); - return false; - } - } - $this->statusFile = $CC_CONFIG['accessDir'].'/'.$this->token.'.'.BACKUP_EXT.'.status'; - if ($this->loglevel=='debug') { - $this->addLogItem("this->tmpName: $this->tmpName\n"); - $this->addLogItem("this->tmpFile: $this->tmpFile\n"); - $this->addLogItem("this->tmpDir: $this->tmpDir\n"); - $this->addLogItem("this->tmpDirPlaylist: $this->tmpDirPlaylist\n"); - $this->addLogItem("this->tmpDirClip: $this->tmpDirClip\n"); - $this->addLogItem("this->tmpDirMeta: $this->tmpDirMeta\n"); - $this->addLogItem("this->token: $this->token\n"); - $this->addLogItem("this->statusFile: $this->statusFile\n"); - } - } - - - /** - * Generate a new token. - * @return void - */ - private function genToken() - { - $acc = BasicStor::bsAccess($this->tmpFile, BACKUP_EXT, null, ACCESS_TYPE); - if (PEAR::isError($acc)) { - return $acc; - } - $this->token = $acc['token']; - } - - - /** - * Add a line to the logfile. - * - * @param string $item - * the new row of log file - */ - private function addLogItem($item) - { - $f = fopen($this->logFile,'a'); - fwrite($f,$item); - fclose($f); - } - - - /** - * Delete a directory recursive - * - * @param string $dirname - * path of dir. - */ - private static function rRmDir($dirname) - { - if (is_dir($dirname)) { - $dir_handle = opendir($dirname); - } - while ($file = readdir($dir_handle)) { - if ( ($file != ".") && ($file != "..") ) { - if (!is_dir($dirname."/".$file)) { - unlink ($dirname."/".$file); - } else { - Backup::rRmDir($dirname."/".$file); - } - } - } - closedir($dir_handle); - rmdir($dirname); - return true; - } - -} // classs Backup -?> diff --git a/backend/BasicStor.php b/backend/BasicStor.php deleted file mode 100644 index ed517eabd..000000000 --- a/backend/BasicStor.php +++ /dev/null @@ -1,2186 +0,0 @@ - - *
    - *
  • filetype - string, type of searched files, - * meaningful values: 'audioclip', 'webstream', 'playlist', 'all'
  • - *
  • operator - string, type of conditions join - * (any condition matches / all conditions match), - * meaningful values: 'and', 'or', '' - * (may be empty or ommited only with less then 2 items in - * "conditions" field) - *
  • - *
  • orderby : string - metadata category for sorting (optional) - * or array of strings for multicolumn orderby - * [default: dc:creator, dc:source, dc:title] - *
  • - *
  • desc : boolean - flag for descending order (optional) - * or array of boolean for multicolumn orderby - * (it corresponds to elements of orderby field) - * [default: all ascending] - *
  • - *
  • conditions - array of hashes with structure: - *
      - *
    • cat - string, metadata category name
    • - *
    • op - string, operator - meaningful values: - * 'full', 'partial', 'prefix', '=', '<', - * '<=', '>', '>='
    • - *
    • val - string, search value
    • - *
    - *
  • - *
- *

- * Format of search/browse results: hash, with following structure:
- *

    - *
  • results : array of gunids have found
  • - *
  • cnt : integer - number of matching items
  • - *
- * - */ -define('GBERR_DENY', 40); -define('GBERR_FILEIO', 41); -define('GBERR_FILENEX', 42); -define('GBERR_FOBJNEX', 43); -define('GBERR_WRTYPE', 44); -define('GBERR_NONE', 45); -define('GBERR_AOBJNEX', 46); -define('GBERR_NOTF', 47); -define('GBERR_SESS', 48); -define('GBERR_PREF', 49); -define('GBERR_TOKEN', 50); -define('GBERR_PUT', 51); -define('GBERR_LOCK', 52); -define('GBERR_GUNID', 53); -define('GBERR_BGERR', 54); -define('GBERR_NOTIMPL', 69); - -require_once(dirname(__FILE__)."/Alib.php"); -require_once(dirname(__FILE__)."/StoredFile.php"); -require_once(dirname(__FILE__)."/Transport.php"); -require_once(dirname(__FILE__)."/Playlist.php"); - -//$g_metadata_xml_to_db_mapping = array( -// "dc:format" => "format", -// "ls:bitrate" => "bit_rate", -// "ls:samplerate" => "sample_rate", -// "dcterms:extent" => "length", -// "dc:title" => "track_title", -// "dc:description" => "comments", -// "dc:type" => "genre", -// "dc:creator" => "artist_name", -// "dc:source" => "album_title", -// "ls:channels" => "channels", -// "ls:filename" => "name", -// "ls:year" => "year", -// "ls:url" => "url", -// "ls:track_num" => "track_number", -// "ls:mood" => "mood", -// "ls:bpm" => "bpm", -// "ls:disc_num" => "disc_number", -// "ls:rating" => "rating", -// "ls:encoded_by" => "encoded_by", -// "dc:publisher" => "label", -// "ls:composer" => "composer", -// "ls:encoder" => "encoder", -// "ls:crc" => "checksum", -// "ls:lyrics" => "lyrics", -// "ls:orchestra" => "orchestra", -// "ls:conductor" => "conductor", -// "ls:lyricist" => "lyricist", -// "ls:originallyricist" => "original_lyricist", -// "ls:radiostationname" => "radio_station_name", -// "ls:audiofileinfourl" => "info_url", -// "ls:artisturl" => "artist_url", -// "ls:audiosourceurl" => "audio_source_url", -// "ls:radiostationurl" => "radio_station_url", -// "ls:buycdurl" => "buy_this_url", -// "ls:isrcnumber" => "isrc_number", -// "ls:catalognumber" => "catalog_number", -// "ls:originalartist" => "original_artist", -// "dc:rights" => "copyright", -// "dcterms:temporal" => "report_datetime", -// "dcterms:spatial" => "report_location", -// "dcterms:entity" => "report_organization", -// "dc:subject" => "subject", -// "dc:contributor" => "contributor", -// "dc:language" => "language"); - -/** - * Core of Campcaster file storage module - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @see Alib - */ -class BasicStor { - public $storId; - private $fileTypes; - - public function __construct() - { - $this->filetypes = array( - 'all'=>NULL, - 'audioclip'=>'audioclip', - 'webstream'=>'webstream', - 'playlist'=>'playlist', - ); - } - - - /** - * Store new file in the storage - * - * @param array $p_values - * See StoredFile::Insert() for details. - * @param boolean $copyMedia - * copy the media file if true, make symlink if false - * @return StoredFile|PEAR_Error - * The StoredFile that was created. - */ - // public function bsPutFile($p_values, $p_copyMedia=TRUE) - // { - // $storedFile = StoredFile::Insert($p_values, $p_copyMedia); - // return $storedFile; - // } - - - /** - * Rename file - * - * @param int $id - * Virtual file's local id - * @param string $newName - * @return boolean|PEAR_Error - */ - // public function bsRenameFile($id, $newName) - // { - // switch (BasicStor::GetObjType($id)) { - // case "audioclip": - // case "playlist": - // case "webstream": - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // // catch nonerror exception: - // //if($storedFile->getCode() != GBERR_FOBJNEX) - // return $storedFile; - // } - // $res = $storedFile->setName($newName); - // if (PEAR::isError($res)) { - // return $res; - // } - // break; - // case "File": - // default: - // } - // return TRUE; - // } - - - /** - * Replace file. Doesn't change filetype! - * - * @param int $id - * Virtual file's local id - * @param string $localFilePath - * Local path of media file - * @param string $metadataFilePath - * Local path of metadata file - * @param string $mdataLoc - * 'file'|'string' - * @return true|PEAR_Error - * @exception PEAR::error - */ - // public function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file') - // { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // if (!empty($metadataFilePath) && - // ($mdataLoc!='file' || file_exists($metadataFilePath))) { - // $r = $storedFile->setMetadata($metadataFilePath, $mdataLoc); - // if (PEAR::isError($r)) { - // return $r; - // } - // } - // if (!empty($localFilePath) && file_exists($localFilePath)) { - // $r = $storedFile->setRawMediaData($localFilePath); - // if (PEAR::isError($r)) { - // return $r; - // } - // } - // return TRUE; - // } - - - /** - * Delete file - * - * @param int $id - * Virtual file's local id - * @param boolean $forced - * If true don't use trash - * @return true|PEAR_Error - */ - // public function bsDeleteFile($id, $forced=FALSE) - // { - // global $CC_CONFIG; - // // full delete: - // if (!$CC_CONFIG['useTrash'] || $forced) { - // $res = BasicStor::RemoveObj($id, $forced); - // return $res; - // } - // - // $storedFile = StoredFile::Recall($id); - // - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // if ($storedFile->isAccessed()) { - // return PEAR::raiseError( - // 'Cannot delete an object that is currently accessed.' - // ); - // } - // // move to trash: - // switch (BasicStor::GetObjType($id)) { - // - // case "audioclip": - // $playLists = $storedFile->getPlaylists(); - // $item_gunid = $storedFile->getGunid(); - // if( $playLists != NULL) { - // - // foreach($playLists as $key=>$val) { - // $playList_id = BasicStor::IdFromGunidBigInt($val["gunid"]); - // $playList_titles[] = BasicStor::bsGetMetadataValue($playList_id, "dc:title"); - // } - // return PEAR::raiseError( - // 'Please remove this song from all playlists: ' . join(",", $playList_titles) - // ); - // } - // break; - // - // case "playlist": - // if($storedFile->isScheduled()) { - // return PEAR::raiseError( - // 'Cannot delete an object that is scheduled to play.' - // ); - // } - // break; - // - // case "webstream": - // - // break; - // default: - // } - // - // $res = $storedFile->setState('deleted'); - // if (PEAR::isError($res)) { - // return $res; - // } - // - // return TRUE; - // } - - - /* ----------------------------------------------------- put, access etc. */ - /** - * Check validity of access/put token - * - * @param string $token - * Access/put token - * @param string $type - * 'put'|'access'|'download' - * @return boolean - */ - public static function bsCheckToken($token, $type='put') - { - global $CC_CONFIG, $CC_DBC; - $cnt = $CC_DBC->getOne(" - SELECT count(token) FROM ".$CC_CONFIG['accessTable']." - WHERE token=x'{$token}'::bigint AND type='$type' - "); - if (PEAR::isError($cnt)) { - return FALSE; - } - return ($cnt == 1); - } - - - /** - * Create and return access link to real file - * - * @param string $realFname - * Local filepath to accessed file - * (NULL for only increase access counter, no symlink) - * @param string $ext - * Useful filename extension for accessed file - * @param int $gunid - * Global unique id - * (NULL for special files such exported playlists) - * @param string $type - * 'access'|'download' - * @param int $parent - * parent token (recursive access/release) - * @param int $owner - * Local user id - owner of token - * @return array - * array with: seekable filehandle, access token - */ - public static function bsAccess($realFname, $ext, $gunid, $type='access', - $parent='0', $owner=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (!is_null($gunid)) { - $gunid = StoredFile::NormalizeGunid($gunid); - } - $token = StoredFile::CreateGunid(); - if (!is_null($realFname)) { - $linkFname = $CC_CONFIG['accessDir']."/$token.$ext"; - //broken links are ignored by the player, do not worry about it here - /* if (!is_file($realFname) && !is_link($realFname)) { - return PEAR::raiseError( - "BasicStor::bsAccess: real file not found ($realFname)", - GBERR_FILEIO); - } - */ - if (! @symlink($realFname, $linkFname)) { - return PEAR::raiseError( - "BasicStor::bsAccess: symlink create failed ($linkFname)", - GBERR_FILEIO); - } - } else { - $linkFname = NULL; - } - $escapedExt = pg_escape_string($ext); - $escapedType = pg_escape_string($type); - $CC_DBC->query("BEGIN"); - $gunidSql = (is_null($gunid) ? "NULL" : "x'{$gunid}'::bigint" ); - $ownerSql = (is_null($owner) ? "NULL" : "$owner" ); - $res = $CC_DBC->query(" - INSERT INTO ".$CC_CONFIG['accessTable']." - (gunid, token, ext, type, parent, owner, ts) - VALUES - ($gunidSql, x'$token'::bigint, - '$escapedExt', '$escapedType', x'{$parent}'::bigint, $ownerSql, now()) - "); - if (PEAR::isError($res)) { - $CC_DBC->query("ROLLBACK"); - return $res; - } - if (!is_null($gunid)) { - $res = $CC_DBC->query(" - UPDATE ".$CC_CONFIG['filesTable']." - SET currentlyAccessing=currentlyAccessing+1, mtime=now() - WHERE gunid=x'{$gunid}'::bigint - "); - } - if (PEAR::isError($res)) { - $CC_DBC->query("ROLLBACK"); - return $res; - } - $res = $CC_DBC->query("COMMIT"); - if (PEAR::isError($res)) { - return $res; - } - return array('fname'=>$linkFname, 'token'=>$token); - } - - - /** - * Release access link to real file - * - * @param string $token - * Access token - * @param string $type - * 'access'|'download' - * @return array - * gunid: string, global unique ID or real pathname of special file - * owner: int, local subject id of token owner - * realFname: string, real local pathname of accessed file - */ - public static function bsRelease($token, $type='access') - { - global $CC_CONFIG, $CC_DBC; - if (!BasicStor::bsCheckToken($token, $type)) { - return PEAR::raiseError( - "BasicStor::bsRelease: invalid token ($token)" - ); - } - $acc = $CC_DBC->getRow(" - SELECT to_hex(gunid)as gunid, ext, owner FROM ".$CC_CONFIG['accessTable']." - WHERE token=x'{$token}'::bigint AND type='$type' - "); - if (PEAR::isError($acc)) { - return $acc; - } - $ext = $acc['ext']; - $owner = $acc['owner']; - $linkFname = $CC_CONFIG['accessDir']."/$token.$ext"; - $realFname = readlink($linkFname); - if (file_exists($linkFname)) { - if(! @unlink($linkFname)){ - return PEAR::raiseError( - "BasicStor::bsRelease: unlink failed ($linkFname)", - GBERR_FILEIO); - } - } - $CC_DBC->query("BEGIN"); - if (!is_null($acc['gunid'])) { - $gunid = StoredFile::NormalizeGunid($acc['gunid']); - $res = $CC_DBC->query(" - UPDATE ".$CC_CONFIG['filesTable']." - SET currentlyAccessing=currentlyAccessing-1, mtime=now() - WHERE gunid=x'{$gunid}'::bigint AND currentlyAccessing>0 - "); - if (PEAR::isError($res)) { - $CC_DBC->query("ROLLBACK"); - return $res; - } - } - $res = $CC_DBC->query(" - DELETE FROM ".$CC_CONFIG['accessTable']." WHERE token=x'$token'::bigint - "); - if (PEAR::isError($res)) { - $CC_DBC->query("ROLLBACK"); - return $res; - } - $res = $CC_DBC->query("COMMIT"); - if (PEAR::isError($res)) { - return $res; - } - $res = array( - 'gunid' => (isset($gunid) ? $gunid : NULL ), - 'realFname' => $realFname, - 'owner' => $owner, - ); - return $res; - } - - - /** - * Create and return downloadable URL for file - * - * @param int $id - * Virtual file's local id - * @param string $part - * 'media'|'metadata' - * @param int $parent - * parent token (recursive access/release) - * @return array - * array with strings: - * downloadable URL, download token, chsum, size, filename - */ - // public function bsOpenDownload($id, $part='media') - // { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // $gunid = $storedFile->gunid; - // switch ($part) { - // case "media": - // $realfile = $storedFile->getRealFileName(); - // $ext = $storedFile->getFileExtension(); - // $filename = $storedFile->getName(); - // break; - // case "metadata": - // $realfile = $storedFile->getRealMetadataFileName(); - // $ext = "xml"; - // $filename = $storedFile->getName(); - // break; - // default: - // return PEAR::raiseError( - // "BasicStor::bsOpenDownload: unknown part ($part)" - // ); - // } - // $acc = BasicStor::bsAccess($realfile, $ext, $gunid, 'download'); - // if (PEAR::isError($acc)) { - // return $acc; - // } - // $url = BasicStor::GetUrlPart()."access/".basename($acc['fname']); - // $chsum = md5_file($realfile); - // $size = filesize($realfile); - // return array( - // 'url'=>$url, 'token'=>$acc['token'], - // 'chsum'=>$chsum, 'size'=>$size, - // 'filename'=>$filename - // ); - // } - - - /** - * Discard downloadable URL - * - * @param string $token - * Download token - * @param string $part - * 'media'|'metadata' - * @return string - * gunid - */ - // public function bsCloseDownload($token, $part='media') - // { - // if (!BasicStor::bsCheckToken($token, 'download')) { - // return PEAR::raiseError( - // "BasicStor::bsCloseDownload: invalid token ($token)" - // ); - // } - // $r = BasicStor::bsRelease($token, 'download'); - // if (PEAR::isError($r)){ - // return $r; - // } - // return (is_null($r['gunid']) ? $r['realFname'] : $r['gunid']); - // } - - - /** - * Create writable URL for HTTP PUT method file insert - * - * @param string $chsum - * md5sum of the file having been put - * @param string $gunid - * global unique id - * (NULL for special files such imported playlists) - * @param int $owner - * local user id - owner of token - * @return array - * array with: - * url string: writable URL - * fname string: writable local filename - * token string: PUT token - */ - // public function bsOpenPut($chsum, $gunid, $owner=NULL) - // { - // global $CC_CONFIG, $CC_DBC; - // if (!is_null($gunid)) { - // $gunid = StoredFile::NormalizeGunid($gunid); - // } - // $escapedChsum = pg_escape_string($chsum); - // $token = StoredFile::CreateGunid(); - // $res = $CC_DBC->query("DELETE FROM ".$CC_CONFIG['accessTable'] - // ." WHERE token=x'$token'::bigint"); - // if (PEAR::isError($res)) { - // return $res; - // } - // $gunidSql = (is_null($gunid) ? "NULL" : "x'{$gunid}'::bigint" ); - // $ownerSql = (is_null($owner) ? "NULL" : "$owner" ); - // $res = $CC_DBC->query(" - // INSERT INTO ".$CC_CONFIG['accessTable']." - // (gunid, token, ext, chsum, type, owner, ts) - // VALUES - // ($gunidSql, x'$token'::bigint, - // '', '$escapedChsum', 'put', $ownerSql, now())"); - // if (PEAR::isError($res)) { - // return $res; - // } - // $fname = $CC_CONFIG['accessDir']."/$token"; - // touch($fname); // is it needed? - // $url = BasicStor::GetUrlPart()."xmlrpc/put.php?token=$token"; - // return array('url'=>$url, 'fname'=>$fname, 'token'=>$token); - // } - - - /** - * Get file from writable URL and return local filename. - * Caller should move or unlink this file. - * - * @param string $token - * PUT token - * @return array - * hash with fields: - * fname string, local path of the file having been put - * owner int, local subject id - owner of token - */ - // public function bsClosePut($token) - // { - // global $CC_CONFIG, $CC_DBC; - // $token = StoredFile::NormalizeGunid($token); - // - // if (!BasicStor::bsCheckToken($token, 'put')) { - // return PEAR::raiseError( - // "BasicStor::bsClosePut: invalid token ($token)", - // GBERR_TOKEN); - // } - // $row = $CC_DBC->getRow( - // "SELECT chsum, owner FROM ".$CC_CONFIG['accessTable'] - // ." WHERE token=x'{$token}'::bigint"); - // if (PEAR::isError($row)) { - // return $row; - // } - // $fname = $CC_CONFIG['accessDir']."/$token"; - // $md5sum = md5_file($fname); - // - // $chsum = $row['chsum']; - // $owner = $row['owner']; - // $error = null; - // if ( (trim($chsum) != '') && ($chsum != $md5sum) ) { - // // Delete the file if the checksums do not match. - // if (file_exists($fname)) { - // @unlink($fname); - // } - // $error = new PEAR_Error( - // "BasicStor::bsClosePut: md5sum does not match (token=$token)". - // " [$chsum/$md5sum]", - // GBERR_PUT); - // } else { - // // Remember the MD5 sum - // $storedFile = StoredFile::RecallByToken($token); - // if (!is_null($storedFile) && !PEAR::isError($storedFile)) { - // $storedFile->setMd5($md5sum); - // } else { - //# $error = $storedFile; - // } - // } - // - // // Delete entry from access table. - // $res = $CC_DBC->query("DELETE FROM ".$CC_CONFIG['accessTable'] - // ." WHERE token=x'$token'::bigint"); - // if (PEAR::isError($error)) { - // return $error; - // } elseif (PEAR::isError($res)) { - // return $res; - // } - // - // return array('fname'=>$fname, 'owner'=>$owner); - // } - - - /** - * Check uploaded file - * - * @param string $token - * "Put" token - * @return array - * hash, ( - * status: boolean, - * size: int - filesize - * expectedsum: string - expected checksum - * realsum: string - checksum of uploaded file - * ) - */ - // public function bsCheckPut($token) - // { - // global $CC_CONFIG, $CC_DBC; - // if (!BasicStor::bsCheckToken($token, 'put')) { - // return PEAR::raiseError( - // "BasicStor::bsCheckPut: invalid token ($token)" - // ); - // } - // $chsum = $CC_DBC->getOne(" - // SELECT chsum FROM ".$CC_CONFIG['accessTable']." - // WHERE token=x'{$token}'::bigint - // "); - // if (PEAR::isError($chsum)) { - // return $chsum; - // } - // $fname = $CC_CONFIG['accessDir']."/$token"; - // $md5sum = md5_file($fname); - // $size = filesize($fname); - // $status = ($chsum == $md5sum); - // return array( - // 'status'=>$status, 'size'=>$size, - // 'expectedsum'=>$chsum, - // 'realsum'=>$md5sum, - // ); - // } - - - /** - * Return starting part of storageServer URL - * - * @return string - * URL - */ - // public static function GetUrlPart() - // { - // global $CC_CONFIG; - // $host = $CC_CONFIG['storageUrlHost']; - // $port = $CC_CONFIG['storageUrlPort']; - // $path = $CC_CONFIG['storageUrlPath']; - // return "http://$host:$port$path/"; - // } - - - /** - * Get tokens by type - * - * @param string $type - * access|put|render etc. - * @return array - * array of tokens - */ - // public static function GetTokensByType($type) - // { - // global $CC_CONFIG, $CC_DBC; - // $res = $CC_DBC->query( - // "SELECT TO_HEX(token) AS token FROM ".$CC_CONFIG['accessTable']." WHERE type=?", - // array($type)); - // while ($row = $res->fetchRow()) { - // $r[] = $row['token']; - // } - // return $r; - // } - - - /* ----------------------------------------------------- metadata methods */ - - /** - * Replace metadata with new XML file or string - * - * @param int $id - * Virtual file's local id - * @param string $mdata - * Local path of metadata XML file - * @param string $mdataLoc - * 'file'|'string' - * @return boolean|PEAR_Error - */ - // public function bsReplaceMetadata($id, $mdata, $mdataLoc='file') - // { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // return $storedFile->setMetadata($mdata, $mdataLoc); - // } - - - /** - * Get metadata as XML string - * - * @param int $id - * Virtual file's local id - * @return string|PEAR_Error - */ - // public function bsGetMetadata($id) - // { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // return $storedFile->getMetadata(); - // } - - - /** - * Get dc:title (if exists) - * - * @param int $id - * Virtual file's local id - * @param string $gunid - * Virtual file's gunid, optional, used only if not - * null, id is then ignored - * @return string|PEAR_Error - */ - // public function bsGetTitle($id, $gunid=NULL) - // { - // if (is_null($gunid)) { - // $storedFile = StoredFile::Recall($id); - // } else { - // $storedFile = StoredFile::RecallByGunid($gunid); - // } - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // $r = $storedFile->md["title"]; - // $title = (empty($r) ? 'unknown' : $r); - // return $title; - // } - - - /** - * Get metadata element value - * - * @param int $id - * Virtual file's local id - * @param string|array|null $category - * metadata element name, or array of metadata element names, - * if null is passed, all metadata values for the given ID will - * be fetched. - * @return string|array - * If a string is passed in for $category, a string is returned, - * if an array is passed, an array is returned. - * @see Metadata::getMetadataValue - */ - // public function bsGetMetadataValue($id, $category = null) - // { - // if (!is_numeric($id)) { - // return null; - // } - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // if (is_null($category)) { - // return $storedFile->md; - // } elseif (is_array($category)) { - // $values = array(); - // foreach ($category as $tmpCat) { - // $values[$tmpCat] = $storedFile->md[$tmpCat]; - // } - // return $values; - // } else { - // return $storedFile->md[$category]; - // } - // } - - - /** - * Convert XML name to database column name. Used for backwards compatibility - * with old code. - * - * @param string $p_category - * @return string|null - */ - // public static function xmlCategoryToDbColumn($p_category) - // { - // global $g_metadata_xml_to_db_mapping; - // if (array_key_exists($p_category, $g_metadata_xml_to_db_mapping)) { - // return $g_metadata_xml_to_db_mapping[$p_category]; - // } - // return null; - // } - - - /** - * Convert database column name to XML name. - * - * @param string $p_dbColumn - * @return string|null - */ - // public static function dbColumnToXmlCatagory($p_dbColumn) - // { - // global $g_metadata_xml_to_db_mapping; - // $str = array_search($p_dbColumn, $g_metadata_xml_to_db_mapping); - // // make return value consistent with xmlCategoryToDbColumn() - // if ($str === FALSE) { - // $str = null; - // } - // return $str; - // } - - /** - * Set metadata element value - * - * @param int|StoredFile $id - * Database ID of file - * @param string $category - * Metadata element identification (e.g. dc:title) - * @param string $value - * value to store, if NULL then delete record - * @return boolean - */ - // public static function bsSetMetadataValue($p_id, $p_category, $p_value) - // { - // global $CC_CONFIG, $CC_DBC; - // if (!is_string($p_category) || is_array($p_value)) { - // return FALSE; - // } - // if (is_a($p_id, "StoredFile")) { - // $p_id = $p_id->getId(); - // } - // if ($p_category == 'dcterms:extent') { - // $p_value = BasicStor::NormalizeExtent($p_value); - // } - // $columnName = BasicStor::xmlCategoryToDbColumn($p_category); // Get column name - // - // if (!is_null($columnName)) { - // $escapedValue = pg_escape_string($p_value); - // $sql = "UPDATE ".$CC_CONFIG["filesTable"] - // ." SET $columnName='$escapedValue'" - // ." WHERE id=$p_id"; - // //var_dump($sql); - // $res = $CC_DBC->query($sql); - // if (PEAR::isError($res)) { - // return $res; - // } - // } - // return TRUE; - // } - - - /** - * Normalize time value to hh:mm:ss:dddddd format - * - * @param mixed $v - * value to normalize - * @return string - */ - // private static function NormalizeExtent($v) - // { - // if (!preg_match("|^\d{2}:\d{2}:\d{2}.\d{6}$|", $v)) { - // $s = Playlist::playlistTimeToSeconds($v); - // $t = Playlist::secondsToPlaylistTime($s); - // return $t; - // } - // return $v; - // } - - - /** - * Set metadata values in 'batch' mode - * - * @param int|StoredFile $id - * Database ID of file or StoredFile object - * @param array $values - * array of key/value pairs - * (e.g. 'dc:title'=>'New title') - * @return boolean - */ - // public static function bsSetMetadataBatch($id, $values) - // { - // global $CC_CONFIG, $CC_DBC; - // if (!is_array($values)) { - // $values = array($values); - // } - // if (count($values) == 0) { - // return true; - // } - // if (is_a($id, "StoredFile")) { - // $storedFile =& $id; - // } else { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // } - // foreach ($values as $category => $oneValue) { - // $columnName = BasicStor::xmlCategoryToDbColumn($category); - // if (!is_null($columnName)) { - // if ($category == 'dcterms:extent') { - // $oneValue = BasicStor::NormalizeExtent($oneValue); - // } - // // Since track_number is an integer, you cannot set - // // it to be the empty string, so we NULL it instead. - // if ($columnName == 'track_number' && empty($oneValue)) { - // $sqlPart = "$columnName = NULL"; - // } elseif (($columnName == 'length') && (strlen($oneValue) > 8)) { - // // Postgres doesnt like it if you try to store really large hour - // // values. TODO: We need to fix the underlying problem of getting the - // // right values. - // $parts = explode(':', $oneValue); - // $hour = intval($parts[0]); - // if ($hour > 24) { - // continue; - // } else { - // $sqlPart = "$columnName = '$oneValue'"; - // } - // } else { - // $escapedValue = pg_escape_string($oneValue); - // $sqlPart = "$columnName = '$escapedValue'"; - // } - // $sqlValues[] = $sqlPart; - // } - // } - // if (count($sqlValues)==0) { - // return TRUE; - // } - // $sql = "UPDATE ".$CC_CONFIG["filesTable"] - // ." SET ".join(",", $sqlValues) - // ." WHERE id=$id"; - // $CC_DBC->query($sql); - // return TRUE; - // } - - /** - * Method returning array with where-parts of sql queries - * - * @param array $conditions - * See 'conditions' field in search criteria format - * definition in class documentation - * @return array - * array of strings - WHERE-parts of SQL queries - */ - private function _makeWhereArr($conditions) - { - $ops = array('full'=>"='%s'", 'partial'=>"ILIKE '%%%s%%'", - 'prefix'=>"ILIKE '%s%%'", '<'=>"< '%s'", '='=>"= '%s'", - '>'=>"> '%s'", '<='=>"<= '%s'", '>='=>">= '%s'" - ); - $whereArr = array(); - if (is_array($conditions)) { - foreach ($conditions as $cond) { - $columnName = StoredFile::xmlCategoryToDbColumn($cond['cat']); - $op = strtolower($cond['op']); - $value = $cond['val']; - if (!empty($value)) { - $splittedQn = XML_Util::splitQualifiedName($catQn); - $catNs = $splittedQn['namespace']; - $cat = $splittedQn['localPart']; - $opVal = sprintf($ops[$op], pg_escape_string($value)); - // retype for timestamp value - if ($cat == 'mtime') { - switch ($op) { - case 'partial': - case 'prefix': - break; - default: - $retype = "::timestamp with time zone"; - $opVal = "$retype $opVal$retype"; - } - } - $sqlCond = " {$columnName} {$opVal}\n"; - $whereArr[] = $sqlCond; - } - } - } - return $whereArr; - } - - /** - * Search in local metadata database. - * - * @param array $criteria - * has the following structure:
- *
    - *
  • filetype - string, type of searched files, - * meaningful values: 'audioclip', 'webstream', 'playlist', 'all'
  • - *
  • operator - string, type of conditions join - * (any condition matches / all conditions match), - * meaningful values: 'and', 'or', '' - * (may be empty or ommited only with less then 2 items in - * "conditions" field) - *
  • - *
  • orderby : string - metadata category for sorting (optional) - * or array of strings for multicolumn orderby - * [default: dc:creator, dc:source, dc:title] - *
  • - *
  • desc : boolean - flag for descending order (optional) - * or array of boolean for multicolumn orderby - * (it corresponds to elements of orderby field) - * [default: all ascending] - *
  • - *
  • conditions - array of hashes with structure: - *
      - *
    • cat - string, metadata category name
    • - *
    • op - string, operator - meaningful values: - * 'full', 'partial', 'prefix', '=', '<', - * '<=', '>', '>='
    • - *
    • val - string, search value
    • - *
    - *
  • - *
- * @param int $limit - * limit for result arrays (0 means unlimited) - * @param int $offset - * starting point (0 means without offset) - * @return array - * array of hashes, fields: - * cnt : integer - number of matching gunids - * of files have been found - * results : array of hashes: - * gunid: string - * type: string - audioclip | playlist | webstream - * title: string - dc:title from metadata - * creator: string - dc:creator from metadata - * source: string - dc:source from metadata - * length: string - dcterms:extent in extent format - */ - public function bsLocalSearch($criteria, $limit=0, $offset=0) - { - global $CC_CONFIG, $CC_DBC; - - // Input values - $filetype = (isset($criteria['filetype']) ? $criteria['filetype'] : 'all'); - $filetype = strtolower($filetype); - if (!array_key_exists($filetype, $this->filetypes)) { - return PEAR::raiseError(__FILE__.":".__LINE__.': unknown filetype in search criteria'); - } - $filetype = $this->filetypes[$filetype]; - $operator = (isset($criteria['operator']) ? $criteria['operator'] : 'and'); - $operator = strtolower($operator); - $conditions = (isset($criteria['conditions']) ? $criteria['conditions'] : array()); - - // Create the WHERE clause - this is the actual search part - $whereArr = $this->_makeWhereArr($conditions); - - // Metadata values to fetch - $metadataNames = array('dc:creator', 'dc:source', 'ls:track_num', 'dc:title', 'dcterms:extent'); - - // Order by clause - $orderby = TRUE; - $orderByAllowedValues = array('dc:creator', 'dc:source', 'dc:title', 'dcterms:extent', "ls:track_num"); - $orderByDefaults = array('dc:creator', 'dc:source', 'dc:title'); - if ((!isset($criteria['orderby'])) - || (is_array($criteria['orderby']) && (count($criteria['orderby'])==0))) { - // default ORDER BY - // PaulB: track number removed because it doesnt work yet because - // if track_num is not an integer (e.g. bad metadata like "1/20", - // or if the field is blank) the SQL statement gives an error. - //$orderbyQns = array('dc:creator', 'dc:source', 'ls:track_num', 'dc:title'); - $orderbyQns = $orderByDefaults; - } else { - // ORDER BY clause is given in the parameters. - - // Convert the parameter to an array if it isnt already. - $orderbyQns = $criteria['orderby']; - if (!is_array($orderbyQns)) { - $orderbyQns = array($orderbyQns); - } - - // Check that it has valid ORDER BY values, if not, revert - // to the default ORDER BY values. - foreach ($orderbyQns as $metadataTag) { - if (!in_array($metadataTag, $orderByAllowedValues)) { - $orderbyQns = $orderByDefaults; - break; - } - } - } - - $descA = (isset($criteria['desc']) ? $criteria['desc'] : NULL); - if (!is_array($descA)) { - $descA = array($descA); - } - - $orderBySql = array(); - // $dataName contains the names of the metadata columns we want to - // fetch. It is indexed numerically starting from 1, and the value - // in the array is the qualified name with ":" replaced with "_". - // e.g. "dc:creator" becomes "dc_creator". - foreach ($orderbyQns as $xmlTag) { - $columnName = StoredFile::xmlCategoryToDbColumn($xmlTag); - $orderBySql[] = $columnName; - } - - // Build WHERE clause - $whereClause = ""; - if (!is_null($filetype)) { - $whereClause .= "WHERE (ftype='$filetype')"; - } - else { - $whereClause .= "WHERE (ftype is NOT NULL)"; - } - if (count($whereArr) != 0) { - if ($operator == 'and') { - $whereClause .= " AND ((".join(") AND (", $whereArr)."))"; - } else { - $whereClause .= " AND ((".join(") OR (", $whereArr)."))"; - } - } - - // Final query - - //"dcterms:extent" => "length", - //"dc:title" => "track_title", - //"dc:creator" => "artist_name", - //dc:description - - global $g_metadata_xml_to_db_mapping; - $plSelect = "SELECT "; - $fileSelect = "SELECT "; - $_SESSION["br"] = ""; - foreach ($g_metadata_xml_to_db_mapping as $key => $val){ - $_SESSION["br"] .= "key: ".$key." value:".$val.", "; - if($key === "dc:title"){ - $plSelect .= "name AS ".$val.", "; - $fileSelect .= $val.", "; - } - else if ($key === "dc:creator"){ - $plSelect .= "creator AS ".$val.", "; - $fileSelect .= $val.", "; - } - else if ($key === "dcterms:extent"){ - $plSelect .= "length, "; - $fileSelect .= "length, "; - } - else if ($key === "dc:description"){ - $plSelect .= "text(description) AS ".$val.", "; - $fileSelect .= $val.", "; - } - else { - $plSelect .= "NULL AS ".$val.", "; - $fileSelect .= $val.", "; - } - } - - $sql = "SELECT * FROM ((".$plSelect."PL.id, 'playlist' AS ftype - FROM ".$CC_CONFIG["playListTable"]." AS PL - LEFT JOIN ".$CC_CONFIG['playListTimeView']." PLT ON PL.id = PLT.id) - - UNION - - (".$fileSelect."id, ftype FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS "; - - $sql .= $whereClause; - - if ($orderby) { - $sql .= " ORDER BY ".join(",", $orderBySql); - } - - $_SESSION["debugsql"] = $sql; - - $res = $CC_DBC->getAll($sql); - if (PEAR::isError($res)) { - return $res; - } - if (!is_array($res)) { - $res = array(); - } - - $count = count($res); - $_SESSION["br"] .= " COUNT: ".$count; - - $res = array_slice($res, $offset != 0 ? $offset : 0, $limit != 0 ? $limit : 10); - - $eres = array(); - foreach ($res as $it) { - $eres[] = array( - 'id' => $it['id'], - 'type' => strtolower($it['ftype']), - 'title' => $it['track_title'], - 'creator' => $it['artist_name'], - 'duration' => $it['length'], - 'source' => $it['album_title'], - 'track_num' => $it['track_number'], - ); - } - return array('results'=>$eres, 'cnt'=>$count); - } - - - /** - * Return values of specified metadata category - * - * @param string $category - * metadata category name with or without namespace prefix (dc:title, author) - * @param int $limit - * limit for result arrays (0 means unlimited) - * @param int $offset - * starting point (0 means without offset) - * @param array $criteria - * see bsLocalSearch method - * @return array - * hash, fields: - * results : array with found values - * cnt : integer - number of matching values - */ - public function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL) - { - global $CC_CONFIG, $CC_DBC; - - $pl_cat = array( - "dcterms:extent" => "length", - "dc:title" => "name", - "dc:creator" => "creator", - "dc:description" => "description" - ); - - $category = strtolower($category); - $columnName = StoredFile::xmlCategoryToDbColumn($category); - if (is_null($columnName)) { - return new PEAR_Error(__FILE__.":".__LINE__." -- could not map XML category to DB column."); - } - $sql = "SELECT DISTINCT $columnName FROM ".$CC_CONFIG["filesTable"]; - $limitPart = ($limit != 0 ? " LIMIT $limit" : '' ). - ($offset != 0 ? " OFFSET $offset" : '' ); - $countRowsSql = "SELECT COUNT(DISTINCT $columnName) FROM ".$CC_CONFIG["filesTable"]; - - //$_SESSION["br"] = "in Browse Category: ".$category; - $cnt = $CC_DBC->GetOne($countRowsSql); - if (PEAR::isError($cnt)) { - return $cnt; - } - $res = $CC_DBC->getCol($sql.$limitPart); - if (PEAR::isError($res)) { - return $res; - } - if (!is_array($res)) { - $res = array(); - } - - if (array_key_exists($category, $pl_cat) && $category !== "dcterms:extent") { - $columnName = $pl_cat[$category]; - - $sql = "SELECT DISTINCT $columnName FROM ".$CC_CONFIG["playListTable"]; - $limitPart = ($limit != 0 ? " LIMIT $limit" : '' ). - ($offset != 0 ? " OFFSET $offset" : '' ); - $countRowsSql = "SELECT COUNT(DISTINCT $columnName) FROM ".$CC_CONFIG["playListTable"]; - - $pl_cnt = $CC_DBC->GetOne($countRowsSql); - if (PEAR::isError($cnt)) { - return $cnt; - } - $pl_res = $CC_DBC->getCol($sql.$limitPart); - if (PEAR::isError($res)) { - return $pl_res; - } - if (!is_array($pl_res)) { - $pl_res = array(); - } - - $res = array_merge($res, $pl_res); - $res = array_slice($res, 0, $limit); - $cnt = $cnt + $pl_cnt; - } - else if ($category === "dcterms:extent") { - $columnName = $pl_cat[$category]; - - $limitPart = ($limit != 0 ? " LIMIT $limit" : '' ). - ($offset != 0 ? " OFFSET $offset" : '' ); - - $sql = "SELECT DISTINCT length AS $columnName FROM ".$CC_CONFIG["playListTimeView"]; - - $countRowsSql = "SELECT COUNT(DISTINCT length) FROM ".$CC_CONFIG["playListTimeView"]; - - $pl_cnt = $CC_DBC->GetOne($countRowsSql); - if (PEAR::isError($cnt)) { - return $cnt; - } - $pl_res = $CC_DBC->getCol($sql.$limitPart); - if (PEAR::isError($res)) { - return $pl_res; - } - if (!is_array($pl_res)) { - $pl_res = array(); - } - - $res = array_merge($res, $pl_res); - $res = array_slice($res, 0, $limit); - $cnt = $cnt + $pl_cnt; - } - - return array('results'=>$res, 'cnt'=>$cnt); - } - - - /* ---------------------------------------------------- methods4playlists */ - - /** - * Create a tarfile with playlist export - playlist and all matching - * sub-playlists and media files (if desired) - * - * @param array $plids - * Array of strings, playlist global unique IDs (one gunid is accepted too) - * @param string $type - * Playlist format, possible values: lspl | smil | m3u - * @param boolean $withContent - * if true, export related files too - * @return array - * hasharray with fields: - * fname string: readable fname, - * token string: access token - */ - // public function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE) - // { - // global $CC_CONFIG; - // if (!is_array($plids)) { - // $plids = array($plids); - // } - // $gunids = array(); - // foreach ($plids as $plid) { - // $pl = StoredFile::RecallByGunid($plid); - // if (is_null($pl) || PEAR::isError($pl)) { - // return $pl; - // } - // if ($withContent) { - // $gunidsX = $pl->export(); - // if (PEAR::isError($gunidsX)) { - // return $gunidsX; - // } - // } else { - // $gunidsX = array(array('gunid'=>$plid, 'type'=>'playlist')); - // } - // $gunids = array_merge($gunids, $gunidsX); - // } - // $plExts = array('lspl'=>"lspl", 'smil'=>"smil", 'm3u'=>"m3u"); - // $plExt = (isset($plExts[$type]) ? $plExts[$type] : "xml" ); - // $res = array(); - // $tmpn = tempnam($CC_CONFIG['bufferDir'], 'plExport_'); - // $tmpf = "$tmpn.tar"; - // $tmpd = "$tmpn.dir"; - // mkdir($tmpd); - // $tmpdp = "$tmpn.dir/playlist"; - // mkdir($tmpdp); - // if ($withContent) { - // $tmpdc = "$tmpn.dir/audioClip"; - // mkdir($tmpdc); - // } - // foreach ($gunids as $i => $it) { - // $storedFile = StoredFile::RecallByGunid($it['gunid']); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - //// $MDfname = $storedFile->md->getFileName(); - // $MDfname = $storedFile->md["name"]; - // if (PEAR::isError($MDfname)) { - // return $MDfname; - // } - // if (file_exists($MDfname)) { - // switch ($it['type']) { - // case "playlist": - // $storedFile = $r = StoredFile::RecallByGunid($it['gunid']); - // switch ($type) { - // case "smil": - // $string = $r = $storedFile->outputToSmil(); - // break; - // case "m3u": - // $string = $r = $storedFile->outputToM3u(); - // break; - // default: - //// $string = $r = $storedFile->md->genXmlDoc(); - // } - // if (PEAR::isError($r)) { - // return $r; - // } - // $r = BasicStor::WriteStringToFile($string, "$tmpdp/{$it['gunid']}.$plExt"); - // if (PEAR::isError($r)) { - // return $r; - // } - // break; - // default: - // copy($MDfname, "$tmpdc/{$it['gunid']}.xml"); break; - // } // switch - // } // if file_exists() - // $RADfname = $storedFile->getRealFileName(); - // if (PEAR::isError($RADfname)) { - // return $RADfname; - // } - // $RADext = $storedFile->getFileExtension(); - // if (PEAR::isError($RADext)) { - // return $RADext; - // } - // if (file_exists($RADfname)) { - // copy($RADfname, "$tmpdc/{$it['gunid']}.$RADext"); - // } - // } - // if (count($plids)==1) { - // copy("$tmpdp/$plid.$plExt", "$tmpd/exportedPlaylist.$plExt"); - // } - // $res = `cd $tmpd; tar cf $tmpf * --remove-files`; - // @rmdir($tmpdc); - // @rmdir($tmpdp); - // @rmdir($tmpd); - // unlink($tmpn); - // $acc = BasicStor::bsAccess($tmpf, 'tar', NULL/*gunid*/, 'access'); - // if (PEAR::isError($acc)) { - // return $acc; - // } - // return $acc; - // } - - - /** - * Close playlist export previously opened by the bsExportPlaylistOpen - * method - * - * @param string $token - * Access token obtained from bsExportPlaylistOpen method call. - * @return true/PEAR_Error - */ - // public function bsExportPlaylistClose($token) - // { - // $r = BasicStor::bsRelease($token, 'access'); - // if (PEAR::isError($r)) { - // return $r; - // } - // $file = $r['realFname']; - // if (file_exists($file)) { - // if(! @unlink($file)){ - // return PEAR::raiseError( - // "BasicStor::bsExportPlaylistClose: unlink failed ($file)", - // GBERR_FILEIO); - // } - // } - // return TRUE; - // } - - - /** - * Import playlist in LS Archive format - * - * @param string $plid - * Playlist gunid - * @param string $aPath - * Absolute path part of imported file (e.g. /home/user/campcaster) - * @param string $rPath - * Relative path/filename part of imported file (e.g. playlists/playlist_1.smil) - * @param string $ext - * Playlist extension (determines type of import) - * @param array $gunids - * Hash relation from filenames to gunids - * @param int $subjid - * Local subject (user) id (id of user doing the import) - * @return int - * Result file local id (or error object) - */ - // public function bsImportPlaylistRaw($plid, $aPath, $rPath, $ext, &$gunids, $subjid) - // { - // $id = BasicStor::IdFromGunid($plid); - // if (!is_null($id)) { - // return $id; - // } - // $path = realpath("$aPath/$rPath"); - // if (FALSE === $path) { - // return PEAR::raiseError( - // "BasicStor::bsImportPlaylistRaw: file doesn't exist ($aPath/$rPath)" - // ); - // } - // switch ($ext) { - // case "xml": - // case "lspl": - // $fname = $plid; - // $values = array( - // "filename" => $fname, - // "metadata" => $path, - // "gunid" => $plid, - // "filetype" => "playlist" - // ); - // $storedFile = StoredFile::Insert($values); - // $res = $storedFile->getId(); - // break; - // case "smil": - // require_once("SmilPlaylist.php"); - // $res = SmilPlaylist::import($this, $aPath, $rPath, $gunids, $plid, $subjid); - // if (PEAR::isError($res)) { - // break; - // } - // $res = $res->getId(); - // break; - // case "m3u": - // require_once("M3uPlaylist.php"); - // $res = M3uPlaylist::import($this, $aPath, $rPath, $gunids, $plid, $subjid); - // if (PEAR::isError($res)) { - // break; - // } - // $res = $res->getId(); - // break; - // default: - // $res = PEAR::raiseError( - // "BasicStor::importPlaylistRaw: unknown playlist format". - // " (gunid:$plid, format:$ext)" - // ); - // break; - // } - // if (!PEAR::isError($res)) { - // $gunids[basename($rPath)] = $plid; - // } - // return $res; - // } - - - /** - * Import playlist in LS Archive format - * - * @param string $fpath - * Imported file pathname - * @param int $subjid - * Local subject (user) id (id of user doing the import) - * @return int - * Result file local id (or error object) - */ - // public function bsImportPlaylist($fpath, $subjid) - // { - // global $CC_CONFIG; - // // untar: - // $tmpn = tempnam($CC_CONFIG['bufferDir'], 'plImport_'); - // $tmpd = "$tmpn.dir"; - // $tmpdc = "$tmpd/audioClip"; - // $tmpdp = "$tmpd/playlist"; - // mkdir($tmpd); - // $res = `cd $tmpd; tar xf $fpath`; - // // clips: - // $d = @dir($tmpdc); - // $entries = array(); - // $gunids = array(); - // if ($d !== false) { - // while (false !== ($entry = $d->read())) { - // if (preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)) { - // list(,$gunid, $ext) = $va; - // switch ($ext) { - // case"xml": - // $entries[$gunid]['metadata'] = $entry; - // break; - // default: - // $entries[$gunid]['rawMedia'] = $entry; - // $entries[$gunid]['rawMediaExt'] = $ext; - // $gunids[$entry] = $gunid; - // break; - // } - // } - // } - // $d->close(); - // } - // $res = TRUE; - // foreach ($entries as $gunid => $it) { - // $rawMedia = "$tmpdc/{$it['rawMedia']}"; - // if (!file_exists($rawMedia)) { - // $rawMedia = NULL; - // } - // $metadata = "$tmpdc/{$it['metadata']}"; - // if (!file_exists($metadata)) { - // $metadata = NULL; - // } - // $f = StoredFile::RecallByGunid($gunid); - // if (!PEAR::isError($f)) { - // $exists = $f->existsFile(); - // if ( $exists ) { - // $res = $f->delete(); - // } - // } - // if (!PEAR::isError($res) ) { - // $values = array( - // "filename" => $gunid, - // "filepath" => $rawMedia, - // "metadata" => $metadata, - // "gunid" => $gunid, - // "filetype" => "audioclip" - // ); - // $storedFile = StoredFile::Insert($values); - // $res = $storedFile->getId(); - // } - // @unlink("$tmpdc/{$it['rawMedia']}"); - // @unlink("$tmpdc/{$it['metadata']}"); - // if (PEAR::isError($res)) { - // break; - // } - // } - // // playlists: - // $d = @dir($tmpdp); - // if ($d !== false) { - // while ((!PEAR::isError($res)) && false !== ($entry = $d->read())) { - // if (preg_match("|^([0-9a-fA-F]{16})\.(.*)$|", $entry, $va)) { - // list(,$gunid, $ext) = $va; - // $res = $this->bsImportPlaylistRaw($gunid, - // $tmpdp, $entry, $ext, $gunids, $subjid); - // unlink("$tmpdp/$entry"); - // if (PEAR::isError($res)) { - // break; - // } - // } - // } - // $d->close(); - // } - // //@rmdir($tmpdc); @rmdir($tmpdp); @rmdir($tmpd); - // @system("rm -rf $tmpdc"); - // @system("rm -rf $tmpdp"); - // @system("rm -rf $tmpd"); - // @unlink($tmpn); - // return $res; - // } - - - /* --------------------------------------------------------- info methods */ - - /** - * Analyze media file for internal metadata information - * - * @param int $id - * Virtual file's local id - * @return array - */ - // public function bsAnalyzeFile($id) - // { - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // $ia = $storedFile->analyzeFile(); - // return $ia; - // } - - - /** - * Check if file exists in the storage - * - * @param int $id - * Local id - * @param string $ftype - * Internal file type - * @param boolean $byGunid - * select file by gunid (id is then ignored) - * @return boolean - */ - // public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE) - // { - // if ($byGunid) { - // $storedFile = StoredFile::RecallByGunid($id); - // } else { - // $storedFile = StoredFile::Recall($id); - // } - // if (is_null($storedFile)) { - // return $storedFile; - // } - // if (PEAR::isError($storedFile)) { - // // catch some exceptions - // switch ($storedFile->getCode()) { - // case GBERR_FILENEX: - // case GBERR_FOBJNEX: - // return FALSE; - // break; - // default: - // return $storedFile; - // } - // } - // $realFtype = BasicStor::GetType($storedFile->gunid); - // if (!is_null($ftype) && ( - // (strtolower($realFtype) != strtolower($ftype)) - // // webstreams are subset of audioclips - // && !($realFtype == 'webstream' && $ftype == 'audioclip') - // )) { - // return FALSE; - // } - // return TRUE; - // } - - - /* ---------------------------------------------------- redefined methods */ - /** - * Get object type by id. - * - * @param int $oid - * Local object id - * @return string|PEAR_Error - */ - // public static function GetObjType($p_id) - // { - // $type = "unknown"; - // $f = StoredFile::Recall($p_id); - // return $f->getType(); - - // $gunid = BasicStor::GunidFromId($oid); - // if (PEAR::isError($gunid)) { - // return $gunid; - // } - // $ftype = BasicStor::GetType($gunid); - // if (PEAR::isError($ftype)) { - // return $ftype; - // } - // if (!is_null($ftype)) { - // $type = $ftype; - // } - // return $type; - // } - - - /** - * Add new user - * - * @param string $login - * @param string $pass - * @param string $realname - * @return int|PEAR_Error - */ - public static function addSubj($login, $pass=NULL, $realname='') - { - global $CC_CONFIG; - $uid = Subjects::AddSubj($login, $pass, $realname); - if (PEAR::isError($uid)) { - return $uid; - } - if (Subjects::IsGroup($uid) === FALSE) { - $res = Alib::AddPerm($uid, '_all', '0', 'A'); - if (PEAR::isError($res)) { - return $res; - } - $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['StationPrefsGr']); - if (PEAR::isError($res)) { - return $res; - } - // $res = Subjects::AddSubjectToGroup($login, $CC_CONFIG['AllGr']); - // if (PEAR::isError($res)) { - // return $res; - // } - } - return $uid; - } - - - /** - * Remove user by login - * - * @param string $login - * @return boolean|PEAR_Error - */ - public function removeSubj($login) - { - global $CC_CONFIG, $CC_DBC; - if (FALSE !== array_search($login, $CC_CONFIG['sysSubjs'])) { - return $CC_DBC->raiseError( - "BasicStor::removeSubj: cannot remove system user/group"); - } - $uid = Subjects::GetSubjId($login); - if (PEAR::isError($uid)) { - return $uid; - } - $res = $CC_DBC->query(" - DELETE FROM ".$CC_CONFIG['accessTable']." WHERE owner=$uid - "); - if (PEAR::isError($res)) { - return $res; - } - $res = Alib::RemoveSubj($login); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Authenticate and create session - * - * @param string $login - * @param string $pass - * @return boolean|sessionId|PEAR_Error - */ - function login($login, $pass) - { - $r = Alib::Login($login, $pass); - return $r; - } - - - /* ================================================== "protected" methods */ - /** - * Check authorization - auxiliary method - * - * @param array $acts - * Array of actions - * @param array $pars - * Array of parameters - e.g. ids - * @param string $sessid - * Session id - * @return true|PEAR_Error - */ - public static function Authorize($acts, $pars, $sessid='') - { - $userid = Alib::GetSessUserId($sessid); - if (PEAR::isError($userid)) { - return $userid; - } - if (is_null($userid)) { - return PEAR::raiseError( - "BasicStor::Authorize: invalid session", GBERR_DENY); - } - if (!is_array($pars)) { - $pars = array($pars); - } - if (!is_array($acts)) { - $acts = array($acts); - } - $perm = true; - // foreach ($acts as $i => $action) { - // $res = Alib::CheckPerm($userid, $action, $pars[$i]); - // if (PEAR::isError($res)) { - // return $res; - // } - // $perm = $perm && $res; - // } - if ($perm) { - return TRUE; - } - $adesc = "[".join(',',$acts)."]"; - return PEAR::raiseError( - "BasicStor::$adesc: access denied", GBERR_DENY); - } - - - /** - * Get local id from global id (in hex). - * - * @param string $p_gunid - * Global id - * @return int - * Local id - */ - // public static function IdFromGunid($p_gunid) - // { - // global $CC_DBC; - // global $CC_CONFIG; - // return $CC_DBC->getOne("SELECT id FROM ".$CC_CONFIG['filesTable']." WHERE gunid=x'$p_gunid'::bigint"); - // } - - /** - * Get local id from global id (big int). - * - * @param string $p_gunid - * Global id - * @return int - * Local id - */ - // public static function IdFromGunidBigInt($p_gunid) - // { - // global $CC_DBC; - // global $CC_CONFIG; - // return $CC_DBC->getOne("SELECT id FROM ".$CC_CONFIG['filesTable']." WHERE gunid='$p_gunid'"); - // } - - - /** - * Get global id from local id - * - * @param int $p_id - * Local id - * @return string - * Global id - */ - // public static function GunidFromId($p_id) - // { - // global $CC_CONFIG; - // global $CC_DBC; - // if (!is_numeric($p_id)) { - // return NULL; - // } - // $gunid = $CC_DBC->getOne(" - // SELECT to_hex(gunid)as gunid FROM ".$CC_CONFIG['filesTable']." - // WHERE id='$p_id' - // "); - // if (PEAR::isError($gunid)) { - // return $gunid; - // } - // if (is_null($gunid)) { - // return NULL; - // } - // return StoredFile::NormalizeGunid($gunid); - // } - - - /** - * Get storage-internal file type - * - * @param string $p_gunid - * Global unique id of file - * @return string - */ - // public static function GetType($p_gunid) - // { - // global $CC_CONFIG; - // global $CC_DBC; - // $ftype = $CC_DBC->getOne(" - // SELECT ftype FROM ".$CC_CONFIG['filesTable']." - // WHERE gunid=x'$p_gunid'::bigint - // "); - // return $ftype; - // } - - - /** - * Check gunid format - * - * @param string $p_gunid - * Global unique ID - * @return boolean - */ - // protected static function CheckGunid($p_gunid) - // { - // $res = preg_match("|^([0-9a-fA-F]{16})?$|", $p_gunid); - // return $res; - // } - - /** - * Set playlist edit flag - * - * @param string $p_playlistId - * Playlist unique ID - * @param boolean $p_val - * Set/clear of edit flag - * @param string $p_sessid - * Session id - * @param int $p_subjid - * Subject id (if sessid is not specified) - * @return boolean - * previous state - */ - public function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL) - { - if (!is_null($p_sessid)) { - $p_subjid = Alib::GetSessUserId($p_sessid); - if (PEAR::isError($p_subjid)) { - return $p_subjid; - } - } - $pl = Playlist::Recall($p_playlistId); - if (is_null($pl) || PEAR::isError($pl)) { - return $pl; - } - $state = $pl->getState(); - if ($p_val) { - $r = $pl->setState('edited', $p_subjid); - } else { - $r = $pl->setState('ready', 'NULL'); - } - if (PEAR::isError($r)) { - return $r; - } - return ($state == 'edited'); - } - - - /** - * Check if playlist is marked as edited - * - * @param string $p_playlistId - * Playlist global unique ID - * @return FALSE|int - * ID of user editing it - */ - public function isEdited($p_playlistId) - { - $pl = Playlist::Recall($p_playlistId); - if (is_null($pl) || PEAR::isError($pl)) { - return $pl; - } - if (!$pl->isEdited($p_playlistId)) { - return FALSE; - } - return $pl->isEditedBy($p_playlistId); - } - - - /* ---------------------------------------- redefined "protected" methods */ - /** - * Copy virtual file. - * Redefined from parent class. - * - * @return int - * New object local id - */ - // protected static function CopyObj($id, $newParid, $after=NULL) - // { - // switch (BasicStor::GetObjType($id)) { - // case "audioclip": - // case "playlist": - // case "webstream": - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile) || PEAR::isError($storedFile)) { - // return $storedFile; - // } - // $ac2 = StoredFile::CopyOf($storedFile, $nid); - // //$ac2->setName(M2tree::GetObjName($nid)); - // break; - // case "File": - // default: - // } - // return $nid; - // } - - - /** - * Remove virtual file.
- * Redefined from parent class. - * - * @param int $id - * Local id of removed object - * @param boolean $forced - * Unconditional delete - * @return true|PEAR_Error - */ - // public static function RemoveObj($id, $forced=FALSE) - // { - // $ot = BasicStor::GetObjType($id); - // if (PEAR::isError($ot)) { - // return $ot; - // } - // switch ($ot) { - // case "audioclip": - // case "playlist": - // case "webstream": - // $storedFile = StoredFile::Recall($id); - // if (is_null($storedFile)) { - // return TRUE; - // } - // if (PEAR::isError($storedFile)) { - // return $storedFile; - // } - // if ($storedFile->isEdited() && !$forced) { - // return PEAR::raiseError( - // 'BasicStor::RemoveObj(): is edited' - // ); - // } - // if ($storedFile->isAccessed() && !$forced) { - // return PEAR::raiseError( - // 'BasicStor::RemoveObj(): is accessed' - // ); - // } - // $storedFile->delete(); - // break; - // case "File": - //// case "Folder": - //// case "Replica": - // break; - // default: - // return PEAR::raiseError( - // "BasicStor::bsDeleteFile: unknown obj type ($ot)" - // ); - // } - // $res = Alib::RemoveObj($id); - // if (PEAR::isError($res)) { - // return $res; - // } - // return TRUE; - // } - - - /* ========================================================= misc methods */ - /** - * Write string to file - * - * @param string $str - * string to be written to file - * @param string $fname - * pathname to file - * @return TRUE|raiseError - */ - private static function WriteStringToFile($p_str, $p_fname) - { - $fp = @fopen($p_fname, "w"); - if ($fp === FALSE) { - return PEAR::raiseError( - "BasicStor::WriteStringToFile: cannot open file ($p_fname)" - ); - } - fwrite($fp, $p_str); - fclose($fp); - return TRUE; - } - - - /* =============================================== test and debug methods */ - - /** - * - * - */ - public function debug($va) - { - echo"
\n";
-        print_r($va);
-    }
-
-
-    /**
-     * deleteFiles
-     *
-     * @return void
-     */
-    //    private function deleteFiles()
-    //    {
-    //        global $CC_CONFIG, $CC_DBC;
-    //        $ids = $CC_DBC->getAll("SELECT id FROM ".$CC_CONFIG['filesTable']);
-    //        if (is_array($ids)) {
-    //            foreach ($ids as $i => $item) {
-    //              $f = StoredFile::Recall($item['id']);
-    //              $f->delete();
-    //            }
-    //        }
-    //    }
-
-
-    /**
-     * Aux logging for debug
-     *
-     * @param string $msg - log message
-     */
-    public function debugLog($msg)
-    {
-        global $CC_CONFIG, $CC_DBC;
-        $fp = fopen($CC_CONFIG['storageDir']."/log", "a") or die("Can't write to log\n");
-        fputs($fp, date("H:i:s").">$msg<\n");
-        fclose($fp);
-    }
-
-    } // class BasicStor
-    ?>
\ No newline at end of file
diff --git a/backend/GreenBox.php b/backend/GreenBox.php
deleted file mode 100644
index d990cc2db..000000000
--- a/backend/GreenBox.php
+++ /dev/null
@@ -1,1726 +0,0 @@
-";
-}
-require_once("BasicStor.php");
-if (isset($WHITE_SCREEN_OF_DEATH) && $WHITE_SCREEN_OF_DEATH) {
-    echo __FILE__.':line '.__LINE__.": Loaded BasicStor
"; -} -require_once("Playlist.php"); -require_once("Renderer.php"); -require_once('Prefs.php'); -require_once("Backup.php"); -require_once('Restore.php'); -require_once("Transport.php"); - -/** - * GreenBox class - * - * File storage module. - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class GreenBox extends BasicStor { - - /* ====================================================== storage methods */ - - /** - * Store new file in the storage - * - * @param string $fileName - * The name for the new file. - * @param string $mediaFileLP - * Local path of the media file - * @param string $mdataFileLP - * Local path of the metadata file - * @param string $sessid - * Session id - * @param string $gunid - * Global unique id - * @param string $ftype - * Internal file type - * @return int - * ID of the StoredFile that was created. - */ - public function putFile($p_values, $p_sessionId='') - { - if (($res = BasicStor::Authorize('write', null, $p_sessionId)) !== TRUE) { - return $res; - } - $storedFile = StoredFile::Insert($p_values); - return $storedFile; - } // fn putFile - - - /** - * Store new webstream - * - * @param string $fileName - * Name for new file - * @param string $mdataFileLP - * Local path of metadata file - * @param string $sessid - * Session id - * @param string $gunid - * Global unique id - * @param string $url - * Webstream url - * @return int - * @exception PEAR::error - */ - public function storeWebstream($fileName, $mdataFileLP, $sessid='', - $gunid=NULL, $url) - { - if (($res = BasicStor::Authorize('write', null, $sessid)) !== TRUE) { - return $res; - } - if (!file_exists($mdataFileLP)) { - $mdataFileLP = dirname(__FILE__).'/emptyWebstream.xml'; - } - $values = array( - "filename" => $fileName, - "metadata" => $mdataFileLP, - "gunid" => $gunid, - "filetype" => "webstream" - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - $r = $storedFile->setMetadataValue('ls:url', $url); - if (PEAR::isError($r)) { - return $r; - } - return $oid; - } // fn storeWebstream - - - /** - * Access stored file - increase access counter - * - * @param int $id - * virt.file's local id - * @param string $sessid - * session id - * @return string access token - */ - // function accessFile($id, $sessid='') - // { - // if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - // return $res; - // } - // $gunid = BasicStor::GunidFromId($id); - // $r = BasicStor::bsAccess(NULL, '', $gunid, 'access'); - // if (PEAR::isError($r)) { - // return $r; - // } - // $token = $r['token']; - // return $token; - // } // fn accessFile - - - /** - * Release stored file - decrease access counter - * - * @param string $token - * access token - * @param string $sessid - * session id - * @return boolean - */ - // function releaseFile($token, $sessid='') - // { - // $r = BasicStor::bsRelease($token, 'access'); - // if (PEAR::isError($r)) { - // return $r; - // } - // return FALSE; - // } // fn releaseFile - - - /** - * Analyze media file for internal metadata information - * - * @param int $id - * Virtual file's local id - * @param string $sessid - * Session id - * @return array - */ - // public function analyzeFile($id, $sessid='') - // { - // if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - // return $res; - // } - // return $this->bsAnalyzeFile($id); - // } - - - /** - * Rename file - * - * @param int $id - * Virtual file's local id - * @param string $newName - * @param string $sessid - * Session id - * @return boolean|PEAR_Error - */ - // public function renameFile($id, $newName, $sessid='') - // { - // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - // return $res; - // } - // return $this->bsRenameFile($id, $newName); - // } - - - /** - * Replace file. Doesn't change filetype! - * - * @param int $id - * virt.file's local id - * @param string $mediaFileLP - * local path of media file - * @param string $mdataFileLP - * local path of metadata file - * @param string $sessid - * session id - * @return TRUE|PEAR_Error - */ - // public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='') - // { - // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - // return $res; - // } - // return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP); - // } - - - /** - * Delete file - * - * @param int $id - * local id - * @param int $sessid - * @param boolean $forced - * if true don't use trash -- now ignored - * @return true|PEAR_Error - */ - public function deleteFile($id, $sessid='', $forced=FALSE) - { - if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::Recall($id); - return $f->delete(true); - } - - - /* ------------------------------------------------------------- metadata */ - - /** - * Replace metadata with new XML file or string - * - * @param int $id - * Virtual file's local id - * @param string $mdata - * XML string or local path of metadata XML file - * @param string $mdataLoc - * metadata location: 'file'|'string' - * @param string $sessid - * session id - * @return boolean|PEAR_Error - */ - // public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='') - // { - // if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - // return $res; - // } - // return $this->bsReplaceMetadata($id, $mdata, $mdataLoc); - // } // fn replaceMetadata - - - /** - * Get metadata XML tree as string - * - * @param int $id - * Virtual file's local id - * @param string $sessid - * session id - * @return string|PEAR_Error - * @todo rename this function to "getMetadata" - */ - public function getMetadata($id, $sessid='') - { - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::Recall($id); - return $f->getMetadata(); - } - - - /** - * Return metadata as hierarchical PHP hash-array - * - * If xml:lang attribute is specified in metadata category, - * array of metadata values indexed by xml:lang values - * is presented instead of one plain metadata value. - * - * @param int $id - * local object id - * @param string $sessid - * session ID - * @return array - */ - public function getMetadataArray($id, $sessid) - { - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $storedFile = StoredFile::Recall($id); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - return $storedFile->md; - - // $arr = $storedFile->md->genPhpArray(); - $md = FALSE; - foreach ($arr['children'] as $i=>$a) { - if ($a['elementname'] == 'metadata'){ - $md = $arr['children'][$i]; - break; - } - } - if ($md === FALSE) { - return PEAR::raiseError( - "GreenBox::getMetadataArray: no metadata container found" - ); - } - $res = array(); - foreach ($md['children'] as $el) { - $lang = isset($el['attrs']['xml:lang']) ? $el['attrs']['xml:lang'] : ""; - $category = $el['elementname']; - if ($lang == "") { - $res[$category] = $el['content']; - } else { - $res[$category][$lang] = $el['content']; - } - } - return $res; - } - - - /** - * Get metadata element value - * - * @param int $id - * Virtual file's local id - * @param string $category - * metadata element name - * @param string $sessid - * session id - * @param string $lang - * xml:lang value for select language version - * @param string $deflang - * xml:lang for default language - * @return array of matching records as hash with fields: - *
    - *
  • mid int, local metadata record id
  • - *
  • value string, element value
  • - *
  • attrs hasharray of element's attributes indexed by - * qualified name (e.g. xml:lang)
  • - *
- */ - public function getMetadataValue($id, $category, $sessid='', - $lang=NULL, $deflang=NULL) - { - if (!is_numeric($id)) { - return null; - } - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::Recall($id); - return $f->getMetadataValue($category); - } - - - /** - * Set metadata element value - * - * @param int $id - * Virtual file's local id - * @param string $category - * Metadata element identification (e.g. dc:title) - * @param string $sessid - * Session id - * @param string $value - * The value to store, if NULL then delete record - * @return boolean - */ - public function setMetadataValue($id, $category, $sessid, $value) - { - if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::Recall($id); - return $f->setMetadataValue($category, $value); - } // fn setMetadataValue - - - /** - * Search in local metadata database. - * - * @param array $criteria - * with following structure:
- *
    - *
  • filetype - string, type of searched files, - * meaningful values: 'audioclip', 'webstream', 'playlist', 'all'
  • - *
  • operator - string, type of conditions join - * (any condition matches / all conditions match), - * meaningful values: 'and', 'or', '' - * (may be empty or ommited only with less then 2 items in - * "conditions" field) - *
  • - *
  • limit : int - limit for result arrays (0 means unlimited)
  • - *
  • offset : int - starting point (0 means without offset)
  • - *
  • orderby : string - metadata category for sorting (optional) - * or array of strings for multicolumn orderby - * [default: dc:creator, dc:source, dc:title] - *
  • - *
  • desc : boolean - flag for descending order (optional) - * or array of boolean for multicolumn orderby - * (it corresponds to elements of orderby field) - * [default: all ascending] - *
  • - *
  • conditions - array of hashes with structure: - *
      - *
    • cat - string, metadata category name
    • - *
    • op - string, operator - meaningful values: - * 'full', 'partial', 'prefix', '=', '<', - * '<=', '>', '>='
    • - *
    • val - string, search value
    • - *
    - *
  • - *
- * @param string $sessid - * session id - * @return array of hashes, fields: - *
    - *
  • cnt : integer - number of matching gunids - * of files have been found
  • - *
  • results : array of hashes: - *
      - *
    • gunid: string
    • - *
    • type: string - audioclip | playlist | webstream
    • - *
    • title: string - dc:title from metadata
    • - *
    • creator: string - dc:creator from metadata
    • - *
    • length: string - dcterms:extent in extent format
    • - *
    - *
  • - *
- * @see BasicStor::bsLocalSearch - */ - public function localSearch($criteria, $sessid='') - { - $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); - $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); - return $this->bsLocalSearch($criteria, $limit, $offset); - } // fn localSearch - - - /** - * Return values of specified metadata category - * - * @param string $category - * metadata category name - * with or without namespace prefix (dc:title, author) - * @param array $criteria - * see localSearch method - * @param string $sessid - * @return array, fields: - * results : array with found values - * cnt : integer - number of matching values - * @see BasicStor::bsBrowseCategory - */ - public function browseCategory($category, $criteria = null, $sessid = '') - { - $limit = 0; - $offset = 0; - if (!is_null($criteria)) { - $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); - $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); - } - $res = $this->bsBrowseCategory($category, $limit, $offset, $criteria); - return $res; - } // fn browseCategory - - - /*====================================================== playlist methods */ - /** - * Create a new empty playlist. - * - * @param string $fname - * human readable menmonic file name - * @param string $sessid - * session ID - * @return int - * local id of created playlist - */ - public function createPlaylist($fname, $sessid='') - { - $pl = new Playlist(); - $pl = $pl->create($fname); - - return $pl; - } // fn createPlaylist - - public function setPLMetadataValue($id, $category, $value, $lang=NULL, $mid=NULL) - { - $pl = Playlist::Recall($id); - - if($pl === FALSE) - return FALSE; - - $res = $pl->setPLMetaData($category, $value, $lang); - - return $res; - } - - public function getPLMetadataValue($id, $category, $langId=NULL) - { - $pl = Playlist::Recall($id); - - if($pl === FALSE) - return FALSE; - - $res = $pl->getPLMetaData($category); - - return $res; - } - - /** - * Return playlist as XML string - * - * @param int $id - * local object id - * @param string $sessid - * session ID - * @return string - * XML - */ - // function getPlaylistXml($id, $sessid) - // { - // return $this->getMetadata($id, $sessid); - // } // fn getPlaylistXml - - - /** - * Return playlist as hierarchical PHP hash-array - * - * @param int $id - * local object id - * @param string $sessid - * session ID - * @return array - */ - public function getPlaylistArray($id) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->getContents(); - - if(is_null($res)) - return array(); - - return $res; - } // fn getPlaylistArray - - - /** - * Mark playlist as edited and return edit token - * - * @param int $id - * local object id - * @param string $sessid - * session ID - * @return string - * playlist access token - */ - public function lockPlaylistForEdit($id, $sessid) { - $pl = Playlist::Recall($id); - - if($pl === FALSE) - return; - - $res = $pl->lock($sessid); - - return $res; - } - - - /** - * clear edit flag. - * - * @param string $sessid - * session ID - * @return string gunid - */ - public function releaseLockedPlaylist($id, $sessid) { - $pl = Playlist::Recall($id); - - if($pl === FALSE) - return FALSE; - - $res = $pl->unlock($sessid); - return $res; - } - - - /** - * Add audioclip specified by local id to the playlist - * - * @param string $token - * playlist access token - * @param string $acId - * local ID of added file - * @param string $sessid - * session ID - * @param string $fadeIn - * in time format hh:mm:ss.ssssss - * @param string $fadeOut - * in time format hh:mm:ss.ssssss - * @param string $length - * length in extent format - - * for webstream (or for overrule length of audioclip) - * @param string $clipstart - * optional clipstart time format hh:mm:ss.ssssss - relative to begin - * @param string $clipend - * optional $clipend time format hh:mm:ss.ssssss - relative to begin - * @return boolean, true if added. - */ - public function addAudioClipToPlaylist($id, $acId, $pos=NULL, $fadeIn=NULL, $fadeOut=NULL, $cliplength=NULL, $cueIn=NULL, $cueOut=NULL) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->addAudioClip($acId, $pos, $fadeIn, $fadeOut, $cliplength, $cueIn, $cueOut); - - return $res; - } // fn addAudioClipToPlaylist - - - /** - * Remove audioclip from playlist - * - * @param string $id - * playlist id - * @param int $pos - * position of element in playlist to delete. - * @return boolean, true if deleted. - * @todo rename this function to "deleteAudioClipFromPlaylist" - */ - public function delAudioClipFromPlaylist($id, $pos) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->delAudioClip($pos); - if($res === FALSE) - return FALSE; - - return TRUE; - } - - /** - * Move audioClip to the new position in the playlist. - * - * This method may change id attributes of playlistElements and/or - * fadeInfo. - * - * @param string $id - * playlist id - * @param id $oldPos - * old position in playlist - * @param int $newPos - * new position in playlist - * @return boolean - */ - public function moveAudioClipInPlaylist($id, $oldPos, $newPos) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->moveAudioClip($oldPos, $newPos); - - return $res; - } - - /** - * Change fadeInfo values - * - * @param string $id - * playlist id - * @param string $fadeIn - * in time format hh:mm:ss.ssssss - * @param string $fadeOut - * in time format hh:mm:ss.ssssss - * @return boolean - */ - public function changeFadeInfo($id, $pos, $fadeIn, $fadeOut) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->changeFadeInfo($pos, $fadeIn, $fadeOut); - - return $res; - } - - /** - * Change cueIn/cueOut values for playlist element - * - * @param string $id - * playlist id - * @param string $cueIn - * in time format hh:mm:ss.ssssss - * @param string $cueOut - * in time format hh:mm:ss.ssssss - * relative to begin - * @param sessid $string - * session ID - * @return boolean or pear error object - */ - public function changeClipLength($id, $pos, $cueIn, $cueOut) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->changeClipLength($pos, $cueIn, $cueOut); - - return $res; - } - - /** - * Delete a Playlist metafile. - * - * @param int $id - * local id - * @param string $sessid - * session ID - * @return boolean - */ - public function deletePlaylist($id) - { - return Playlist::Delete($id); - - } - - /** - * Find info about clip at specified offset in playlist. - * - * @param string $sessid - * session id - * @param string $plid - * playlist global unique id - * @param string $offset - * current playtime (hh:mm:ss.ssssss) - * @param int $distance - * 0=current clip; 1=next clip ... - * @return array of matching clip info: - *
    - *
  • gunid string, global unique id of clip
  • - *
  • elapsed string, already played time of clip
  • - *
  • remaining string, remaining time of clip
  • - *
  • duration string, total playlength of clip
  • - *
- */ - public function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0) - { - $pl = Playlist::Recall($plid); - if (is_null($pl) || PEAR::isError($pl)) { - return $pl; - } - $res = $pl->displayPlaylistClipAtOffset($offset, $distance); - if (PEAR::isError($res)) { - return $res; - } - $res['title'] = NULL; - $f = StoredFile::RecallByGunid($res['gunid']); - if (PEAR::isError($f)) { - return $f; - } - $res['title'] = $f->getMetadataValue("dc:title"); - $res['playlist_title'] = NULL; - $pl = Playlist::Recall($plid); - $res['playlist'] = $pl->getName(); - - return $res; - } - - - /** - * Create a tarfile with playlist export - playlist and all matching - * sub-playlists and media files (if desired) - * - * @param string $sessid - * string, session ID - * @param array $plids - * array of strings, playlist global unique IDs - * (one gunid is accepted too) - * @param string $type - * playlist format, values: lspl | smil | m3u - * @param boolean $standalone - * if only playlist should be exported or - * with all related files - * @return hasharray with fields: - * fname string: readable fname, - * token string: access token - */ - public function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE) - { - return $this->bsExportPlaylistOpen($plids, $type, !$standalone); - } // fn exportPlaylistOpen - - - /** - * Close playlist export previously opened by the exportPlaylistOpen method - * - * @param string $token - * access token obtained from exportPlaylistOpen - * method call - * @return TRUE|PEAR_Error - */ - public function exportPlaylistClose($token) - { - return $this->bsExportPlaylistClose($token); - } // fn exportPlaylistClose - - - /** - * Open writable handle for import playlist in LS Archive format - * - * @param string $sessid - * session id - * @param string $chsum - * md5 checksum of imported file - * @return hasharray with: - * fname string: writable local filename - * token string: put token - */ - public function importPlaylistOpen($sessid, $chsum='') - { - $userid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($userid)) { - return $userid; - } - $r = $this->bsOpenPut($chsum, NULL, $userid); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } // fn importPlaylistOpen - - - /** - * Close import-handle and import playlist - * - * @param string $token - * import token obtained by importPlaylistOpen method - * @return int - * result file local id (or error object) - */ - public function importPlaylistClose($token) - { - $arr = $this->bsClosePut($token); - if (PEAR::isError($arr)) { - return $arr; - } - $fname = $arr['fname']; - $owner = $arr['owner']; - $res = $this->bsImportPlaylist($fname, $owner); - if (file_exists($fname)) { - @unlink($fname); - } - return $res; - } // fn importPlaylistClose - - - /** - * Check whether a Playlist metafile with the given playlist ID exists. - * - * @param int $id - * local id - * @param string $sessid - * session ID - * @return boolean - */ - public function existsPlaylist($id) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - return TRUE; - } // fn existsPlaylist - - - /** - * Check whether a Playlist metafile with the given playlist ID - * is available for editing, i.e., exists and is not marked as - * beeing edited. - * - * @param int $id - * local id - * @param string $sessid - * session ID - * @return TRUE|int - * id of user editing it - */ - public function playlistIsAvailable($id, $sessid) - { - $pl = Playlist::Recall($id); - if ($pl === FALSE) { - return FALSE; - } - - $res = $pl->isEdited(); - - if($res !== FALSE) - return $res; - - return TRUE; - } // fn playlistIsAvailable - - - /* ---------------------------------------------- time conversion methods */ - /** - * Convert playlist time value to float seconds - * - * @param string $plt - * playlist time value (HH:mm:ss.dddddd) - * @return int - * seconds - */ - public function playlistTimeToSeconds($plt) - { - return Playlist::playlistTimeToSeconds($plt); - } - - - /** - * Convert float seconds value to playlist time format - * - * @param int $s0 - * seconds - * @return string - * time in playlist time format (HH:mm:ss.dddddd) - */ - public static function secondsToPlaylistTime($s0) - { - return Playlist::secondsToPlaylistTime($s0); - } // fn secondsToPlaylistTime - - - /* ------------------------------------------------------- render methods */ - /** - * Render playlist to ogg file (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return string $token - * render token - */ - public function renderPlaylistToFileOpen($sessid, $plid) - { - $r = Renderer::rnRender2FileOpen($this, $plid); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } // fn renderPlaylistToFileOpen - - - /** - * Render playlist to ogg file (check results) - * - * @param string $token - * render token - * @return hasharray: - * status : string - susccess | working | fault - * tmpfile : string - filepath to result temporary file - */ - public function renderPlaylistToFileCheck($token) - { - $r = Renderer::rnRender2FileCheck($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return array('status'=>$r['status'], 'tmpfile'=>$r['tmpfile']); - } // fn renderPlaylistToFileCheck - - - /** - * Render playlist to ogg file (list results) - * - * @param string $status - * success | working | fault - * if this parameter is not set, then return with all unclosed - * @return array of hasharray: - * status : string - susccess | working | fault - * tmpfile : string - filepath to result temporary file - */ - public function renderPlaylistToFileList($status='') - { - return Renderer::rnRender2FileList($this, $status); - } // fn renderPlaylistToFileList - - - /** - * Render playlist to ogg file (close handle) - * - * @param string $token - * render token - * @return boolean - * status - */ - public function renderPlaylistToFileClose($token) - { - $r = Renderer::rnRender2FileClose($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return array(TRUE); - } // fn renderPlaylistToFileClose - - - /** - * Render playlist to storage media clip (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return string - * render token - */ - public function renderPlaylistToStorageOpen($sessid, $plid) - { - $owner = GreenBox::getSessUserId($sessid); - if (PEAR::isError($owner)) { - return $owner; - } - $r = Renderer::rnRender2FileOpen($this, $plid, $owner); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } // fn renderPlaylistToStorageOpen - - - /** - * Render playlist to storage media clip (check results) - * - * @param string $token - * render token - * @return hasharray: - * status : string - susccess | working | fault - * gunid : string - gunid of result file - */ - public function renderPlaylistToStorageCheck($token) - { - $r = Renderer::rnRender2StorageCheck($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } // fn renderPlaylistToStorageCheck - - - /** - * Render playlist to RSS file (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return string - * render token - */ - public function renderPlaylistToRSSOpen($sessid, $plid) - { - $token = '123456789abcdeff'; - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - file_put_contents($fakeFile, "fake rendered file"); - return array('token'=>$token); - } // fn renderPlaylistToRSSOpen - - - /** - * Render playlist to RSS file (check results) - * - * @param string $token - * render token - * @return hasharray: - * status : string - susccess | working | fault - * tmpfile : string - filepath to result temporary file - */ - public function renderPlaylistToRSSCheck($token) - { - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - if ($token != '123456789abcdeff' || !file_exists($fakeFile)){ - return PEAR::raiseError( - "renderPlaylistToRSSCheck: invalid token ($token)" - ); - } - return array( - 'status'=> 'success', - 'tmpfile' => $fakeFile, - ); - } // fn renderPlaylistToRSSCheck - - - /** - * Render playlist to RSS file (list results) - * - * @param string $status - * success | working | fault - * @return array of hasharray: - * status : string - susccess | working | fault - * tmpfile : string - filepath to result temporary file - */ - // function renderPlaylistToRSSList($status='') - // { - // $dummytokens = array ('123456789abcdeff'); - // foreach ($dummytokens as $token) { - // $r[] = $this->renderPlaylistToRSSCheck($token); - // } - // return $r; - // } // fn renderPlaylistToRSSList - - - /** - * Render playlist to RSS file (close handle) - * - * @param string $token - * render token - * @return boolean - * status - */ - public function renderPlaylistToRSSClose($token) - { - if ($token != '123456789abcdeff'){ - return PEAR::raiseError( - "GreenBox::renderPlaylistToRSSClose: invalid token" - ); - } - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - unlink($fakeFile); - return TRUE; - } // fn renderPlaylistToRSSClose - - - /*================================================= storage admin methods */ - /* ------------------------------------------------------- backup methods */ - /** - * Create backup of storage (open handle) - * - * @param string $sessid - * session id - * @param struct $criteria - * see search criteria - * @return array - * token : string - backup token - */ - public function createBackupOpen($sessid, $criteria='') - { - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->openBackup($sessid,$criteria); - } // fn createBackupOpen - - - /** - * Create backup of storage (check results) - * - * @param string $token - * backup token - * @return hasharray with field: - * status : string - susccess | working | fault - * faultString: string - description of fault - * token : stirng - backup token - * url : string - access url - */ - public function createBackupCheck($token) - { - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->checkBackup($token); - } // fn createBackupCheck - - - /** - * Create backup of storage (list results) - * - * @param string $sessid - * session id - * @param string $stat - * if this parameter is not set, then return with all unclosed backups - * @return array of hasharray with field: - * status : string - susccess | working | fault - * token : stirng - backup token - * url : string - access url - */ - public function createBackupList($sessid, $stat='') - { - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->listBackups($stat); - } // fn createBackupList - - - /** - * Create backup of storage (close handle) - * - * @param string $token - * backup token - * @return boolean - * status - */ - public function createBackupClose($token) - { - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->closeBackup($token); - } // fn createBackupClose - - - /* ===================================================== restore funcitons*/ - /** - * Restore a backup file - * - * @param string $sessid - * session id - * @param string $filename - * backup file path - * @return string - * restore token - */ - public function backupRestoreOpen($sessid, $filename) - { - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->openRestore($sessid,$filename); - } // fn backupRestoreOpen - - - /** - * Check status of backup restore - * - * @param string $token - * restore token - * @return hasharray - * fields: - * token: string - restore token - * status: string - working | fault | success - * faultString: string - description of fault - */ - public function backupRestoreCheck($token) - { - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->checkRestore($token); - } // fn backupRestoreCheck - - - /** - * Close a restore procedure - * - * @param string $token - * restore token - * @return boolean - * is success - */ - public function backupRestoreClose($token) { - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->closeRestore($token); - } // fn backupRestoreClose - - /* ============================================== methods for preferences */ - - /** - * Read preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @return string - * preference value - */ - public function loadPref($sessid, $key) - { - $pr = new Prefs($this); - $res = $pr->loadPref($sessid, $key); - return $res; - } // fn loadPref - - - /** - * Save preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @param string $value - * preference value - * @return boolean - */ - public function savePref($sessid, $key, $value) - { - $pr = new Prefs($this); - $res = $pr->savePref($sessid, $key, $value); - return $res; - } // fn savePref - - - /** - * Delete preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @return boolean - */ - public function delPref($sessid, $key) - { - $pr = new Prefs($this); - $res = $pr->delPref($sessid, $key); - return $res; - } // fn delPref - - - /** - * Read group preference record - * - * @param string $sessid - * session id - * @param string $group - * group name - * @param string $key - * preference key - * @return string - * preference value - */ - public function loadGroupPref($group, $key) - { - $pr = new Prefs($this); - $res = $pr->loadGroupPref($group, $key); - return $res; - } // fn loadGroupPref - - - /** - * Save group preference record - * - * @param string $sessid - * session id - * @param string $group - * group name - * @param string $key - * preference key - * @param string $value - * preference value - * @return boolean - */ - public function saveGroupPref($sessid, $group, $key, $value) - { - $pr = new Prefs($this); - $res = $pr->saveGroupPref($sessid, $group, $key, $value); - return $res; - } // fn saveGroupPref - - - /** - * Delete group preference record - * - * @param string $sessid - * session id - * @param string $group - * group name - * @param string $key - * preference key - * @return boolean - */ - public function delGroupPref($sessid, $group, $key) - { - $pr = new Prefs($this); - $res = $pr->delGroupPref($sessid, $group, $key); - return $res; - } // fn delGroupPref - - - /* =================================================== networking methods */ - /* ------------------------------------------------------- common methods */ - /** - * Common "check" method for transports - * - * @param string $trtok - * transport token - * @return array with fields: - * trtype: string - audioclip | playlist | search | file - * state: string - transport state - * direction: string - up | down - * expectedsize: int - file size in bytes - * realsize: int - currently transported bytes - * expectedchsum: string - orginal file checksum - * realchsum: string - transported file checksum - * ... ? - */ - public function getTransportInfo($trtok) - { - $tr = new Transport($this); - return $tr->getTransportInfo($trtok); - } // fn getTransportInfo - - - /** - * Turn transports on/off, optionaly return current state. - * - * @param string $sessid - * session id - * @param boolean $onOff - * optional (if not used, current state is returned) - * @return boolean - * previous state - */ - public function turnOnOffTransports($sessid, $onOff=NULL) - { - $tr = new Transport($this); - return $tr->turnOnOffTransports($sessid, $onOff); - } // fn turnOnOffTransports - - - /** - * Pause, resume or cancel transport - * - * @param string $trtok - * transport token - * @param string $action - * pause | resume | cancel - * @return string - * resulting transport state - */ - public function doTransportAction($trtok, $action) - { - $tr = new Transport($this); - $res = $tr->doTransportAction($trtok, $action); - return $res; - } // fn doTransportAction - - - /* ------------------------ methods for ls-archive-format file transports */ - /** - * Open async file transfer from local storageServer to network hub, - * file should be ls-archive-format file. - * - * @param string $filePath - * local path to uploaded file - * @return string - * transport token - */ - public function uploadFile2Hub($filePath) - { - $tr = new Transport($this); - return $tr->uploadFile2Hub($filePath); - } // fn uploadFile2Hub - - - /** - * Get list of prepared transfers initiated by hub - * - * @return array of structs/hasharrays with fields: - * trtok: string transport token - * ... ? - */ - public function getHubInitiatedTransfers() - { - $tr = new Transport($this); - return $tr->getHubInitiatedTransfers(); - } // fn getHubInitiatedTransfers - - - /** - * Start of download initiated by hub - * - * @param string $trtok - * transport token obtained from - * the getHubInitiatedTransfers method - * @return string - * transport token - */ - public function startHubInitiatedTransfer($trtok) - { - $tr = new Transport($this); - return $tr->startHubInitiatedTransfer($trtok); - } // fn startHubInitiatedTransfer - - - /* ------------- special methods for audioClip/webstream object transport */ - - /** - * Start upload of audioClip/webstream/playlist from local storageServer - * to hub - * - * @param string $gunid - * global unique id of object being transported - * @param boolean $withContent - * if true, transport playlist content too - * @return string - * transport token - * @todo rename this function "uploadToHub" - */ - public function upload2Hub($gunid, $withContent=FALSE) - { - $tr = new Transport($this); - return $tr->upload2Hub($gunid, $withContent); - } // fn upload2Hub - - - /** - * Start download of audioClip/webstream/playlist from hub to local - * storageServer - * - * @param string $sessid - * session id - * @param string $gunid - * global unique id of playlist being transported - * @param boolean $withContent - * if true, transport playlist content too - * @return string - * transport token - */ - public function downloadFromHub($sessid, $gunid, $withContent=TRUE){ - $uid = GreenBox::getSessUserId($sessid); - if (PEAR::isError($uid)) { - return $uid; - } - $tr = new Transport($this); - return $tr->downloadFromHub($uid, $gunid, $withContent); - } // fn downloadFromHub - - - /* ------------------------------------------------ global-search methods */ - /** - * Start search job on network hub - * - * @param array $criteria - * criteria format (see localSearch) - * @return string - * transport token - */ - public function globalSearch($criteria) - { - $tr = new Transport($this); - //return $tr->globalSearch($criteria); - return $tr->remoteSearch($criteria); - } - - - /** - * Get results from search job on network hub - * - * @param string $trtok - * transport token - * @param boolean $andClose - * if TRUE, close transport token - * @return array - * search result format (see localSearch) - */ - // public function getSearchResults($trtok, $andClose=TRUE) - // { - // $tr = new Transport($this); - // return $tr->getSearchResults($trtok, $andClose); - // } // fn getSearchResults - - - /* ========================================================= info methods */ - /** - * Check if file gunid exists in the storage and - * user have permission to read it - * - * @param string $sessid - * session id - * @param string $gunid - * @param string $ftype - * internal file type - * @return string|PEAR_Error - */ - public function existsFile($sessid, $gunid, $ftype=NULL) - { - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::RecallByGunid($gunid); - return $f->existsFile(); - } // fn existsFile - - - /* ==================================================== redefined methods */ - /** - * Get user id from session id - * - * This redefinition only simulate old (bad) behaviour - returns NULL - * for wrong sessid (code ALIBERR_NOTEXISTS). - * HtmlUI depends on it. - * - * @param string $sessid - * @return int|null|PEAR_Error - */ - public static function GetSessUserId($sessid) - { - $r = Alib::GetSessUserId($sessid); - if (PEAR::isError($r)) { - if ($r->getCode() == ALIBERR_NOTEXISTS) { - return NULL; - } else { - return $r; - } - } - return $r; - } // fn getSessUserId - - - /** - * Change user password. - * - * ('superuser mode'= superuser is changing some password without - * knowledge of the old password) - * - * @param string $login - * @param string $oldpass - * old password - * (should be null or empty for 'superuser mode') - * @param string $pass - * @param string $sessid - * session id, required for 'superuser mode' - * @return boolean/err - */ - public function passwd($login, $oldpass=null, $pass='', $sessid='') - { - if (is_null($oldpass) || ($oldpass == '') ) { - if (($res = BasicStor::Authorize('subjects', $this->rootId, $sessid)) !== TRUE) { - sleep(2); - return $res; - } else { - $oldpass = null; - } - } else { - if (FALSE === Subjects::Authenticate($login, $oldpass)) { - sleep(2); - return PEAR::raiseError( - "GreenBox::passwd: access denied (oldpass)", GBERR_DENY); - } - } - $res = Subjects::Passwd($login, $oldpass, $pass); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } // fn passwd - - - /** - * Insert permission record - * - * @param int $sid - * local user/group id - * @param string $action - * @param int $oid - * local object id - * @param char $type - * 'A'|'D' (allow/deny) - * @param string $sessid - * session id - * @return int - * local permission id - */ - public function addPerm($sid, $action, $oid, $type='A', $sessid='') - { - if (($res = BasicStor::Authorize('editPerms', $oid, $sessid)) !== TRUE) { - return $res; - } - return Alib::AddPerm($sid, $action, $oid, $type); - } // fn addPerm - - - /** - * Remove permission record - * - * @param int $permid - * local permission id - * @param int $subj - * local user/group id - * @param int $obj - * local object id - * @param string $sessid - * session id - * @return boolean/error - */ - public function removePerm($permid=NULL, $subj=NULL, $obj=NULL, $sessid='') - { - if (!is_null($permid)) { - $oid = Alib::GetPermOid($permid); - if (PEAR::isError($oid)) { - return $oid; - } - if (!is_null($oid)) { - if (($res = BasicStor::Authorize('editPerms', $oid, $sessid)) !== TRUE) { - return $res; - } - } - } - $res = Alib::RemovePerm($permid, $subj, $obj); - return $res; - } // fn removePerm - - } // class GreenBox - ?> \ No newline at end of file diff --git a/backend/LocStor.php b/backend/LocStor.php deleted file mode 100644 index fa0956f3b..000000000 --- a/backend/LocStor.php +++ /dev/null @@ -1,1749 +0,0 @@ -"; -} -require_once("BasicStor.php"); -if (isset($WHITE_SCREEN_OF_DEATH) && $WHITE_SCREEN_OF_DEATH) { - echo __FILE__.':line '.__LINE__.": Loaded BasicStor
"; -} -require_once("Transport.php"); -if (isset($WHITE_SCREEN_OF_DEATH) && $WHITE_SCREEN_OF_DEATH) { - echo __FILE__.':line '.__LINE__.": Loaded Transport
"; -} - -/** - * LocStor class - * - * Local storage interface - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class LocStor extends BasicStor { - - /* ---------------------------------------------------------------- store */ - - /** - * Store or replace existing audio clip. - * - * Sending a file to the storage server is a 3 step process: - * 1) Call storeAudioClipOpen - * 2) Upload the file to the URL specified - * 3) Call storeAudioClipClose - * - * @param string $sessid - * session id - * @param string $gunid - * global unique id - * @param string $metadata - * metadata XML string - * @param string $fname - * human readable menmonic file name - * with extension corresponding to filetype - * @param string $chsum - * md5 checksum of media file - * @param string $ftype - * audioclip | playlist | webstream - * @return array - * {url:writable URL for HTTP PUT, token:access token} - */ - protected function storeAudioClipOpen($sessid, $gunid, $metadata, - $fname, $chsum, $ftype='audioclip') - { - // Check the gunid format - if (!BasicStor::CheckGunid($gunid)) { - return PEAR::raiseError( - "LocStor::storeAudioClipOpen: Wrong gunid ($gunid)" - ); - } - - // Check if we already have this file. - $duplicate = StoredFile::RecallByMd5($chsum); - if (!empty($chsum) && $duplicate) { - return PEAR::raiseError( - "LocStor::storeAudioClipOpen: Duplicate file" - ." - Matched MD5 ($chsum) against '".$duplicate->getName()."'", - 888); - } - - // Check if specified gunid exists. - $storedFile =& StoredFile::RecallByGunid($gunid); - if (!is_null($storedFile) && !PEAR::isError($storedFile)) { - // gunid exists - do replace - $oid = $storedFile->getId(); - if (($res = BasicStor::Authorize('write', $oid, $sessid)) !== TRUE) { - return $res; - } - if ($storedFile->isAccessed()) { - return PEAR::raiseError( - 'LocStor::storeAudioClipOpen: is accessed' - ); - } - $res = $storedFile->replace($oid, $storedFile->getName(), '', $metadata, 'string'); - if (PEAR::isError($res)) { - return $res; - } - } else { - // gunid doesn't exist - do insert: - $tmpFname = uniqid(); - if (($res = BasicStor::Authorize('write', null, $sessid)) !== TRUE) { - return $res; - } - $values = array( - "metadata" => $metadata, - "gunid" => $gunid, - "filetype" => $ftype); - $storedFile =& StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - if (PEAR::isError($res)) { - return $res; - } - } - $res = $storedFile->setState('incomplete'); - if (PEAR::isError($res)) { - return $res; - } - if ($fname == '') { - $fname = "newFile"; - } - $storedFile->setName($fname); - return $this->bsOpenPut($chsum, $storedFile->gunid); - } - - - /** - * Store or replace existing audio clip - * - * @param string $sessid - * @param string $token - * @return string gunid|PEAR_Error - */ - protected function storeAudioClipClose($sessid, $token) - { - $storedFile =& StoredFile::RecallByToken($token); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - $arr = $this->bsClosePut($token); - if (PEAR::isError($arr)) { - $storedFile->delete(); - return $arr; - } - $fname = $arr['fname']; - $res = $storedFile->setRawMediaData($fname); - if (PEAR::isError($res)) { - return $res; - } - if (file_exists($fname)) { - @unlink($fname); - } - $res = $storedFile->setState('ready'); - if (PEAR::isError($res)) { - return $res; - } - return $storedFile->gunid; - } - - - /** - * Check uploaded file - * - * @param string $token - * "put" token - * @return array - * hash, (status: boolean, size: int - filesize) - */ - protected function uploadCheck($token) - { - return $this->bsCheckPut($token); - } - - - /** - * Store webstream - * - * @param string $sessid - * session id - * @param string $gunid - * global unique id - * @param string $metadata - * metadata XML string - * @param string $fname - * human readable menmonic file name with extension corresponding to filetype - * @param string $url - * webstream url - * @return string - * gunid - */ - protected function storeWebstream($sessid, $gunid, $metadata, $fname, $url) - { - $a = $this->storeAudioClipOpen( - $sessid, $gunid, $metadata, $fname, md5(''), 'webstream'); - if (PEAR::isError($a)) { - return $a; - } - $gunid = $this->storeAudioClipClose($sessid, $a['token']); - if (PEAR::isError($gunid)) { - return $gunid; - } - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - $r = $storedFile->setMetadataValue('ls:url', $url); - if (PEAR::isError($r)) { - return $r; - } - return $gunid; - } - - - /* --------------------------------------------------------------- access */ - /** - * Make access to audio clip - * - * @param string $sessid - * @param string $gunid - * @param int $parent - * parent token - * @return array - * with: seekable filehandle, access token - */ - public function accessRawAudioData($sessid, $gunid, $parent='0') - { - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) { - return $res; - } - return $storedFile->accessRawMediaData($parent); - } - - - /** - * Release access to audio clip - * - * @param string $sessid - * @param string $token - * access token - * @return boolean|PEAR_Error - */ - public function releaseRawAudioData($sessid, $token) - { - $storedFile =& StoredFile::RecallByToken($token); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - return $storedFile->releaseRawMediaData($token); - } - - - /* ------------------------------------------------------------- download */ - /** - * Create and return downloadable URL for audio file - * - * @param string $sessid - * session id - * @param string $gunid - * global unique id - * @return array - * array with strings: - * downloadable URL, download token, chsum, size, filename - */ - protected function downloadRawAudioDataOpen($sessid, $gunid) - { - $ex = $this->existsAudioClip($sessid, $gunid); - if (PEAR::isError($ex)) { - return $ex; - } - $media = StoredFile::RecallByGunid($gunid); - $id = $media->getId(); - if (is_null($id) || !$ex) { - return PEAR::raiseError( - "LocStor::downloadRawAudioDataOpen: gunid not found ($gunid)", - GBERR_NOTF - ); - } - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - return $this->bsOpenDownload($id); - } - - - /** - * Discard downloadable URL for audio file - * - * @param string $token - * download token - * @return string - * gunid - */ - protected function downloadRawAudioDataClose($token) - { - return $this->bsCloseDownload($token); - } - - - /** - * Create and return downloadable URL for metadata - * - * @param string $sessid - * session id - * @param string $gunid - * global unique id - * @return array - * array with strings: - * downloadable URL, download token, chsum, filename - */ - protected function downloadMetadataOpen($sessid, $gunid) - { - // $res = $this->existsAudioClip($sessid, $gunid); - // if(PEAR::isError($res)) return $res; - $media = StoredFile::RecallByGunid($gunid) - $id = $media->getGunid(); - if (is_null($id)) { - return PEAR::raiseError( - "LocStor::downloadMetadataOpen: gunid not found ($gunid)" - ); - } - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $res = $this->bsOpenDownload($id, 'metadata'); - #unset($res['filename']); - return $res; - } - - - /** - * Discard downloadable URL for metadata - * - * @param string $token - * download token - * @return string - * gunid - */ - protected function downloadMetadataClose($token) - { - return $this->bsCloseDownload($token, 'metadata'); - } - - - /** - * Return metadata as XML - * - * @param string $sessid - * @param string $gunid - * @return string|PEAR_Error - */ - protected function getAudioClip($sessid, $gunid) - { - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) { - return $res; - } - $md = $storedFile->getMetadata(); - if (PEAR::isError($md)) { - return $md; - } - return $md; - } - - - /* ------------------------------------------------------- search, browse */ - - /** - * Search in metadata database - * - * @param string $sessid - * @param array $criteria - * with following structure:
- *
    - *
  • filetype - string, type of searched files, - * meaningful values: 'audioclip', 'webstream', 'playlist', 'all'
  • - *
  • operator - string, type of conditions join - * (any condition matches / all conditions match), - * meaningful values: 'and', 'or', '' - * (may be empty or ommited only with less then 2 items in - * "conditions" field) - *
  • - *
  • limit : int - limit for result arrays (0 means unlimited)
  • - *
  • offset : int - starting point (0 means without offset)
  • - *
  • orderby : string - metadata category for sorting (optional) - * or array of strings for multicolumn orderby - * [default: dc:creator, dc:source, dc:title] - *
  • - *
  • desc : boolean - flag for descending order (optional) - * or array of boolean for multicolumn orderby - * (it corresponds to elements of orderby field) - * [default: all ascending] - *
  • - *
  • conditions - array of hashes with structure: - *
      - *
    • cat - string, metadata category name
    • - *
    • op - string, operator - meaningful values: - * 'full', 'partial', 'prefix', '=', '<', - * '<=', '>', '>='
    • - *
    • val - string, search value
    • - *
    - *
  • - *
- * @return array of hashes, fields: - *
    - *
  • cnt : integer - number of matching gunids - * of files have been found
  • - *
  • results : array of hashes: - *
      - *
    • gunid: string
    • - *
    • type: string - audioclip | playlist | webstream
    • - *
    • title: string - dc:title from metadata
    • - *
    • creator: string - dc:creator from metadata
    • - *
    • source: string - dc:source from metadata
    • - *
    • length: string - dcterms:extent in extent format
    • - *
    - *
  • - *
- * @see BasicStor::localSearch - */ - public function searchMetadata($sessid, $criteria) - { - if (($res = BasicStor::Authorize('read', $this->storId, $sessid)) !== TRUE) { - return $res; - } - $criteria['resultMode'] = 'xmlrpc'; - $res = $this->localSearch($criteria, $sessid); - return $res; - } - - - /** - * @param array $criteria - * @param mixed $sessid - * This variable isnt used. - * @return unknown - */ - public function localSearch($criteria, $sessid='') - { - $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); - $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); - $res = $this->bsLocalSearch($criteria, $limit, $offset); - return $res; - } - - - /** - * Return values of specified metadata category - * - * @param string $category - * metadata category name - * with or without namespace prefix (dc:title, author) - * @param hash $criteria - * see searchMetadata method - * @param string $sessid - * @return array - * hash, fields: - * results : array with found values - * cnt : integer - number of matching values - * @see BasicStor::bsBrowseCategory - */ - protected function browseCategory($category, $criteria=NULL, $sessid='') - { - $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); - $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); - $res = $this->bsBrowseCategory($category, $limit, $offset, $criteria); - return $res; - } - - - /* ----------------------------------------------------------------- etc. */ - /** - * Check if audio clip exists - * - * @param string $sessid - * @param string $gunid - * @return boolean - */ - protected function existsAudioClip($sessid, $gunid) - { - $ex = $this->existsFile($sessid, $gunid, 'audioclip'); - // webstreams are subset of audioclips - moved to BasicStor - // if($ex === FALSE ){ - // $ex = $this->existsFile($sessid, $gunid, 'webstream'); - // } - if ($ex === FALSE ) { - return FALSE; - } - if (PEAR::isError($ex)) { - return $ex; - } - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - return $storedFile->exists(); - } - - - /** - * Check if file exists in the storage - * - * @param string $sessid - * @param string $gunid - * @param string $ftype - * internal file type - * @return boolean - */ - protected function existsFile($sessid, $gunid, $ftype=NULL) - { - if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - return $res; - } - $f = StoredFile::RecallByGunid($gunid); - if (PEAR::isError($f)) { - return FALSE; - } - return $f->existsFile(); - } - - - /** - * Delete existing audio clip - * - * @param string $sessid - * @param string $gunid - * @param boolean $forced - * if true, don't use trash - * @return boolean|PEAR_Error - */ - protected function deleteAudioClip($sessid, $gunid, $forced=FALSE) - { - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile)) { - return TRUE; - } - if (PEAR::isError($storedFile)) { - if ($storedFile->getCode()==GBERR_FOBJNEX && $forced) { - return TRUE; - } - return $storedFile; - } - if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) { - return $res; - } - $res = $storedFile->delete(); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Update existing audio clip metadata - * - * @param string $sessid - * @param string $gunid - * @param string $metadata - * metadata XML string - * @return boolean|PEAR_Error - */ - protected function updateAudioClipMetadata($sessid, $gunid, $metadata) - { - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) { - return $res; - } - return $storedFile->setMetadata($metadata, 'string'); - } - - - /*====================================================== playlist methods */ - /** - * Create a new empty playlist. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @param string $fname - * human readable mnemonic file name - * @return string - * playlist global unique ID - */ - public function createPlaylist($sessid, $playlistId, $fname) - { - $ex = $this->existsPlaylist($sessid, $playlistId); - if (PEAR::isError($ex)) { - return $ex; - } - if ($ex) { - return PEAR::raiseError( - 'LocStor::createPlaylist: already exists' - ); - } - $tmpFname = uniqid(''); - if (($res = BasicStor::Authorize('write', null, $sessid)) !== TRUE) { - return $res; - } - $values = array( - "metadata" => dirname(__FILE__).'/emptyPlaylist.xml', - "gunid" => $playlistId, - "filetype" => "playlist"); - // This is all wrong now. - $storedFile = StoredFile::Insert($values); - if ($fname == '') { - $fname = "newFile.xml"; - } - $storedFile->setName($fname); - $storedFile->setState('ready'); - $storedFile->setMime('application/smil'); - return $storedFile->gunid; - } - - - /** - * Open a Playlist metafile for editing. - * Open readable URL and mark file as beeing edited. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @return struct - * {url:readable URL for HTTP GET, token:access token, chsum:checksum} - */ - public function editPlaylist($sessid, $playlistId) - { - $ex = $this->existsPlaylist($sessid, $playlistId); - if (PEAR::isError($ex)) { - return $ex; - } - if (!$ex) { - return PEAR::raiseError( - 'LocStor::editPlaylist: playlist not exists' - ); - } - if ($this->isEdited($playlistId) !== FALSE) { - return PEAR::raiseError( - 'LocStor::editPlaylist: playlist already edited' - ); - } - $storedFile =& StoredFile::RecallByGunid($playlistId); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - $id = $storedFile->getId(); - if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { - return $res; - } - $res = $this->bsOpenDownload($id, 'metadata'); - if (PEAR::isError($res)) { - return $res; - } - $r = $this->setEditFlag($playlistId, TRUE, $sessid); - if (PEAR::isError($r)) { - return $r; - } - unset($res['filename']); - return $res; - } - - - /** - * Store a new Playlist metafile in place of the old one. - * - * @param string $sessid - * session ID - * @param string $playlistToken - * playlist access token - * @param string $newPlaylist - * new playlist as XML string - * @return string - * playlistId - */ - protected function savePlaylist($sessid, $playlistToken, $newPlaylist) - { - $playlistId = $this->bsCloseDownload($playlistToken, 'metadata'); - if (PEAR::isError($playlistId)) { - return $playlistId; - } - $storedFile =& StoredFile::RecallByGunid($playlistId); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - $res = $storedFile->setMetadata($newPlaylist, 'string', 'playlist'); - if (PEAR::isError($res)) { - return $res; - } - $r = $this->setEditFlag($playlistId, FALSE, $sessid); - if (PEAR::isError($r)) { - return $r; - } - return $playlistId; - } - - - /** - * RollBack playlist changes to the locked state - * - * @param string $playlistToken - * playlist access token - * @param string $sessid - * session ID - * @return string - * gunid of playlist - */ - public function revertEditedPlaylist($playlistToken, $sessid='') - { - $gunid = $this->bsCloseDownload($playlistToken, 'metadata'); - if (PEAR::isError($gunid)) { - return $gunid; - } - $storedFile =& StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - $id = $storedFile->getId(); - $mdata = $storedFile->getMetadata(); - if (PEAR::isError($mdata)) { - return $mdata; - } - $res = $storedFile->setMetadata($mdata, 'string'); - if (PEAR::isError($res)) { - return $res; - } - $this->setEditFlag($gunid, FALSE, $sessid); - return $gunid; - } - - - /** - * Delete a Playlist metafile. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @param boolean $forced - * if true don't use trash - * @return boolean - */ - public function deletePlaylist($sessid, $playlistId, $forced=FALSE) - { - $ex = $this->existsPlaylist($sessid, $playlistId); - if (PEAR::isError($ex)) { - return $ex; - } - if (!$ex) { - if ($forced) { - return TRUE; - } - return PEAR::raiseError( - 'LocStor::deletePlaylist: playlist not exists', - GBERR_FILENEX - ); - } - $storedFile =& StoredFile::RecallByGunid($playlistId); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - if (($res = BasicStor::Authorize('write', $storedFile->getId(), $sessid)) !== TRUE) { - return $res; - } - $res = $storedFile->delete(); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Access (read) a Playlist metafile. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @param boolean $recursive - * flag for recursive access content inside playlist - * @param int $parent - * parent token - * @return struct { - * url: readable URL for HTTP GET, - * token: access token, - * chsum: checksum, - * content: array of structs - recursive access (optional) - * filename: string mnemonic filename - * } - */ - public function accessPlaylist($sessid, $playlistId, $recursive=FALSE, $parent='0') - // { - // if ($recursive) { - // require_once("AccessRecur.php"); - // $r = AccessRecur::accessPlaylist($this, $sessid, $playlistId); - // if (PEAR::isError($r)) { - // return $r; - // } - // return $r; - // } - // $ex = $this->existsPlaylist($sessid, $playlistId); - // if (PEAR::isError($ex)) { - // return $ex; - // } - // if (!$ex) { - // return PEAR::raiseError( - // "LocStor::accessPlaylist: playlist not found ($playlistId)", - // GBERR_NOTF - // ); - // } - // $id = BasicStor::IdFromGunid($playlistId); - // if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { - // return $res; - // } - // $res = $this->bsOpenDownload($id, 'metadata', $parent); - // #unset($res['filename']); - // return $res; - } - - - /** - * Release the resources obtained earlier by accessPlaylist(). - * - * @param string $sessid - * session ID - * @param string $playlistToken - * playlist access token - * @param boolean $recursive - * flag for recursive access content inside playlist - * @return string - * playlist ID - */ - public function releasePlaylist($sessid, $playlistToken, $recursive=FALSE) - { - if ($recursive) { - require_once"AccessRecur.php"; - $r = AccessRecur::releasePlaylist($this, $sessid, $playlistToken); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - return $this->bsCloseDownload($playlistToken, 'metadata'); - } - - - /** - * Create a tarfile with playlist export - playlist and all matching - * sub-playlists and media files (if desired) - * - * @param string $sessid - * session ID - * @param array $plids - * array of strings, playlist global unique IDs (one gunid is accepted too) - * @param string $type - * playlist format, values: lspl | smil | m3u - * @param boolean $standalone - * if only playlist should be exported or with all related files - * @return hasharray with fields: - * url string: readable url, - * token string: access token - * chsum string: md5 checksum, - */ - protected function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE) - { - $res = $this->bsExportPlaylistOpen($plids, $type, !$standalone); - if (PEAR::isError($res)) { - return $res; - } - $url = BasicStor::GetUrlPart()."access/".basename($res['fname']); - $chsum = md5_file($res['fname']); - $size = filesize($res['fname']); - return array( - 'url' => $url, - 'token' => $res['token'], - 'chsum' => $chsum, - ); - } - - - /** - * Close playlist export previously opened by the exportPlaylistOpen method - * - * @param string $token - * access token obtained from exportPlaylistOpen method call - * @return boolean|PEAR_Error - */ - protected function exportPlaylistClose($token) - { - return $this->bsExportPlaylistClose($token); - } - - - /** - * Open writable handle for import playlist in LS Archive format - * - * @param string $sessid - * session id - * @param string $chsum - * md5 checksum of imported file - * @return hasharray with: - * url string: writable URL - * token string: PUT token - */ - protected function importPlaylistOpen($sessid, $chsum) - { - $userid = Alib::GetSessUserId($sessid); - if (PEAR::isError($userid)) { - return $userid; - } - $r = $this->bsOpenPut($chsum, NULL, $userid); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - /** - * Close import-handle and import playlist - * - * @param string $token - * import token obtained by importPlaylistOpen method - * @return string - * result file global id (or error object) - */ - protected function importPlaylistClose($token) - { - $arr = $this->bsClosePut($token); - if (PEAR::isError($arr)) { - return $arr; - } - $fname = $arr['fname']; - $owner = $arr['owner']; - $res = $this->bsImportPlaylist($fname); - if (file_exists($fname)) { - @unlink($fname); - } - if (PEAR::isError($res)) { - return $res; - } - $media = StoredFile::Recall($id); - return $media->getGunId(); - } - - - /** - * Check whether a Playlist metafile with the given playlist ID exists. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @return boolean - */ - public function existsPlaylist($sessid, $playlistId) - { - return $this->existsFile($sessid, $playlistId, 'playlist'); - } - - - /** - * Check whether a Playlist metafile with the given playlist ID - * is available for editing, i.e., exists and is not marked as - * being edited. - * - * @param string $sessid - * session ID - * @param string $playlistId - * playlist global unique ID - * @param boolean $getUid - * flag for returning editedby uid - * @return boolean - */ - public function playlistIsAvailable($sessid, $playlistId, $getUid=FALSE) - { - $ex = $this->existsPlaylist($sessid, $playlistId); - if (PEAR::isError($ex)) { - return $ex; - } - if (!$ex) { - return PEAR::raiseError( - 'LocStor::playlistIsAvailable: playlist not exists' - ); - } - $ie = $this->isEdited($playlistId); - if ($ie === FALSE) { - return TRUE; - } - if ($getUid) { - return $ie; - } - return FALSE; - } - - - /* ------------------------------------------------------- render methods */ - /** - * Render playlist to ogg file (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return hasharray - * token: string - render token - */ - protected function renderPlaylistToFileOpen($sessid, $plid) - { - require_once("Renderer.php"); - $r = Renderer::rnRender2FileOpen($this, $plid); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - /** - * Render playlist to ogg file (check results) - * - * @param string $token - * render token - * @return hasharray: - * status : string - success | working | fault - * url : string - readable url - */ - protected function renderPlaylistToFileCheck($token) - { - require_once("Renderer.php"); - $r = Renderer::rnRender2FileCheck($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return array('status'=>$r['status'], 'url'=>$r['url']); - } - - - /** - * Render playlist to ogg file (close handle) - * - * @param string $token - * render token - * @return boolean status - */ - protected function renderPlaylistToFileClose($token) - { - require_once("Renderer.php"); - $r = Renderer::rnRender2FileClose($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return array(TRUE); - } - - - /** - * Render playlist to storage media clip (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return string - * render token - */ - protected function renderPlaylistToStorageOpen($sessid, $plid) - { - require_once("Renderer.php"); - $owner = Alib::GetSessUserId($sessid); - if (PEAR::isError($owner)) { - return $owner; - } - $r = Renderer::rnRender2FileOpen($this, $plid, $owner); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - /** - * Render playlist to storage media clip (check results) - * - * @param string $token - * render token - * @return hasharray: - * status : string - success | working | fault - * gunid : string - gunid of result file - */ - protected function renderPlaylistToStorageCheck($token) - { - require_once("Renderer.php"); - $r = Renderer::rnRender2StorageCheck($this, $token); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - /** - * Render playlist to RSS file (open handle) - * - * @param string $sessid - * session id - * @param string $plid - * playlist gunid - * @return string - * render token - */ - protected function renderPlaylistToRSSOpen($sessid, $plid) - { - global $CC_CONFIG; - $token = '123456789abcdeff'; - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - file_put_contents($fakeFile, "fake rendered file"); - return array('token'=>$token); - } - - - /** - * Render playlist to RSS file (check results) - * - * @param string $token - * render token - * @return hasharray : - * status : string - success | working | fault - * url : string - readable url - */ - protected function renderPlaylistToRSSCheck($token) - { - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - if ($token != '123456789abcdeff' || !file_exists($fakeFile)) { - return PEAR::raiseError( - "LocStor::renderPlaylistToRSSCheck: invalid token ($token)" - ); - } - $fakeFUrl = BasicStor::GetUrlPart()."access/$token.rss"; - return array( - 'status'=> 'success', - 'url' => $fakeFUrl, - ); - } - - - /** - * Render playlist to RSS file (close handle) - * - * @param string $token - * render token - * @return boolean - * status - */ - protected function renderPlaylistToRSSClose($token) - { - if ($token != '123456789abcdeff') { - return PEAR::raiseError( - "LocStor::renderPlaylistToRSSClose: invalid token" - ); - } - $fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; - unlink($fakeFile); - return TRUE; - } - - - /*================================================= storage admin methods */ - - /* ------------------------------------------------------- backup methods */ - - /** - * Create backup of storage (open handle) - * - * @param string $sessid - * session id - * @param array $criteria - * see search criteria - * @return array - * token : string - backup token - */ - protected function createBackupOpen($sessid, $criteria='') - { - require_once("Backup.php"); - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - $r = $bu->openBackup($sessid,$criteria); - if ($r === FALSE) { - return PEAR::raiseError( - "LocStor::createBackupOpen: false returned from Backup" - ); - } - return $r; - } - - - /** - * Create backup of storage (check results) - * - * @param string $token - * backup token - * @return hasharray - * with field: - * status : string - susccess | working | fault - * faultString: string - description of fault - * token : stirng - backup token - * url : string - access url - */ - protected function createBackupCheck($token) - { - require_once("Backup.php"); - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->checkBackup($token); - } - - - /** - * Create backup of storage (list results) - * - * @param string $sessid - * session id - * @param status $stat - * if this parameter is not set, then return with all unclosed backups - * @return array - * array of hasharray with field: - * status : string - susccess | working | fault - * token : stirng - backup token - * url : string - access url - */ - protected function createBackupList($sessid, $stat='') - { - require_once("Backup.php"); - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->listBackups($stat); - } - - - /** - * Create backup of storage (close handle) - * - * @param string $token - * backup token - * @return boolean - * status - */ - protected function createBackupClose($token) - { - require_once("Backup.php"); - $bu = new Backup($this); - if (PEAR::isError($bu)) { - return $bu; - } - return $bu->closeBackup($token); - } - - - /* ------------------------------------------------------ restore methods */ - - /** - * Restore a backup file (open handle) - * - * @param string $sessid - * session id - * @param string $chsum - * md5 checksum of imported file - * @return array - * array with: - * url string: writable URL - * fname string: writable local filename - * token string: PUT token - */ - protected function restoreBackupOpen($sessid, $chsum) - { - $userid = Alib::getSessUserId($sessid); - if (PEAR::isError($userid)) { - return $userid; - } - $r = $this->bsOpenPut($chsum, NULL, $userid); - if (PEAR::isError($r)) { - return $r; - } - return $r; - } - - - /** - * Restore a backup file (close put handle) - * - * @param string $sessid - * session id - * @param string $token - * "put" token - * @return string $token - * restore token - */ - protected function restoreBackupClosePut($sessid, $token) { - $arr = $this->bsClosePut($token); - if (PEAR::isError($arr)) { - return $arr; - } - $fname = $arr['fname']; - require_once('Restore.php'); - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->openRestore($sessid, $fname); - } - - - /** - * Restore a backup file (check state) - * - * @param string $token - * restore token - * @return array - * status - fields: - * token: string - restore token - * status: string - working | fault | success - * faultString: string - description of fault - */ - protected function restoreBackupCheck($token) - { - require_once('Restore.php'); - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->checkRestore($token); - } - - - /** - * Restore a backup file (close handle) - * - * @param string $token - * restore token - * @return array - * status - fields: - * token: string - restore token - * status: string - working | fault | success - */ - protected function restoreBackupClose($token) { - require_once('Restore.php'); - $rs = new Restore($this); - if (PEAR::isError($rs)) { - return $rs; - } - return $rs->closeRestore($token); - } - - - /*===================================================== auxiliary methods */ - /** - * Dummy method - only returns Campcaster version - * - * @return string - */ - public static function getVersion() - { - return CAMPCASTER_VERSION; - } - - /** - * Open upload transport (from station to hub) - * - * @param string $sessid - * session id - * @param string $chsum - * checksum - * @return array - * hasharray with: - * url string: writable URL - * token string: PUT token - */ - function uploadOpen($sessid, $chsum) - { - $owner = Alib::GetSessUserId($sessid); - if (PEAR::isError($owner)) { - return $owner; - } - $res = $this->bsOpenPut($chsum, NULL, $owner); - if (PEAR::isError($res)) { - return $res; - } - return array('url'=>$res['url'], 'token'=>$res['token']); - } - - - /** - * Close upload transport - * - * @param string $token - * transport token - * @param string $trtype - * transport type - * @param array $pars - * transport parameters - * @return mixed - */ - function uploadClose($token, $trtype, $pars=array()) - { - $res = $this->bsClosePut($token); - if (PEAR::isError($res)) { - return $res; - } - extract($res); // fname, owner - switch ($trtype) { - case "audioclip": - $mdtoken = $pars['mdpdtoken']; - $res = $this->bsClosePut($mdtoken); - if (PEAR::isError($res)) { - return $res; - } - $mdfname = $res['fname']; - if ($gunid == '') { - $gunid = NULL; - } - $values = array( - "filename" => $pars['name'], - "filepath" => $fname, - "metadata" => $mdfname, - "gunid" => $pars['gunid'], - "filetype" => "audioclip" - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - $res = $storedFile->getId(); - @unlink($fname); - @unlink($mdfname); - break; - case "playlist": - if ($gunid == '') { - $gunid = NULL; - } - $values = array( - "filename" => $pars['name'], - "metadata" => $fname, - "gunid" => $pars['gunid'], - "filetype" => "playlist" - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - $res = $storedFile->getId(); - @unlink($fname); - break; - case "playlistPkg": - $chsum = md5_file($fname); - // importPlaylistOpen: - $res = $this->bsOpenPut($chsum, NULL, $owner); - if (PEAR::isError($res)) { - return $res; - } - $dest = $res['fname']; - $token = $res['token']; - copy($fname, $dest); - $r = $this->importPlaylistClose($token); - if (PEAR::isError($r)) { - return $r; - } - @unlink($fname); - return $r; - break; - case "searchjob": - $crits = file_get_contents($fname); - $criteria = unserialize($crits); - @unlink($fname); - $results = $this->localSearch($criteria); - if (PEAR::isError($results)) { - return $results; - } - $realfile = tempnam($this->accessDir, 'searchjob_'); - @chmod($realfile, 0660); - $len = file_put_contents($realfile, serialize($results)); - $acc = BasicStor::bsAccess($realfile, '', NULL, 'download'); - if (PEAR::isError($acc)) { - return $acc; - } - $url = BasicStor::GetUrlPart()."access/".basename($acc['fname']); - $chsum = md5_file($realfile); - $size = filesize($realfile); - $res = array( - 'url'=>$url, 'token'=>$acc['token'], - 'chsum'=>$chsum, 'size'=>$size, - 'filename'=>$filename - ); - return $res; - break; - case "metadata": - break; - default: - } - return $res; - } - - - /** - * Open download transport - * - * @param string $sessid - * session id - * @param string $trtype - * transport type - * @param array $pars - * transport parameters - * @return hasharray with: - * url string: writable URL - * token string: PUT token - */ - function downloadOpen($sessid, $trtype, $pars=array()) - { - // global $CC_CONFIG; - // switch ($trtype) { - // case "unknown": - // case "audioclip": - // case "metadata": - // case "playlist": - // case "playlistPkg": - // if (!isset($pars['gunid'])) { - // return PEAR::raiseError("Archive::downloadOpen: gunid not set"); - // } - // break; - // } - // $gunid = $pars['gunid']; - // // resolve trtype by object type: - // if ( ($trtype == 'unknown') || ($trtype == 'playlistPkg') ) { - // $media = StoredFile::RecallByGunid($gunid); - // $trtype2 = $media->getType(); - // if (PEAR::isError($trtype2)) { - // return $trtype2; - // } - // // required with content: - // $trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ? - // 'playlistPkg' : $trtype2); - // //return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid"); - // } - // switch ($trtype) { - // case "audioclip": - // $res = $this->downloadRawAudioDataOpen($sessid, $gunid); - // break; - // case "metadata": - // $res = $this->downloadMetadataOpen($sessid, $gunid); - // break; - // case "playlist": - // $res = $this->accessPlaylist($sessid, $gunid); - // break; - // case "playlistPkg": - // $res = $this->bsExportPlaylistOpen($gunid); - // if (PEAR::isError($res)) { - // return $res; - // } - // $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_'); - // $plfpath = "$tmpn.lspl"; - // copy($res['fname'], $plfpath); - // $res = $this->bsExportPlaylistClose($res['token']); - // if (PEAR::isError($res)) { - // return $res; - // } - // $fname = "transported_playlist.lspl"; - // $id = BasicStor::IdFromGunid($gunid); - // $acc = BasicStor::bsAccess($plfpath, 'lspl', NULL, 'download'); - // if (PEAR::isError($acc)) { - // return $acc; - // } - // $url = BasicStor::GetUrlPart()."access/".basename($acc['fname']); - // $chsum = md5_file($plfpath); - // $size = filesize($plfpath); - // $res = array( - // 'url'=>$url, 'token'=>$acc['token'], - // 'chsum'=>$chsum, 'size'=>$size, - // 'filename'=>$fname - // ); - // break; - // case "searchjob": - // $res = $pars; - // break; - // case "file": - // $res = array(); - // break; - // default: - // return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)"); - // } - // if (PEAR::isError($res)) { - // return $res; - // } - // switch ($trtype) { - // case "audioclip": - // case "metadata": - // case "playlist": - // case "playlistPkg": - // $f = StoredFile::RecallByGunid($gunid); - // $title = $f->getTitle(); - // break; - // case "searchjob": - // $title = 'searchjob'; - // break; - // case "file": - // $title = 'regular file'; - // break; - // default: - // } - // $res['title'] = $title; - // $res['trtype'] = $trtype; - // return $res; - } - - - /** - * Close download transport - * - * @param string $token - * transport token - * @param string $trtype - * transport type - * @return array - * hasharray with: - * url string: writable URL - * token string: PUT token - */ - function downloadClose($token, $trtype) - { - switch ($trtype) { - case "audioclip": - $res = $this->downloadRawAudioDataClose($token); - if (PEAR::isError($res)) { - return $res; - } - return $res; - case "metadata": - $res = $this->downloadMetadataClose($token); - return $res; - case "playlist": - $res = $this->releasePlaylist(NULL/*$sessid*/, $token); - return $res; - case "playlistPkg": - $res = BasicStor::bsRelease($token, 'download'); - if (PEAR::isError($res)) { - return $res; - } - $realFname = $r['realFname']; - @unlink($realFname); - if (preg_match("|(plExport_[^\.]+)\.lspl$|", $realFname, $va)) { - list(,$tmpn) = $va; - $tmpn = $CC_CONFIG['transDir']."/$tmpn"; - if (file_exists($tmpn)) { - @unlink($tmpn); - } - } - return $res; - case "searchjob": - $res = BasicStor::bsRelease($token, 'download'); - return $res; - case "file": - return array(); - default: - return PEAR::raiseError("Archive::downloadClose: NotImpl ($trtype)"); - } - } - - - /** - * Prepare hub initiated transport - * - * @param string $target - * hostname of transport target - * @param string $trtype - * transport type - * @param string $direction - * 'up' | 'down' - * @param array $pars - * transport parameters - * @return mixed - */ - function prepareHubInitiatedTransfer( - $target, $trtype='file', $direction='up',$pars=array()) - { - $tr = new Transport($this); - $trec = TransportRecord::create($tr, $trtype, $direction, - array_merge($pars, array('target'=>$target))); - if (PEAR::isError($trec)) { - return $trec; - } - return TRUE; - } - - - /** - * List hub initiated transports - * - * @param string $target - * hostname of transport target - * @param string $direction - * 'up' | 'down' - * @param string $trtok - * transport token - * @return mixed - */ - function listHubInitiatedTransfers( - $target=NULL, $direction=NULL, $trtok=NULL) - { - $tr = new Transport($this); - $res = $tr->getTransports($direction, $target, $trtok); - return $res; - } - - - /** - * Set state of hub initiated transport - * - * @param string $target - * hostname of transport target - * @param string $trtok - * transport token - * @param string $state - * transport state - * @return TransportRecord|PEAR_Error - */ - function setHubInitiatedTransfer($target, $trtok, $state) - { - $tr = new Transport($this); - $trec = TransportRecord::recall($tr, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $r = $trec->setState($state); - if (PEAR::isError($r)) { - return $r; - } - return $trec; - } - - /* ==================================================== auxiliary methods */ - -} // class LocStor -?> \ No newline at end of file diff --git a/backend/M3uPlaylist.php b/backend/M3uPlaylist.php deleted file mode 100644 index 388c24aa5..000000000 --- a/backend/M3uPlaylist.php +++ /dev/null @@ -1,352 +0,0 @@ -lock($gb, $subjid); -// if (PEAR::isError($r)) { -// return $r; -// } -// foreach ($arr as $i => $it) { -// list($md, $uri) = preg_split("|\n|", $it); -// list($length, $title) = preg_split("|, *|", $md); -// // $gunid = StoredFile::CreateGunid(); -// $gunid = ( isset($gunids[basename($uri)]) ? $gunids[basename($uri)] : NULL); -// $acId = BasicStor::IdFromGunid($gunid); -// if (PEAR::isError($acId)) { -// return $acId; -// } -// $length = Playlist::secondsToPlaylistTime($length); -// $offset = '???'; -// if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) { -// switch (strtolower($ext = $va[1])) { -// case "lspl": -// case "xml": -// case "smil": -// case "m3u": -// $acId = $gb->bsImportPlaylistRaw($gunid, -// $aPath, $uri, $ext, $gunids, $subjid); -// if (PEAR::isError($acId)) { -// break; -// } -// //no break! -// default: -// if (is_null($gunid)) { -// return PEAR::raiseError( -// "M3uPlaylist::import: no gunid"); -// } -// $r = $pl->addAudioClip($acId); -// if (PEAR::isError($r)) { -// return $r; -// } -// } -// } -// } -// $r = $pl->unlock($gb); -// if (PEAR::isError($r)) { -// return $r; -// } -// return $pl; - } - - /** - * Import M3U file to storage - * - * @param GreenBox $gb - * @param string $data - * local path to M3U file - * @return string - * XML playlist in Campcaster playlist format - */ - function convert2lspl(&$gb, $data) - { - $arr = M3uPlaylist::parse($data); - if (PEAR::isError($arr)) { - return $arr; - } - $ind = ''; - $ind2 = $ind.INDCH; - $ind3 = $ind2.INDCH; - $res = ''; - foreach ($arr as $i => $it) { - list($md, $uri) = preg_split("|\n|", $it); - list($length, $title) = preg_split("|, *|", $md); - $gunid = StoredFile::CreateGunid(); - $gunid2 = StoredFile::CreateGunid(); - $length = Playlist::secondsToPlaylistTime($length); - $offset = '???'; - $clipStart = '???'; - $clipEnd = '???'; - $clipLength = '???'; - $uri_h = preg_replace("|--|", "d;d;", htmlspecialchars("$uri")); - if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) { - switch (strtolower($ext = $va[1])) { - case "lspl": - case "xml": - case "smil": - case "m3u": - $acOrPl = "$ind3 ". - "\n"; - break; - default: - $acOrPl = "$ind3 ". - "\n"; - break; - } - } - $res .= "$ind2\n". - $acOrPl. - "$ind2\n"; - } - $res = "$ind\n". - "$ind\n". - "$ind2\n". - "$res". - "$ind\n"; - return $res; - } -} // class M3uPlaylist - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class M3uPlaylistBodyElement { - function convert2lspl(&$tree, $ind='') - { - $ind2 = $ind.INDCH; - if ($tree->name != 'body') { - return PEAR::raiseError("M3uPlaylist::parse: body tag expected"); - } - if (isset($tree->children[1])) { - return PEAR::raiseError(sprintf( - "M3uPlaylist::parse: unexpected tag %s in tag body", - $tree->children[1]->name - )); - } - $res = M3uPlaylistParElement::convert2lspl($tree->children[0], $ind2); - if (PEAR::isError($res)) { - return $res; - } - $gunid = StoredFile::CreateGunid(); - $playlength = '???'; // *** - $res = "$ind\n". - "$ind\n". - "$ind2\n". - "$res". - "$ind\n"; - return $res; - } -} - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class M3uPlaylistParElement { - function convert2lspl(&$tree, $ind='') - { - if ($tree->name != 'par') { - return PEAR::raiseError("M3uPlaylist::parse: par tag expected"); - } - $res = ''; - foreach ($tree->children as $i => $ch) { - $ch =& $tree->children[$i]; - $r = M3uPlaylistAudioElement::convert2lspl($ch, $ind.INDCH); - if (PEAR::isError($r)) { - return $r; - } - $res .= $r; - } - return $res; - } -} - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class M3uPlaylistAudioElement { - function convert2lspl(&$tree, $ind='') - { - $ind2 = $ind.INDCH; - if ($tree->name != 'audio') { - return PEAR::raiseError("M3uPlaylist::parse: audio tag expected"); - } - if (isset($tree->children[2])) { - return PEAR::raiseError(sprintf( - "M3uPlaylist::parse: unexpected tag %s in tag audio", - $tree->children[2]->name - )); - } - $res = ''; $fadeIn = 0; $fadeOut = 0; - foreach ($tree->children as $i => $ch) { - $ch =& $tree->children[$i]; - $r = M3uPlaylistAnimateElement::convert2lspl($ch, $ind2); - if (PEAR::isError($r)) { - return $r; - } - switch ($r['type']) { - case "fadeIn": - $fadeIn = $r['val']; - break; - case "fadeOut": - $fadeOut = $r['val']; - break; - } - } - if ($fadeIn > 0 || $fadeOut > 0) { - $fadeIn = Playlist::secondsToPlaylistTime($fadeIn); - $fadeOut = Playlist::secondsToPlaylistTime($fadeOut); - $fInfo = "$ind2\n"; - } else { - $fInfo = ''; - } - $plElGunid = StoredFile::CreateGunid(); - $aGunid = StoredFile::CreateGunid(); - $title = basename($tree->attrs['src']->val); - $offset = Playlist::secondsToPlaylistTime($tree->attrs['begin']->val); - $playlength = '???'; # *** - $res = "$ind\n". - "$ind2\n". - $fInfo. - "$ind\n"; - return $res; - } -} // class M3uPlaylistAudioElement - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class M3uPlaylistAnimateElement { - function convert2lspl(&$tree, $ind='') { - if ($tree->name != 'animate') { - return PEAR::raiseError("M3uPlaylist::parse: animate tag expected"); - } - if ($tree->attrs['attributeName']->val == 'soundLevel' && - $tree->attrs['from']->val == '0%' && - $tree->attrs['to']->val == '100%' && - $tree->attrs['calcMode']->val == 'linear' && - $tree->attrs['fill']->val == 'freeze' && - $tree->attrs['begin']->val == '0s' && - preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $va) - ) { - return array('type'=>'fadeIn', 'val'=>$va[1]); - } - if ($tree->attrs['attributeName']->val == 'soundLevel' && - $tree->attrs['from']->val == '100%' && - $tree->attrs['to']->val == '0%' && - $tree->attrs['calcMode']->val == 'linear' && - $tree->attrs['fill']->val == 'freeze' && - preg_match("|^([0-9.]+)s$|", $tree->attrs['begin']->val, $vaBegin) && - preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $vaEnd) - ) { - return array('type'=>'fadeOut', 'val'=>($vaEnd[1] - $vaBegin[1])); - } - return PEAR::raiseError( - "M3uPlaylistAnimateElement::convert2lspl: animate parameters too general" - ); - } -} - -?> \ No newline at end of file diff --git a/backend/Playlist.php b/backend/Playlist.php deleted file mode 100644 index 3419c1eef..000000000 --- a/backend/Playlist.php +++ /dev/null @@ -1,1497 +0,0 @@ - "DbName", "dc:creator" => "DbCreator", "dc:description" => "DbDescription", "dcterms:extent" => "length"); - - - /** - * @param string $p_gunid - */ - public function __construct($p_gunid=NULL) - { - - } - - /** - * @param array $p_name - * The name of the playlist - */ - private static function Insert($p_name = null) - { - // Create the StoredPlaylist object - $storedPlaylist = new Playlist(); - $storedPlaylist->name = !empty($p_name) ? $p_name : date("H:i:s"); - $storedPlaylist->mtime = new DateTime("now"); - - $pl = new CcPlaylist(); - $pl->setDbName($storedPlaylist->name); - $pl->setDbState("incomplete"); - $pl->setDbMtime($storedPlaylist->mtime); - $pl->save(); - - $storedPlaylist->id = $pl->getDbId(); - $storedPlaylist->setState('ready'); - - return $storedPlaylist->id; - - } - - public static function Delete($id) { - $pl = CcPlaylistQuery::create()->findPK($id); - if($pl === NULL) - return FALSE; - - $pl->delete(); - return TRUE; - } - - - /** - * Delete the file from all playlists. - * @param string $p_fileId - */ - public static function DeleteFileFromAllPlaylists($p_fileId) - { - CcPlaylistcontentsQuery::create()->filterByDbFileId($p_fileId)->delete(); - } - - - /** - * Fetch instance of Playlist object.
- * - * @param string $id - * DB id of file - * @return Playlist|FALSE - * Return FALSE if the object doesnt exist in the DB. - */ - public static function Recall($id) { - - $pl = CcPlaylistQuery::create()->findPK($id); - if($pl === NULL) - return FALSE; - - $storedPlaylist = new Playlist(); - $storedPlaylist->id = $pl->getDbId(); - $storedPlaylist->name = $pl->getDbName(); - $storedPlaylist->state = $pl->getDbState(); - $storedPlaylist->currentlyaccessing = $pl->getDbCurrentlyaccessing(); - $storedPlaylist->editedby = $pl->getDbEditedby(); - $storedPlaylist->mtime = $pl->getDbMtime(); - - return $storedPlaylist; - } - - /** - * Rename stored virtual playlist - * - * @param string $p_newname - * @return TRUE|PEAR_Error - */ - public function setName($p_newname) - { - $pl = CcPlaylistQuery::create()->findPK($this->id); - - if($pl === NULL) - return FALSE; - - $pl->setDbName($p_newname); - $pl->setDbMtime(new DateTime("now")); - $pl->save(); - - $this->name = $p_newname; - return TRUE; - } - - /** - * Get mnemonic playlist name - * - * @param string $p_gunid - * global unique id of playlist - * @return string - */ - public function getName($id=NULL) - { - if (is_null($id)) { - return $this->name; - } - $pl = CcPlaylistQuery::create()->findPK($id); - if($pl === NULL) - return FALSE; - - return $pl->getDbName(); - } - - /** - * Set state of virtual playlist - * - * @param string $p_state - * 'empty'|'incomplete'|'ready'|'edited' - * @param int $p_editedby - * user id | 'NULL' for clear editedBy field - * @return TRUE|PEAR_Error - */ - public function setState($p_state, $p_editedby=NULL) - { - $pl = CcPlaylistQuery::create()->findPK($this->id); - - if($pl === NULL) - return FALSE; - - $pl->setDbState($p_state); - $pl->setDbMtime(new DateTime("now")); - - $eb = (!is_null($p_editedby) ? $p_editedby : NULL); - $pl->setDbEditedby($eb); - - $pl->save(); - - $this->state = $p_state; - $this->editedby = $p_editedby; - return TRUE; - } - - /** - * Get storage-internal file state - * - * @param string $p_gunid - * global unique id of file - * @return string - * see install() - */ - public function getState($id=NULL) - { - if (is_null($id)) { - return $this->state; - } - - $pl = CcPlaylistQuery::create()->findPK($id); - if($pl === NULL) - return FALSE; - - return $pl->getDbState(); - } - - /** - * TODO have to change this. - * */ - - /* - public function isScheduled() { - global $CC_CONFIG, $CC_DBC; - - $sql = "SELECT * " - ." FROM ".$CC_CONFIG['scheduleTable'] - ." WHERE ends > now() and playlist=x'{$this->gunid}'::bigint"; - $scheduled = $CC_DBC->getAll($sql); - - return $scheduled; - } - */ - - /** - * Returns true if virtual file is currently in use.
- * Static or dynamic call is possible. - * - * @param string $p_gunid - * optional (for static call), global unique id - * @return boolean|PEAR_Error - */ - public function isAccessed($id=NULL) - { - if (is_null($id)) { - return ($this->currentlyaccessing > 0); - } - - $pl = CcPlaylistQuery::create()->findPK($id); - if (is_null($pl)) { - return PEAR::raiseError( - "StoredPlaylist::isAccessed: invalid id ($id)", - GBERR_FOBJNEX - ); - } - - return ($pl->getDbCurrentlyaccessing() > 0); - } - - /** - * Returns id of user editing playlist - * - * @param string $p_playlistId - * playlist global unique ID - * @return int id of user editing playlist - */ - public function isEdited() { - - if($this->state === 'edited') { - return $this->editedby; - } - return FALSE; - } - - - /** - * Set playlist edit flag - * - * @param string $p_playlistId - * Playlist unique ID - * @param boolean $p_val - * Set/clear of edit flag - * @param string $p_sessid - * Session id - * @param int $p_subjid - * Subject id (if sessid is not specified) - * @return boolean - * TRUE on success. - */ - - public function setEditFlag($p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL) { - - if (!is_null($p_sessid)) { - $p_subjid = Alib::GetSessUserId($p_sessid); - if (PEAR::isError($p_subjid)) { - return $p_subjid; - } - } - - if ($p_val) { - $r = $this->setState('edited', $p_subjid); - } else { - $r = $this->setState('ready'); - } - if ($r === FALSE) { - return FALSE; - } - return TRUE; - } - - /** - * Return local ID of virtual file. - * - * @return int - */ - public function getId() { - return $this->id; - } - - private function getNextPos() { - - $res = CcPlaylistQuery::create() - ->findPK($this->id) - ->computeLastPosition(); - - if(is_null($res)) { - return 0; - } - - return $res + 1; - } - - /** - * Get the entire playlist as a two dimentional array, sorted in order of play. - * @return array - */ - public function getContents() { - $files = array(); - $rows = CcPlaylistcontentsQuery::create() - ->joinWith('CcFiles') - ->orderByDbPosition() - ->filterByDbPlaylistId($this->id) - ->find(); - - foreach ($rows as $row) { - $files[] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true); - } - - return $files; - } - - public function getLength() { - $res = CcPlaylistQuery::create() - ->findPK($this->id) - ->computeLength(); - - if(is_null($res)) { - return '00:00:00.000000'; - } - - return $res; - } - - /** - * Create instance of Playlist object and insert empty file - * - * @param string $fname - * name of new file - * @return instance of Playlist object - */ - public function create($fname=NULL) - { - $pl_id = Playlist::Insert($fname); - $this->id = $pl_id; - return $this->id; - } - - - public static function findPlaylistByName($p_name) - { - $res = CcPlaylistQuery::create()->findByDbName($p_name); - return $res; - } - - - /** - * Lock playlist for edit - * - * @param string $sessid - * session id - * @param int $subjid - * local subject (user) id - * @param boolean $val - * if false do unlock - * @return boolean - * previous state or error object - */ - public function lock($sessid, $subjid=NULL, $val=TRUE) - { - if ($val && $this->isEdited() !== FALSE) { - return PEAR::raiseError( - 'Playlist::lock: playlist already locked' - ); - } - $r = $this->setEditFlag($val, $sessid, $subjid); - return $r; - } - - - /** - * Unlock playlist - * - * @param sessId - * reference to GreenBox object - * @return boolean - * previous state or error object - */ - public function unlock($sessid) - { - $r = $this->lock($sessid, NULL, FALSE); - return $r; - } - - - /** - * Add audio clip to the playlist - * - * @param string $p_id - * local ID of added file - * @param string $p_position - * optional, Which position in the playlist to insert the audio clip - * @param string $p_fadeIn - * optional, in time format hh:mm:ss.ssssss - total duration - * @param string $p_fadeOut - * optional, in time format hh:mm:ss.ssssss - total duration - * @param string $p_clipLength - * optional length in in time format hh:mm:ss.ssssss - - * for webstream (or for overrule length of audioclip) - * @return true|PEAR_Error - * TRUE on success - */ - public function addAudioClip($p_mediaId, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL) - { - $_SESSION['debug'] = "in add"; - - //get audio clip. - $media = StoredFile::Recall($p_mediaId); - if (is_null($media) || PEAR::isError($media)) { - return $media; - } - // get information about audioClip - // $acInfo = $this->getAudioClipInfo($ac); - // if (PEAR::isError($acInfo)) { - // return $acInfo; - // } - // extract($acInfo); // 'acGunid', 'acLen', 'acTit', 'elType' - $metadata = $media->getMetadata(); - $length = $metadata["length"]; - - if (!is_null($p_clipLength)) { - $length = $p_clipLength; - } - - // insert at end of playlist. - if (is_null($p_position)) - $p_position = $this->getNextPos(); - if (PEAR::isError($p_position)) { - return $p_position; - } - - // insert default values if parameter was empty - $p_cuein = !is_null($p_cuein) ? $p_cuein : '00:00:00.000000'; - $p_cueout = !is_null($p_cueout) ? $p_cueout : $length; - - $mediaLengthSec = $clipLengthSec = self::playlistTimeToSeconds($length); - if (!is_null($p_cuein)) { - $clipLengthSec = $mediaLengthSec - self::playlistTimeToSeconds($p_cuein); - } - if (!is_null($p_cueout)) { - $clipLengthSec = $clipLengthSec - ($mediaLengthSec - self::playlistTimeToSeconds($p_cueout)); - } - $p_clipLength = self::secondsToPlaylistTime($clipLengthSec); - - $res = $this->insertPlaylistElement($this->id, $p_mediaId, $p_position, $p_clipLength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Remove audioClip from playlist - * - * @param int $position - * position of audioclip in the playlist. - * @return boolean - */ - public function delAudioClip($pos) - { - if($pos < 0 || $pos >= $this->getNextPos()) - return FALSE; - - $row = CcPlaylistcontentsQuery::create() - ->filterByDbPlaylistId($this->id) - ->filterByDbPosition($pos) - ->findOne(); - - if(is_null($row)) - return FALSE; - - $row->delete(); - return $row; - } - - /** - * Move audioClip to the new position in the playlist - * - * @param int $oldPos - * old positioin in playlist - * @param int $newPos - * new position in playlist - * @return mixed - */ - public function moveAudioClip($oldPos, $newPos) - { - if($newPos < 0 || $newPos >= $this->getNextPos() || $oldPos < 0 || $oldPos >= $this->getNextPos()) - return FALSE; - - $row = $this->delAudioClip($oldPos); - if($row === FALSE) - return FALSE; - - $res = $this->addAudioClip($row->getDbFileId(), $newPos, $row->getDbFadein(), $row->getDbFadeout(), $row->getDbCliplength(), $row->getDbCuein(), $row->getDbCueout()); - if($res !== TRUE) - return FALSE; - - return TRUE; - } - - - /** - * Change fadeIn and fadeOut values for playlist Element - * - * @param int $pos - * position of audioclip in playlist - * @param string $fadeIn - * new value in ss.ssssss or extent format - * @param string $fadeOut - * new value in ss.ssssss or extent format - * @return boolean - */ - public function changeFadeInfo($pos, $fadeIn, $fadeOut) - { - $errArray= array(); - - if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) { - $errArray["error"]="Invalid position."; - return $errArray; - } - - $row = CcPlaylistcontentsQuery::create() - ->filterByDbPlaylistId($this->id) - ->filterByDbPosition($pos) - ->findOne(); - - $clipLength = $row->getDbCliplength(); - - if(!is_null($fadeIn) && !is_null($fadeOut)) { - - if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($clipLength)) { - $errArray["error"]="Fade In can't be larger than overall playlength."; - return $errArray; - } - if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($clipLength)) { - $errArray["error"]="Fade Out can't be larger than overall playlength."; - return $errArray; - } - - $row->setDbFadein($fadeIn); - $row->setDbFadeout($fadeOut); - } - else if(!is_null($fadeIn)) { - - if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($clipLength)) { - $errArray["error"]="Fade In can't be larger than overall playlength."; - return $errArray; - } - - $row->setDbFadein($fadeIn); - } - else if(!is_null($fadeOut)){ - - if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($clipLength)) { - $errArray["error"]="Fade Out can't be larger than overall playlength."; - return $errArray; - } - - $row->setDbFadeout($fadeOut); - } - - $row->save(); - - return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut); - } - - /** - * Change cueIn/cueOut values for playlist element - * - * @param int $pos - * position of audioclip in playlist - * @param string $cueIn - * new value in ss.ssssss or extent format - * @param string $cueOut - * new value in ss.ssssss or extent format - * @return boolean or pear error object - */ - public function changeClipLength($pos, $cueIn, $cueOut) - { - $errArray= array(); - - if(is_null($cueIn) && is_null($cueOut)) { - $errArray["error"]="Cue in and cue out are null."; - return $errArray; - } - - if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) { - $errArray["error"]="Invalid position."; - return $errArray; - } - - $row = CcPlaylistcontentsQuery::create() - ->joinWith(CcFiles) - ->filterByDbPlaylistId($this->id) - ->filterByDbPosition($pos) - ->findOne(); - - $oldCueIn = $row->getDBCuein(); - $oldCueOut = $row->getDbCueout(); - $fadeIn = $row->getDbFadein(); - $fadeOut = $row->getDbFadeout(); - - $file = $row->getCcFiles(); - $origLength = $file->getDbLength(); - - - if(!is_null($cueIn) && !is_null($cueOut)){ - - if($cueOut === ""){ - $cueOut = $origLength; - } - if(Playlist::playlistTimeToSeconds($cueIn) > Playlist::playlistTimeToSeconds($cueOut)) { - $errArray["error"]= "Can't set cue in to be larger than cue out."; - return $errArray; - } - if(Playlist::playlistTimeToSeconds($cueOut) > Playlist::playlistTimeToSeconds($origLength)){ - $errArray["error"] = "Can't set cue out to be greater than file length."; - return $errArray; - } - - $row->setDbCuein($cueIn); - $row->setDbCueout($cueOut); - $row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($cueOut) - - Playlist::playlistTimeToSeconds($cueIn))); - - } - else if(!is_null($cueIn)) { - - if(Playlist::playlistTimeToSeconds($cueIn) > Playlist::playlistTimeToSeconds($oldCueOut)) { - $errArray["error"] = "Can't set cue in to be larger than cue out."; - return $errArray; - } - - $row->setDbCuein($cueIn); - $row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($oldCueOut) - - Playlist::playlistTimeToSeconds($cueIn))); - } - else if(!is_null($cueOut)) { - - if($cueOut === ""){ - $cueOut = $origLength; - } - - if(Playlist::playlistTimeToSeconds($cueOut) < Playlist::playlistTimeToSeconds($oldCueIn)) { - $errArray["error"] ="Can't set cue out to be smaller than cue in."; - return $errArray; - } - - if(Playlist::playlistTimeToSeconds($cueOut) > Playlist::playlistTimeToSeconds($origLength)){ - $errArray["error"] ="Can't set cue out to be greater than file length."; - return $errArray; - } - - $row->setDbCueout($cueOut); - $row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($cueOut) - - Playlist::playlistTimeToSeconds($oldCueIn))); - } - - $cliplength = $row->getDbCliplength(); - - if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($cliplength)){ - $fadeIn = $cliplength; - - $row->setDbFadein($fadeIn); - } - if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($cliplength)){ - $fadeOut = $cliplength; - - $row->setDbFadein($fadeOut); - } - - $row->save(); - - return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut, "length"=>$this->getLength(), - "fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut); - } - - /** - * Find info about clip at specified offset in playlist. - * - * @param string $offset - * current playtime (hh:mm:ss.ssssss) - * @param int $distance - * 0=current clip; 1=next clip ... - * @return array of matching clip info: - *
    - *
  • gunid string, global unique id of clip
  • - *
  • elapsed string, already played time of clip
  • - *
  • remaining string, remaining time of clip
  • - *
  • duration string, total playlength of clip
  • - *
- */ - public function getPlaylistClipAtPosition($pos) - { - - } - - public function getPLMetaData($category) - { - $cat = $this->categories[$category]; - - if($cat === 'length') { - return $this->getLength(); - } - - $row = CcPlaylistQuery::create()->findPK($this->id); - $method = 'get' . $cat; - return $row->$method(); - } - - public function setPLMetaData($category, $value) - { - $cat = $this->categories[$category]; - - $row = CcPlaylistQuery::create()->findPK($this->id); - $method = 'set' . $cat; - $row->$method($value); - $row->save(); - - return TRUE; - } - - /** - * Return array with gunids of all sub-playlists and clips used in - * the playlist - * - * @return array with hash elements: - * gunid - global id - * type - playlist | audioClip - */ - public function export() - { - - } - - - /** - * Convert playlist time value to float seconds - * - * @param string $plt - * playlist time value (HH:mm:ss.dddddd) - * @return int - * seconds - */ - public static function playlistTimeToSeconds($plt) - { - $arr = preg_split('/:/', $plt); - if (isset($arr[2])) { - return (intval($arr[0])*60 + intval($arr[1]))*60 + floatval($arr[2]); - } - if (isset($arr[1])) { - return intval($arr[0])*60 + floatval($arr[1]); - } - return floatval($arr[0]); - } - - - /** - * Convert float seconds value to playlist time format - * - * @param float $seconds - * @return string - * time in playlist time format (HH:mm:ss.dddddd) - */ - public static function secondsToPlaylistTime($p_seconds) - { - $seconds = $p_seconds; - $milliseconds = intval(($seconds - intval($seconds)) * 1000); - $milliStr = str_pad($milliseconds, 6, '0'); - $hours = floor($seconds / 3600); - $seconds -= $hours * 3600; - $minutes = floor($seconds / 60); - $seconds -= $minutes * 60; - $res = sprintf("%02d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr); - return $res; - } - - /** - * Export playlist as simplified SMIL XML file. - * - * @param boolean $toString - * if false don't real export, - * return misc info about playlist only - * @return string - * XML string or hasharray with misc info - */ - public function outputToSmil($toString=TRUE) - { - - } - - - /** - * Export playlist as M3U file. - * - * @param boolean $toString - * if false don't real export, - * return misc info about playlist only - * @return string|array - * M3U string or hasharray with misc info - */ - public function outputToM3u($toString=TRUE) - { - - } - - - /** - * Export playlist as RSS XML file - * - * @param boolean $toString - * if false don't really export, - * return misc info about playlist only - * @return mixed - * XML string or hasharray with misc info - */ - public function outputToRss($toString=TRUE) - { - - } - - - /** - * Get audioClip length and title - * - * @param StoredFile $p_media - * - * @return array with fields: - *
    - *
  • acGunid, string - audioClip gunid
  • - *
  • acLen string - length of clip in dcterms:extent format
  • - *
  • acTit string - clip title
  • - *
  • elType string - audioClip | playlist
  • - *
- */ - // private function getAudioClipInfo($p_media) - // { - // $ac_id = $p_media->getId(); - // - // $r = $p_media->getMetadataValue('dcterms:extent'); - // if (isset($r)) { - // $acLen = $r; - // } else { - // $acLen = '00:00:00.000000'; - // } - // - // $r = $p_media->getMetadataValue('dc:title'); - // if (isset($r)) { - // $acTit = $r; - // } else { - // $acTit = $acGunid; - // } - // $elType = $p_media->getType(); - // $trTbl = array('audioclip'=>'audioClip', 'webstream'=>'audioClip','playlist'=>'playlist'); - // $elType = $trTbl[$elType]; - // - // return compact('acGunid', 'acLen', 'acTit', 'elType'); - // } - - - /** - * Insert a new playlist element. - * - * @param int $plId - * id of Playlist - * @param int $fileId - * id of File - * @param string $offset - * relative offset in extent format - * @param string $clipstart - * audioClip clipstart in extent format - * @param string $clipEnd - * audioClip clipEnd in extent format - * @param string $clipLength - * audioClip playlength in extent format (?) - * @param string $acGunid - * audioClip gunid - * @param string $acLen - * audioClip length in extent format - * @param string $acTit - * audioClip title - * @param string $fadeIn - * fadeIn value in ss.ssssss or extent format - * @param string $fadeOut - * fadeOut value in ss.ssssss or extent format - - * @return array with fields: - *
    - *
  • plElId int - record id of playlistElement
  • - *
  • plElGunid string - gl.unique id of playlistElement
  • - *
  • fadeInId int - record id
  • - *
  • fadeOutId int - record id
  • - *
- */ - private function insertPlaylistElement($plId, $fileId, $pos, $clipLength, $cuein, $cueout, $fadeIn=NULL, $fadeOut=NULL) - { - if(is_null($fadeIn)) - $fadeIn = '00:00:00.000'; - if(is_null($fadeOut)) - $fadeOut = '00:00:00.000'; - - $row = new CcPlaylistcontents(); - $row->setDbPlaylistId($plId); - $row->setDbFileId($fileId); - $row->setDbPosition($pos); - $row->save(); - - $row->setDbCliplength($clipLength); - $row->setDbCuein($cuein); - $row->setDbCueout($cueout); - $row->setDbFadein($fadeIn); - $row->setDbFadeout($fadeOut); - - - return TRUE; - } - - /** - * Set playlist length - dcterm:extent - * - * @param string $newPlLen - * new length in extent format - * @param int $parid - * playlist container record id - * @param int $metaParid - * metadata container record id - * @return boolean - */ - private function setPlaylistLength($newPlLen, $parid, $metaParid) - { - $mid = $this->_getMidOrInsert('playlength', $parid, $newPlLen, 'A'); - if (PEAR::isError($mid)) { - return $mid; - } - $r = $this->_setValueOrInsert( - $mid, $newPlLen, $parid, 'playlength', 'A'); - if (PEAR::isError($r)) { - return $r; - } - $mid = $this->_getMidOrInsert('dcterms:extent', $metaParid, $newPlLen); - if (PEAR::isError($mid)) { - return $mid; - } - $r = $this->_setValueOrInsert( - $mid, $newPlLen, $metaParid, 'dcterms:extent'); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - -} // class Playlist - - -/** - * Auxiliary class for GB playlist editing methods - * - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class PlaylistElement { - private $pl = NULL; - private $plEl = NULL; - - public function PlaylistElement($pl, $plEl) - { - $this->pl = $pl; - $this->plEl = $plEl; - } - - - public function analyze() - { - $plInfo = array( - 'acLen' => '00:00:00.000000', - 'acLenS' => 0, - 'fadeIn' => '00:00:00.000000', - 'fadeInS' => 0, - 'fadeOut' => '00:00:00.000000', - 'fadeOutS' => 0, - 'clipStart' => '00:00:00.000000', - 'clipStartS' => 0, - 'clipEnd' => '00:00:00.000000', - 'clipEndS' => 0 - ); - $plInfo['elOffset'] = $this->plEl['attrs']['relativeOffset']; - $plInfo['elOffsetS'] = Playlist::playlistTimeToSeconds($plInfo['elOffset']); - // cycle over tags inside playlistElement - foreach ($this->plEl['children'] as $j => $acFi) { - switch ($acFi['elementname']) { - case "playlist": - $plInfo['type'] = 'playlist'; - break; - case "audioClip": - $plInfo['type'] = 'audioClip'; - break; - } - switch ($acFi['elementname']) { - case "playlist": - case "audioClip": - $plInfo['acLen'] = $acFi['attrs']['playlength']; - $plInfo['acLenS'] = Playlist::playlistTimeToSeconds($plInfo['acLen']); - $plInfo['acGunid'] = $acFi['attrs']['id']; - break; - case "fadeInfo": - $plInfo['fadeIn'] = $acFi['attrs']['fadeIn']; - $plInfo['fadeInS'] = Playlist::playlistTimeToSeconds($plInfo['fadeIn']); - $plInfo['fadeOut'] = $acFi['attrs']['fadeOut']; - $plInfo['fadeOutS'] = Playlist::playlistTimeToSeconds($plInfo['fadeOut']); - break; - } - $plInfo['clipStart'] = $this->plEl['attrs']['clipStart']; - $plInfo['clipStartS'] = Playlist::playlistTimeToSeconds($this->plEl['attrs']['clipStart']); - $plInfo['clipEnd'] = $this->plEl['attrs']['clipEnd']; - $plInfo['clipEndS'] = Playlist::playlistTimeToSeconds($this->plEl['attrs']['clipEnd']); - } - return $plInfo; - } -} // class PlaylistElement - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @todo Rename this class PlaylistTag - */ -class PlaylistTagExport -{ - public static function OutputToSmil(&$pl, $plt, $ind='') - { - $ind2 = $ind.INDCH; - $ind3 = $ind2.INDCH; - $ind4 = $ind3.INDCH; - $res = ""; - foreach ($plt['children'] as $ple) { - switch ($ple['elementname']) { - case "playlistElement": - $r = PlaylistElementExport::OutputToSmil($pl, $ple, $ind4); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $res .= $r; - } - break; - case "metadata": - $r = PlaylistMetadataExport::OutputToSmil($pl, $ple, $ind4); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $res .= $r; - } - break; - default: - } - } - $res = "$ind\n". - "$ind\n". - "$ind2\n". - "$ind3\n". - "$res". - "$ind3\n". - "$ind2\n". - "$ind\n"; - return $res; - } - - - public static function OutputToM3u(&$pl, $plt, $ind='') - { - $res = ""; - foreach ($plt['children'] as $ple) { - switch ($ple['elementname']) { - case"playlistElement": - $r = PlaylistElementExport::OutputToM3u($pl, $ple); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $res .= $r; - } - break; - } - } - $res = "#EXTM3U\n$res"; - return $res; - } - - - public static function OutputToRss(&$pl, $plt, $ind='') - { - $ind2 = $ind.INDCH; - $ind3 = $ind2.INDCH; - $res = ""; - foreach ($plt['children'] as $ple) { - switch ($ple['elementname']) { - case "playlistElement": - $r = PlaylistElementExport::OutputToRss($pl, $ple, $ind3); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $res .= $r; - } - break; - case "metadata": - $r = PlaylistMetadataExport::OutputToRss($pl, $ple, $ind3); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $res .= $r; - } - break; - default: - } - } - $res = "$ind\n". - "$ind\n". - "$ind2\n". - "$res". - "$ind2\n". - "$ind\n"; - return $res; - } -} - - -/** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @todo Rename this class "PlaylistElement" - */ -class PlaylistElementExport { - - public static function OutputToSmil(&$pl, $ple, $ind='') - { - $acOrPl = NULL; - $finfo = array('fi'=>0, 'fo'=>0); - $ind2 = $ind.INDCH; - $ind3 = $ind2.INDCH; - $anim = ''; - foreach ($ple['children'] as $ac) { - switch ($ac['elementname']) { - case "audioClip": - $r = PlaylistAudioClipExport::OutputToSmil($pl, $ac, $ind2); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - case "playlist": - $gunid = $ac['attrs']['id']; - $pl2 = StoredFile::RecallByGunid($gunid); - if (is_null($pl2) || PEAR::isError($pl2)) { - return $pl2; - } - $r = $pl2->outputToSmil(FALSE); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - case "fadeInfo": - $r = PlaylistFadeInfoExport::OutputToSmil($pl, $ac, $ind2); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $finfo = $r; - } - break; - default: - return PEAR::raiseError( - "PlaylistElementExport::OutputToSmil:". - " unknown tag {$ac['elementname']}" - ); - } - } - $beginS = Playlist::playlistTimeToSeconds($ple['attrs']['relativeOffset']); - $playlengthS = Playlist::playlistTimeToSeconds($acOrPl['playlength']); - $fadeOutS = Playlist::playlistTimeToSeconds($finfo['fo']); - $fiBeginS = 0; - $fiEndS = Playlist::playlistTimeToSeconds($finfo['fi']); - $foBeginS = ($playlengthS - $fadeOutS); - $foEndS = Playlist::playlistTimeToSeconds($acOrPl['playlength']); - foreach (array('fi','fo') as $ff) { - if (${$ff."EndS"} - ${$ff."BeginS"} > 0) { - $anim .= "{$ind2}\n" - ; - } - } - $src = $acOrPl['src']; - $str = "$ind" : " />"). - " ". - "\n"; - return $str; - } - - - public static function OutputToM3u(&$pl, $ple, $ind='') - { - $acOrPl = NULL; - foreach ($ple['children'] as $ac) { - switch ($ac['elementname']) { - case "audioClip": - $r = PlaylistAudioClipExport::OutputToM3u($pl, $ac); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - case "playlist": - $gunid = $ac['attrs']['id']; - $pl2 = StoredFile::RecallByGunid($gunid); - if (is_null($pl2) || PEAR::isError($pl2)) { - return $pl2; - } - $r = $pl2->outputToM3u(FALSE); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - } - } - if (is_null($acOrPl)) { - return ''; - } - $playlength = ceil(Playlist::playlistTimeToSeconds($acOrPl['playlength'])); - $title = $acOrPl['title']; - $uri = (isset($acOrPl['uri']) ? $acOrPl['uri'] : '???' ); - $res = "#EXTINF: $playlength, $title\n"; - $res .= "$uri\n"; - return $res; - } - - - public static function OutputToRss(&$pl, $ple, $ind='') - { - $acOrPl = NULL; - $ind2 = $ind.INDCH; - $anim = ''; - foreach ($ple['children'] as $ac) { - switch ($ac['elementname']) { - case "audioClip": - $r = PlaylistAudioClipExport::OutputToRss($pl, $ac, $ind2); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - case "playlist": - $gunid = $ac['attrs']['id']; - $pl2 = StoredFile::RecallByGunid($gunid); - if (is_null($pl2) || PEAR::isError($pl2)) { - return $pl2; - } - $r = $pl2->outputToRss(FALSE); - if (PEAR::isError($r)) { - return $r; - } - if (!is_null($r)) { - $acOrPl = $r; - } - break; - case "fadeInfo": - break; - default: - return PEAR::raiseError( - "PlaylistElementExport::OutputToRss:". - " unknown tag {$ac['elementname']}" - ); - } - } - $title = (isset($acOrPl['title']) ? htmlspecialchars($acOrPl['title']) : '' ); - $desc = (isset($acOrPl['desc']) ? htmlspecialchars($acOrPl['desc']) : '' ); - $link = htmlspecialchars($acOrPl['src']); - $desc = ''; - $str = "$ind\n". - "$ind2$title\n". - "$ind2$desc\n". - "$ind2$link\n". - "$ind\n"; - return $str; - } - } - - - /** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @todo Rename this class to PlaylistAudioClip (notice the caps) - */ - class PlaylistAudioClipExport - { - - public static function OutputToSmil(&$pl, $plac, $ind='') - { - $gunid = $plac['attrs']['id']; - $ac = StoredFile::RecallByGunid($gunid); - if (is_null($ac) || PEAR::isError($ac)) { - return $ac; - } - $RADext = $ac->getFileExtension(); - if (PEAR::isError($RADext)) { - return $RADext; - } - return array( - 'type' => 'audioclip', - 'gunid' => $gunid, - 'src' => AC_URL_RELPATH."$gunid.$RADext", - 'playlength' => $plac['attrs']['playlength'], - ); - } - - - public static function OutputToM3u(&$pl, $plac, $ind='') - { - $gunid = $plac['attrs']['id']; - $ac = StoredFile::RecallByGunid($gunid); - if (is_null($ac) || PEAR::isError($ac)) { - return $ac; - } - $RADext = $ac->getFileExtension(); - if (PEAR::isError($RADext)) { - return $RADext; - } - return array( - 'playlength' => $plac['attrs']['playlength'], - 'title' => $plac['attrs']['title'], - 'uri' => AC_URL_RELPATH."$gunid.$RADext", - ); - } - - - public static function OutputToRss(&$pl, $plac, $ind='') - { - $id = $plac['attrs']['id']; - $playlist = Playlist::Recall($id); - if (is_null($playlist) || PEAR::isError($playlist)) { - return $playlist; - } - $RADext = $playlist->getFileExtension(); - if (PEAR::isError($RADext)) { - return $RADext; - } - $title = $playlist->getName(); - $desc = $playlist->getPLMetaData("dc:description"); - return array( - 'type' => 'audioclip', - 'gunid' => $id, - 'src' => "http://XXX/YY/$id.$RADext", - 'playlength' => $plac['attrs']['playlength'], - 'title' => $title, - 'desc' => $desc, - ); - } - } - - - /** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @todo Rename this class "PlaylistFadeInfo" (notive the caps) - */ - class PlaylistFadeInfoExport - { - - public static function OutputToSmil(&$pl, $plfi, $ind='') - { - $r = array( - 'fi'=>$plfi['attrs']['fadeIn'], - 'fo'=>$plfi['attrs']['fadeOut'], - ); - return $r; - } - - - public static function OutputToM3u(&$pl, $plfa, $ind='') - { - return ''; - } - - - public static function OutputToRss(&$pl, $plfa, $ind='') - { - return ''; - } - - } - - - /** - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @todo Rename this class to PlaylistMetadata (notice the caps) - */ - class PlaylistMetadataExport - { - public static function OutputToSmil(&$pl, $md, $ind='') - { - return NULL; - } - - - public static function OutputToM3u(&$pl, $md, $ind='') - { - return NULL; - } - - - public static function OutputToRss(&$pl, $md, $ind='') - { - return NULL; - } - } - - ?> diff --git a/backend/Prefs.php b/backend/Prefs.php deleted file mode 100644 index c51a75402..000000000 --- a/backend/Prefs.php +++ /dev/null @@ -1,442 +0,0 @@ -gb =& $gb; - } - - - /* ======================================================= public methods */ - /* ----------------------------------------------------- user preferences */ - /** - * Read preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @return string - * preference value - */ - function loadPref($sessid, $key) - { - $subjid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($subjid)) { - return $subjid; - } - if (is_null($subjid)) { - return PEAR::raiseError("Prefs::loadPref: invalid session id", - GBERR_SESS); - } - $val = $this->readVal($subjid, $key); - if (PEAR::isError($val)) { - return $val; - } - if ($val === FALSE) { - return PEAR::raiseError("Prefs::loadPref: invalid preference key", - GBERR_PREF); - } - return $val; - } - - - /** - * Save preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @param string $value - * preference value - * @return boolean - */ - function savePref($sessid, $key, $value) - { - $subjid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($subjid)) { - return $subjid; - } - if (is_null($subjid)) { - return PEAR::raiseError("Prefs::savePref: invalid session id", GBERR_SESS); - } - $r = $this->update($subjid, $key, $value); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - $r = $this->insert($subjid, $key, $value); - if (PEAR::isError($r)) { - return $r; - } - } - return TRUE; - } - - - /** - * Delete preference record by session id - * - * @param string $sessid - * session id - * @param string $key - * preference key - * @return boolean - */ - function delPref($sessid, $key) - { - $subjid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($subjid)) { - return $subjid; - } - if (is_null($subjid)) { - return PEAR::raiseError("Prefs::delPref: invalid session id", GBERR_SESS); - } - $r = $this->delete($subjid, $key); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - return PEAR::raiseError("Prefs::delPref: invalid preference key", GBERR_PREF); - } - return TRUE; - } - - - /* ---------------------------------------------------- group preferences */ - /** - * Read group preference record - * - * @param string $group - * group name - * @param string $key - * preference key - * @param boolean $returnErrorIfKeyNotExists - * If set to true and the key doesnt exist, return a PEAR error. - * @return string - * preference value - */ - function loadGroupPref($group, $key, $returnErrorIfKeyNotExists = true) - { - // if sessid is would be used here fix Transport::cronCallMethod ! - $subjid = Subjects::GetSubjId($group); - if (PEAR::isError($subjid)) { - return $subjid; - } - if (is_null($subjid)) { - return PEAR::raiseError( - "Prefs::loadGroupPref: invalid group name", ALIBERR_NOTGR); - } - $val = $this->readVal($subjid, $key); - if (PEAR::isError($val)) { - return $val; - } - if ($val === FALSE) { - if ($returnErrorIfKeyNotExists) { - return PEAR::raiseError( - "Prefs::loadGroupPref: invalid preference key", GBERR_PREF); - } else { - return ''; - } - } - return $val; - } - - - /** - * Save group preference record - * - * @param string $sessid - * session id - * @param string $group - * group name - * @param string $key - * preference key - * @param string $value - * preference value - * @return boolean - */ - function saveGroupPref($sessid, $group, $key, $value) - { - $uid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($uid)) { - return $uid; - } - if (is_null($uid)) { - return PEAR::raiseError( - "Prefs::saveGroupPref: invalid session id", GBERR_SESS); - } - $gid = Subjects::GetSubjId($group); - if (PEAR::isError($gid)) { - return $gid; - } - if (is_null($gid)) { - return PEAR::raiseError( - "Prefs::saveGroupPref: invalid group name", GBERR_SESS); - } - $memb = Subjects::IsMemberOf($uid, $gid); - if (PEAR::isError($memb)) { - return $memb; - } - if (!$memb) { - return PEAR::raiseError( - "Prefs::saveGroupPref: access denied", GBERR_DENY); - } - $r = $this->update($gid, $key, $value); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - $r = $this->insert($gid, $key, $value); - if (PEAR::isError($r)) { - return $r; - } - } - return TRUE; - } - - /** - * Delete group preference record - * - * @param string $sessid - * session id - * @param string $group - * group name - * @param string $key - * preference key - * @return boolean - */ - function delGroupPref($sessid, $group, $key) - { - $uid = GreenBox::GetSessUserId($sessid); - if (PEAR::isError($uid)) { - return $uid; - } - if (is_null($uid)) { - return PEAR::raiseError( - "Prefs::delGroupPref: invalid session id", GBERR_SESS); - } - $gid = Subjects::GetSubjId($group); - if (PEAR::isError($gid)) { - return $gid; - } - if (is_null($gid)) { - return PEAR::raiseError( - "Prefs::delGroupPref: invalid group name", GBERR_SESS); - } - $memb = Subjects::IsMemberOf($uid, $gid); - if (PEAR::isError($memb)) { - return $memb; - } - if (!$memb) { - return PEAR::raiseError( - "Prefs::delGroupPref: access denied", GBERR_DENY); - } - $r = $this->delete($gid, $key); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - return PEAR::raiseError( - "Prefs::delGroupPref: invalid preference key", GBERR_PREF); - } - return TRUE; - } - - - /* ==================================================== low level methods */ - /** - * Insert of new preference record - * - * @param int $subjid - * local user/group id - * @param string $keystr - * preference key - * @param string $valstr - * preference value - * @return int - * local user id - */ - public static function Insert($subjid, $keystr, $valstr='') - { - global $CC_CONFIG, $CC_DBC; - $id = $CC_DBC->nextId($CC_CONFIG['prefSequence']); - if (PEAR::isError($id)) { - return $id; - } - $r = $CC_DBC->query(" - INSERT INTO ".$CC_CONFIG['prefTable']." - (id, subjid, keystr, valstr) - VALUES - ($id, $subjid, '$keystr', '$valstr') - "); - if (PEAR::isError($r)) { - return $r; - } - return $id; - } - - - /** - * Read value of preference record - * - * @param int $subjid - * local user/group id - * @param string $keystr - * preference key - * @return string - * preference value - */ - function readVal($subjid, $keystr) - { - global $CC_CONFIG, $CC_DBC; - $val = $CC_DBC->getOne(" - SELECT valstr FROM ".$CC_CONFIG['prefTable']." - WHERE subjid=$subjid AND keystr='$keystr' - "); - if (PEAR::isError($val)) { - return $val; - } - if (is_null($val)) { - return FALSE; - } - return $val; - } - - - /** - * Read all keys of subject's preferences - * - * @param int $subjid - * local user/group id - * @return array - * preference keys - */ - function readKeys($subjid) - { - global $CC_CONFIG, $CC_DBC; - $res = $CC_DBC->getAll(" - SELECT keystr FROM ".$CC_CONFIG['prefTable']." - WHERE subjid=$subjid - "); - if (PEAR::isError($res)) { - return $res; - } - if (is_null($res)) { - return FALSE; - } - return $res; - } - - - /** - * Update value of preference record - * - * @param int $subjid - * local user/group id - * @param string $keystr - * preference key - * @param string $newvalstr - * new preference value - * @return boolean - */ - function update($subjid, $keystr, $newvalstr='') - { - global $CC_CONFIG, $CC_DBC; - $r = $CC_DBC->query(" - UPDATE ".$CC_CONFIG['prefTable']." SET - valstr='$newvalstr' - WHERE subjid=$subjid AND keystr='$keystr' - "); - if (PEAR::isError($r)) { - return $r; - } - if ($CC_DBC->affectedRows() < 1) { - return FALSE; - } - return TRUE; - } - - - /** - * Delete preference record - * - * @param int $subjid - * local user/group id - * @param string $keystr - * preference key - * @return boolean - */ - function delete($subjid, $keystr) - { - global $CC_CONFIG, $CC_DBC; - $r = $CC_DBC->query(" - DELETE FROM ".$CC_CONFIG['prefTable']." - WHERE subjid=$subjid AND keystr='$keystr' - "); - if (PEAR::isError($r)) { - return $r; - } - if ($CC_DBC->affectedRows() < 1) { - return FALSE; - } - return TRUE; - } - - - /* ==================================================== auxiliary methods */ - /** - * Test method - * - */ - function test() - { - global $CC_CONFIG; - $sessid = Alib::Login('root', $CC_CONFIG['tmpRootPass']); - $testkey = 'testKey'; - $testVal = 'abcDef 0123 ěščřžýáíé ĚŠČŘŽÝÁÍÉ'; - $r = savePref($sessid, $testKey, $testVal); - if (PEAR::isError($r)) { - return $r; - } - $val = loadPref($sessid, $testKey); - if ($val != $testVal) { - echo "ERROR: preference storage test failed.\n ($testVal / $val)\n"; - return FALSE; - } - $r = savePref($sessid, $testKey, ''); - if (PEAR::isError($r)) { - return $r; - } - $val = loadPref($sessid, $testKey); - if ($val != $testVal) { - echo "ERROR: preference storage test failed.\n ('' / '$val')\n"; - return FALSE; - } - return TRUE; - } - -} // class Prefs -?> \ No newline at end of file diff --git a/backend/Renderer.php b/backend/Renderer.php deleted file mode 100644 index 81d636b70..000000000 --- a/backend/Renderer.php +++ /dev/null @@ -1,290 +0,0 @@ -outputToSmil(); - if (PEAR::isError($smil)) { - return $smil; - } - // temporary file for smil: - $tmpn = tempnam($CC_CONFIG['bufferDir'], 'plRender_'); - $smilf = "$tmpn.smil"; - file_put_contents($smilf, $smil); - $url = "file://$smilf"; - // output file: - $outf = "$tmpn.".RENDER_EXT; - touch($outf); - // logging: - $logf = $CC_CONFIG['bufferDir']."/renderer.log"; - file_put_contents($logf, "--- ".date("Ymd-H:i:s")."\n", FILE_APPEND); - // open access to output file: /*gunid*/ /*parent*/ - $acc = BasicStor::bsAccess($outf, RENDER_EXT, $plid, 'render', 0, $owner); - if (PEAR::isError($acc)) { - return $acc; - } - extract($acc); - $statf = Renderer::getStatusFile($gb, $token); - file_put_contents($statf, "working"); - // command: - $stServDir = dirname(__FILE__)."/.."; - $renderExe = "$stServDir/bin/renderer.sh"; - $command = "$renderExe -p $url -o $outf -s $statf >> $logf &"; - file_put_contents($logf, "$command\n", FILE_APPEND); - $res = system($command); - if ($res === FALSE) { - return PEAR::raiseError( - 'Renderer::rnRender2File: Error running renderer' - ); - } - return array('token'=>$token); - } - - - /** - * Render playlist to ogg file (check results) - * - * @param GreenBox $gb - * GreenBox object reference - * @param string $token - * render token - * @return array - * status : string - success | working | fault - * url : string - readable url - */ - function rnRender2FileCheck(&$gb, $token) - { - $statf = Renderer::getStatusFile($gb, $token); - if (!file_exists($statf)) { - return PEAR::raiseError( - 'Renderer::rnRender2FileCheck: Invalid token' - ); - } - $status = trim(file_get_contents($statf)); - $url = Renderer::getUrl($gb, $token); - $tmpfile= Renderer::getLocalFile($gb, $token); - return array('status'=>$status, 'url'=>$url, 'tmpfile'=>$tmpfile); - } - - - /** - * Render playlist to ogg file (list results) - * - * @param GreenBox $gb - * greenbox object reference - * @param string $stat - * status (optional) if this parameter is not set, then return with all unclosed backups - * @return array - * array of hasharray: - * status : string - success | working | fault - * url : string - readable url - */ - function rnRender2FileList(&$gb,$stat='') { - // open temporary dir - $tokens = BasicStor::GetTokensByType('render'); - foreach ($tokens as $token) { - $st = Renderer::rnRender2FileCheck($gb, $token); - if ( ($stat=='') || ($st['status']==$stat) ) { - $r[] = $st; - } - } - return $r; - } - - - /** - * Render playlist to ogg file (close handle) - * - * @param GreenBox $gb - * greenbox object reference - * @param string $token - * render token - * @return mixed - * TRUE or PEAR_Error - */ - function rnRender2FileClose(&$gb, $token) - { - global $CC_CONFIG; - $r = BasicStor::bsRelease($token, 'render'); - if (PEAR::isError($r)) { - return $r; - } - $realOgg = $r['realFname']; - $tmpn = $CC_CONFIG['bufferDir']."/".basename($realOgg, '.'.RENDER_EXT); - $smilf = "$tmpn.smil"; - $statf = Renderer::getStatusFile($gb, $token); - @unlink($statf); - @unlink($realOgg); - @unlink($smilf); - @unlink($tmpn); - return TRUE; - } - - - /** - * Render playlist to storage as audioClip (check results) - * - * @param GreenBox $gb - * greenbox object reference - * @param string $token - * render token - * @return array - * status : string - success | working | fault - * gunid: string - global unique id of result file - */ - function rnRender2StorageCheck(&$gb, $token) - { - $r = Renderer::rnRender2FileCheck($gb, $token); - if (PEAR::isError($r)) { - return $r; - } - $status = $r['status']; - $res = array('status' => $status, 'gunid'=>'NULL'); - switch ($status) { - case "fault": - $res['faultString'] = "Error runing renderer"; - break; - case "success": - $r = Renderer::rnRender2StorageCore($gb, $token); - if (PEAR::isError($r)) { - return $r; - } - $res['gunid'] = $r['gunid']; - break; - default: - break; - } - return $res; - } - - - /** - * Render playlist to storage as audioClip (core method) - * - * @param GreenBox $gb - * greenbox object reference - * @param string $token - * render token - * @return array: - * gunid: string - global unique id of result file - */ - function rnRender2StorageCore(&$gb, $token) - { - // $r = BasicStor::bsRelease($token, 'render'); - // if (PEAR::isError($r)) { - // return $r; - // } - // $realOgg = $r['realFname']; - // $owner = $r['owner']; - // $gunid = $r['gunid']; - // $fileName = 'rendered_playlist'; - // $id = BasicStor::IdFromGunid($gunid); - // if (PEAR::isError($id)) { - // return $id; - // } - // $mdata = ''; - // foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) { - // $val = $gb->bsGetMetadataValue($id, $item); - // $mdata .= " <$item>$val\n"; - // } - // $mdata = "\n \n$mdata \n\n"; - // //$mdata = "\n \n$mdata0\n\n\n"; - // $values = array( - // "filename" => $fileName, - // "filepath" => $realOgg, - // "metadata" => $mdata, - // "filetype" => "audioclip" - // ); - // $storedFile = $gb->bsPutFile($values); - // if (PEAR::isError($storedFile)) { - // return $storedFile; - // } - // return array('gunid' => $storedFile->getGunid()); - } - - - /** - * Return local filepath of rendered file - * - * @param Greenbox $gb - * greenbox object reference - * @param string $token - * render token - * @return array - */ - function getLocalFile(&$gb, $token) - { - global $CC_CONFIG; - $token = StoredFile::NormalizeGunid($token); - return $CC_CONFIG['accessDir']."/$token.".RENDER_EXT; - } - - - /** - * Return filepath of render status file - * - * @param GreenBox $gb - * greenbox object reference - * @param string $token - * render token - * @return array - */ - function getStatusFile(&$gb, $token) - { - return Renderer::getLocalFile($gb, $token).".status"; - } - - - /** - * Return remote accessible URL for rendered file - * - * @param GreenBox $gb - * greenbox object reference - * @param string $token - * render token - * @return array - */ - function getUrl(&$gb, $token) - { - $token = StoredFile::NormalizeGunid($token); - return BasicStor::GetUrlPart()."access/$token.".RENDER_EXT; - } - -} // class Renderer - -?> \ No newline at end of file diff --git a/backend/Restore.php b/backend/Restore.php deleted file mode 100644 index 892c0f19f..000000000 --- a/backend/Restore.php +++ /dev/null @@ -1,436 +0,0 @@ -gb =& $gb; - $this->token = null; - $this->logFile = $CC_CONFIG['bufferDir'].'/'.$this->ACCESS_TYPE.'.log'; - if ($this->loglevel == 'debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." construct\n"); - } - } - - - /** - * Call asyncronously the restore procedure. Restore from backup. - * - * @param string $sessid - * session id - * @param string $backup_file - * path of the backup file - * @return array - * hasharray with field: - * token string: backup token - */ - function openRestore($sessid, $backup_file) - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I-".date("Ymd-H:i:s")." doRestore - sessid:$sessid\n"); - } - $this->sessid = $sessid; - - // generate token - $this->token = StoredFile::CreateGunid(); - - // status file -> working - $this->setEnviroment(); - file_put_contents($this->statusFile, 'working'); - - //call the restore script in background - $command = dirname(__FILE__).'/../bin/restore.php'; - $runLog = "/dev/null"; - $params = "{$backup_file} {$this->statusFile} {$this->token} {$sessid}>> $runLog &"; - $ret = system("$command $params", $st); - if ($this->loglevel=='debug') { - $this->addLogItem("-I-".date("Ymd-H:i:s")." restore.php call: $st/$ret\n"); - } - - return array('token'=>$this->token); - } - - - /** - * Check the status of restore - * - * @param string $token - * @return array - * hasharray with field: - * status : string - susccess | working | fault - * faultString : string - description of fault - * token : stirng - backup token - * url : string - access url - * tmpfile : string - access filename - */ - function checkRestore($token) - { - if ($this->loglevel == 'debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." checkBackup - token:$token\n"); - } - $this->token = $token; - $this->setEnviroment(); - if (is_file($this->statusFile)) { - $r = array(); - $stat = file_get_contents($this->statusFile); - if (strpos($stat,'fault|') !== false) { - list($stat,$message) = explode('|',$stat); - } - $r['status'] = $stat; - if ($stat=='fault') { - $r['faultString'] = $message; - } else { - $r['faultString'] = ''; - } - return $r; - } else { - return PEAR::raiseError('Restore::checkRestore: invalid token!'); - } - } - - - /** - * Check the status of restore. - * - * @param string $token - * @return array - * hasharray with field: - * status : boolean - is success - */ - function closeRestore($token) - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." checkBackup - token:$token\n"); - } - $this->token = $token; - $this->setEnviroment(); - $this->rRmDir($this->tmpDir); - unlink($this->statusFile); - return array("status" => !is_file($this->statusFile)); - } - - - /** - * Do restore in background - * - * this function is called from the asyncron commandline script - * ../bin/restore.php - * - * @param string $backupfile - * path of backupfile - * @param string $token - * restore token - * @param string $sessid - * session id - */ - function startRestore($backupfile, $token, $sessid) - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." startRestore - bufile:$backupfile | token:$token\n"); - } - $this->token = $token; - $this->sessid = $sessid; - $this->setEnviroment(); - - // extract tarball - $command = 'tar -xf '.$backupfile .' --directory '.$this->tmpDir; - $res = system($command); - //$this->addLogItem('command: '.$command."\n"); - //$this->addLogItem('res: '.$res."\n"); - - //simple check of archive format - if (is_dir($this->tmpDir.'audioClip/') && - is_dir($this->tmpDir.'meta-inf/') && - is_dir($this->tmpDir.'playlist/')) { - //search metafiles - $this->metafiles = $this->getMetaFiles(); - #$this->addLogItem('metafiles:'.print_r($this->metafiles,true)); - //add to storage server - foreach ($this->metafiles as $info) { - $r = $this->addFileToStorage($info['file'],$info['type'],$info['id']); - if (PEAR::isError($r)) { - $this->addLogItem("-E- ".date("Ymd-H:i:s"). - " startRestore - addFileToStorage \n". - "(".$put->getMessage()."/".$put->getUserInfo().")\n" - ); - file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo()); - return; - } - } - } else { - $this->addLogItem("-E- ".date("Ymd-H:i:s")." startRestore - invalid archive format\n"); - file_put_contents($this->statusFile, 'fault|invalid archive format'); - return; - } - file_put_contents($this->statusFile, 'success'); - // unlink($backupfile); - } - - - /** - * Get the metafiles. - * - * @return array - * array of hasharray with field: - * file : string - metafile path - * type : stirng - audioClip | playlist - * id : string - the backuped gunid - */ - function getMetaFiles() - { - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." getMetaFiles - tmpDir:{$this->tmpDir}\n"); - } - $audioclips = scandir($this->tmpDir.'audioClip/'); - $playlists = scandir($this->tmpDir.'playlist/'); - for ($i = 0; $i < count($audioclips); $i++) { - if (strpos($audioclips[$i],'xml')!==false) - $r[] = array('file' => $this->tmpDir.'audioClip/'.$audioclips[$i], - 'type' => 'audioClip', - 'id' => str_replace('.xml','',$audioclips[$i])); - } - for ($i = 0; $i < count($playlists); $i++) { - if (strpos($playlists[$i],'xml') !== false) - $r[] = array('file' => $this->tmpDir.'playlist/'.$playlists[$i], - 'type' => 'playlist', - 'id' => str_replace('.xml','',$playlists[$i])); - } - return $r; - } - - - /** - * Add the file to the storage server. - * - * @param string $file - * path of metafile - * @param string $type - * restore token - * @param string $sessid - * session id - * - * @return mixed - * true if success or PEAR_error - */ - // function addFileToStorage($file,$type,$gunid) - // { - // if ($this->loglevel=='debug') { - // $this->addLogItem("-I- ".date("Ymd-H:i:s")." addFileToStorage - file:$file | type:$type | id:$gunid\n"); - // } - // require_once("XmlParser.php"); - // $tree = XmlParser::parse($file); - // $mediaFileLP = str_replace('.xml','',$file); - // $mediaFileLP = ($type=='audioClip' && is_file($mediaFileLP))?$mediaFileLP:''; - // $ex = $this->gb->existsFile($this->sessid,$gunid); - // if (PEAR::isError($ex)) { - // $this->addLogItem("-E- ".date("Ymd-H:i:s"). - // " addFileToStorage - existsFile($gunid) ". - // "(".$ex->getMessage()."/".$ex->getUserInfo().")\n" - // ); - // } - // if (!PEAR::isError($ex) && $ex) { // file is exists in storage server - // //replace it - // $id = BasicStor::IdFromGunid($gunid); - // $replace = $this->gb->replaceFile( - // $id, # id int, virt.file's local id - // $mediaFileLP, # mediaFileLP string, local path of media file - // $file, # mdataFileLP string, local path of metadata file - // $this->sessid); # sessid string, session id - // if (PEAR::isError($replace)) { - // $this->addLogItem("-E- ".date("Ymd-H:i:s"). - // " addFileToStorage - replaceFile Error ". - // "(".$replace->getMessage()."/".$replace->getUserInfo().")\n" - // ); - // file_put_contents($this->statusFile, 'fault|'.$replace->getMessage()."/".$replace->getUserInfo()); - // return $replace; - // } - // #$this->addLogItem("replace it \n"); - // } else { - // // add as new - // $name = $tree->children[0]->children[0]->content; - // if (empty($name)) { - // $name = $tree->attrs['title']->val; - // } - // if (empty($name)) { - // $name = '???'; - // } - // if ($this->loglevel=='debug') { - // $this->addLogItem("-I- ".date("Ymd-H:i:s")." putFile\n". - // "$name, $mediaFileLP, $file, {$this->sessid}, $gunid, $type \n" - // ); - // } - // $values = array( - // "filename" => $name, - // "filepath" => $mediaFileLP, - // "metadata" => $file, - // "gunid" => $gunid, - // "filetype" => $type - // ); - // $put = $this->gb->putFile($values, $this->sessid); - // //$this->addLogItem("add as new \n"); - // if (PEAR::isError($put)) { - // $this->addLogItem("-E- ".date("Ymd-H:i:s"). - // " addFileToStorage - putFile Error ". - // "(".$put->getMessage()."/".$put->getUserInfo().")\n" - // ."\n---\n".file_get_contents($file)."\n---\n" - // ); - // file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo()); - // //$this->addLogItem("Error Object: ".print_r($put,true)."\n"); - // return $put; - // } - // } - // $ac = StoredFile::RecallByGunid($gunid); - // if (is_null($ac) || PEAR::isError($ac)) { - // return $ac; - // } - // $res = $ac->setState('ready'); - // if (PEAR::isError($res)) { - // return $res; - // } - // return true; - // } - - - /** - * Figure out the environment to the backup. - * - */ - function setEnviroment() - { - global $CC_CONFIG; - if ($this->loglevel=='debug') { - $this->addLogItem("-I- ".date("Ymd-H:i:s")." setEnviroment\n"); - } - $this->statusFile = $CC_CONFIG['accessDir'].'/'.$this->token.'.status'; - $this->tmpDir = '/tmp/ls_restore/'.$this->token.'/'; - $this->rMkDir($this->tmpDir); - } - - - /** - * Add a line to the logfile. - * - * @param string $item - * the new row of log file - */ - function addLogItem($item) - { - $f = fopen ($this->logFile,'a'); - flock($f,LOCK_SH); - fwrite($f,$item); - flock($f,LOCK_UN); - fclose($f); - //echo file_get_contents($this->logFile)."

\n\n"; - } - - - /** - * Delete a directory recursive - * - * @param string $dirname - * path of dir - * - * @return boolean - * is success - */ - function rRmDir($dirname) - { - if (is_dir($dirname)) { - $dir_handle = opendir($dirname); - } - while ($file = readdir($dir_handle)) { - if ($file!="." && $file!="..") { - if (!is_dir($dirname."/".$file)) { - unlink ($dirname."/".$file); - } else { - Restore::rRmDir($dirname."/".$file); - } - } - } - closedir($dir_handle); - rmdir($dirname); - return true; - } - - - /** - * Create a directory recursive - * - * @param string $dirname - * path of dir. - * @param int $mode - * octal - rights of dir. - * @param boolean $recursive - * do it recursive. - * - * @return boolean - */ - function rMkDir($dirname, $mode=0777, $recursive=true) - { - if (is_null($dirname) || $dirname === "" ) { - return false; - } - if (is_dir($dirname) || $dirname === "/" ) { - return true; - } - if ($this->rMkDir(dirname($dirname), $mode, $recursive)) { - return mkdir($dirname, $mode); - } - return false; - } - -} // class Restore -?> diff --git a/backend/Schedule.php b/backend/Schedule.php deleted file mode 100644 index fa80671f3..000000000 --- a/backend/Schedule.php +++ /dev/null @@ -1,560 +0,0 @@ -groupId = $p_groupId; - } - - /** - * Return true if the schedule group exists in the DB. - * @return boolean - */ - public function exists() { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT COUNT(*) FROM ".$CC_CONFIG['scheduleTable'] - ." WHERE group_id=".$this->groupId; - $result = $CC_DBC->GetOne($sql); - if (PEAR::isError($result)) { - return $result; - } - return $result != "0"; - } - - /** - * Convert a date to an ID by stripping out all characters - * and padding with zeros. - * - * @param string $p_dateStr - */ - public static function dateToId($p_dateStr) { - $p_dateStr = str_replace(":", "", $p_dateStr); - $p_dateStr = str_replace(" ", "", $p_dateStr); - $p_dateStr = str_replace(".", "", $p_dateStr); - $p_dateStr = str_replace("-", "", $p_dateStr); - $p_dateStr = substr($p_dateStr, 0, 17); - $p_dateStr = str_pad($p_dateStr, 17, "0"); - return $p_dateStr; - } - - /** - * Add the two times together, return the result. - * - * @param string $p_baseTime - * Specified as YYYY-MM-DD HH:MM:SS - * - * @param string $p_addTime - * Specified as HH:MM:SS.nnnnnn - * - * @return string - * The end time, to the nearest second. - */ - // protected function calculateEndTime($p_startTime, $p_trackTime) { - // $p_trackTime = substr($p_startTime, 0, ); - // $start = new DateTime(); - // $interval = new DateInterval() - // - // } - - /** - * Add a music clip or playlist to the schedule. - * - * @param $p_datetime - * In the format YYYY-MM-DD HH:MM:SS.mmmmmm - * @param $p_audioFileId - * (optional, either this or $p_playlistId must be set) DB ID of the audio file - * @param $p_playlistId - * (optional, either this of $p_audioFileId must be set) DB ID of the playlist - * @param $p_options - * Does nothing at the moment. - * - * @return int|PEAR_Error - * Return PEAR_Error if the item could not be added. - * Error code 555 is a scheduling conflict. - */ - public function add($p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) { - global $CC_CONFIG, $CC_DBC; - if (!is_null($p_audioFileId)) { - // Schedule a single audio track - - // Load existing track - $track = StoredFile::Recall($p_audioFileId); - if (is_null($track)) { - return new PEAR_Error("Could not find audio track."); - } - - // Check if there are any conflicts with existing entries - $metadata = $track->getMetadata(); - $length = trim($metadata["length"]); - if (empty($length)) { - return new PEAR_Error("Length is empty."); - } - if (!Schedule::isScheduleEmptyInRange($p_datetime, $length)) { - return new PEAR_Error("Schedule conflict.", 555); - } - - // Insert into the table - $this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')"); - $id = $this->dateToId($p_datetime); - $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] - ." (id, playlist_id, starts, ends, clip_length, group_id, file_id)" - ." VALUES ($id, 0, TIMESTAMP '$p_datetime', " - ." (TIMESTAMP '$p_datetime' + INTERVAL '$length')," - ." '$length'," - ." {$this->groupId}, $p_audioFileId)"; - $result = $CC_DBC->query($sql); - if (PEAR::isError($result)) { - //var_dump($sql); - return $result; - } - return $this->groupId; - - } elseif (!is_null($p_playlistId)){ - // Schedule a whole playlist - - // Load existing playlist - $playlist = Playlist::Recall($p_playlistId); - if (is_null($playlist)) { - return new PEAR_Error("Could not find playlist."); - } - - // Check if there are any conflicts with existing entries - $length = trim($playlist->getLength()); - //var_dump($length); - if (empty($length)) { - return new PEAR_Error("Length is empty."); - } - if (!Schedule::isScheduleEmptyInRange($p_datetime, $length)) { - return new PEAR_Error("Schedule conflict.", 555); - } - - // Insert all items into the schedule - $this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')"); - $id = $this->dateToId($p_datetime); - $itemStartTime = $p_datetime; - - $plItems = $playlist->getContents(); - //var_dump($plItems); - foreach ($plItems as $row) { - $trackLength = $row["cliplength"]; - //var_dump($trackLength); - $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] - ." (id, playlist_id, starts, ends, group_id, file_id," - ." clip_length, cue_in, cue_out, fade_in, fade_out)" - ." VALUES ($id, $p_playlistId, TIMESTAMP '$itemStartTime', " - ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," - ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," - ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; - $result = $CC_DBC->query($sql); - if (PEAR::isError($result)) { - //var_dump($sql); - return $result; - } - $itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'"); - $id = $this->dateToId($itemStartTime); - } - return $this->groupId; - } - } - - public function addAfter($p_groupId, $p_audioFileId) { - global $CC_CONFIG, $CC_DBC; - // Get the end time for the given entry - $sql = "SELECT ends FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE group_id=$p_groupId"; - $startTime = $CC_DBC->GetOne($sql); - return $this->add($startTime, $p_audioFileId); - } - - public function update() { - - } - - /** - * Remove the group from the schedule. - * Note: does not check if it is in the past, you can remove anything. - * - * @return boolean - * TRUE on success, false if there is no group ID defined. - */ - public function remove() { - global $CC_CONFIG, $CC_DBC; - if (is_null($this->groupId) || !is_numeric($this->groupId)) { - return false; - } - $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE group_id = ".$this->groupId; - //echo $sql; - return $CC_DBC->query($sql); - } - - /** - * Return the number of items in this group. - * @return string - */ - public function count() { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT COUNT(*) FROM {$CC_CONFIG['scheduleTable']}" - ." WHERE group_id={$this->groupId}"; - return $CC_DBC->GetOne($sql); - } - - /* - * Return the list of items in this group as a 2D array. - * @return array - */ - public function getItems() { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT * FROM {$CC_CONFIG['scheduleTable']}" - ." WHERE group_id={$this->groupId}"; - return $CC_DBC->GetAll($sql); - } - - public function reschedule($toDateTime) { - global $CC_CONFIG, $CC_DBC; - // $sql = "UPDATE ".$CC_CONFIG["scheduleTable"]. " SET id=, starts=,ends=" - } - - public function notifyGroupStartPlay() { - global $CC_CONFIG, $CC_DBC; - $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] - ." SET schedule_group_played=TRUE" - ." WHERE group_id=".$this->groupId; - return $CC_DBC->query($sql); - } - - public function notifyMediaItemStartPlay($p_fileId) { - global $CC_CONFIG, $CC_DBC; - $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] - ." SET media_item_played=TRUE" - ." WHERE group_id=".$this->groupId - ." AND file_id=".pg_escape_string($p_fileId); - return $CC_DBC->query($sql); - } -} - -class Schedule { - - function __construct() { - - } - - /** - * Return true if there is nothing in the schedule for the given start time - * up to the length of time after that. - * - * @param string $p_datetime - * In the format YYYY-MM-DD HH:MM:SS.mmmmmm - * @param string $p_length - * In the format HH:MM:SS.mmmmmm - * @return boolean|PEAR_Error - */ - public static function isScheduleEmptyInRange($p_datetime, $p_length) { - global $CC_CONFIG, $CC_DBC; - if (empty($p_length)) { - return new PEAR_Error("Schedule::isSchedulerEmptyInRange: param p_length is empty."); - } - $sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE (starts >= '$p_datetime') " - ." AND (ends <= (TIMESTAMP '$p_datetime' + INTERVAL '$p_length'))"; - //$_SESSION["debug"] = $sql; - //var_dump($sql); - $count = $CC_DBC->GetOne($sql); - //var_dump($count); - return ($count == '0'); - } - - // public function onAddTrackToPlaylist($playlistId, $audioTrackId) { - // - // } - // - // public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) { - // - // } - - /** - * Return TRUE if file is going to be played in the future. - * - * @param string $p_fileId - */ - public function IsFileScheduledInTheFuture($p_fileId) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT COUNT(*) FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE file_id = {$p_fileId} AND starts > NOW()"; - $count = $CC_DBC->GetOne($sql); - if (is_numeric($count) && ($count != '0')) { - return TRUE; - } else { - return FALSE; - } - } - - - /** - * Returns array indexed numberically of: - * "playlistId"/"playlist_id" (aliases to the same thing) - * "start"/"starts" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn - * "end"/"ends" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn - * "group_id"/"id" (aliases to the same thing) - * "clip_length" (for audio clips this is the length of the audio clip, - * for playlists this is the length of the entire playlist) - * "name" (playlist only) - * "creator" (playlist only) - * "file_id" (audioclip only) - * "count" (number of items in the playlist, always 1 for audioclips. - * Note that playlists with one item will also have count = 1. - * - * @param string $p_fromDateTime - * In the format YYYY-MM-DD HH:MM:SS.nnnnnn - * @param string $p_toDateTime - * In the format YYYY-MM-DD HH:MM:SS.nnnnnn - * @param boolean $p_playlistsOnly - * Retreive playlists as a single item. - * @return array - * Returns empty array if nothing found - */ - public static function GetItems($p_fromDateTime, $p_toDateTime, $p_playlistsOnly = true) { - global $CC_CONFIG, $CC_DBC; - $rows = array(); - if (!$p_playlistsOnly) { - $sql = "SELECT * FROM ".$CC_CONFIG["scheduleTable"] - ." WHERE (starts >= TIMESTAMP '$p_fromDateTime') " - ." AND (ends <= TIMESTAMP '$p_toDateTime')"; - $rows = $CC_DBC->GetAll($sql); - foreach ($rows as &$row) { - $row["count"] = "1"; - $row["playlistId"] = $row["playlist_id"]; - $row["start"] = $row["starts"]; - $row["end"] = $row["ends"]; - $row["id"] = $row["group_id"]; - } - } else { - $sql = "SELECT MIN(name) AS name, MIN(creator) AS creator, group_id, " - ." SUM(clip_length) AS clip_length," - ." MIN(file_id) AS file_id, COUNT(*) as count," - ." MIN(playlist_id) AS playlist_id, MIN(starts) AS starts, MAX(ends) AS ends" - ." FROM ".$CC_CONFIG["scheduleTable"] - ." LEFT JOIN ".$CC_CONFIG["playListTable"]." ON playlist_id = ".$CC_CONFIG["playListTable"].".id" - ." WHERE (starts >= TIMESTAMP '$p_fromDateTime') AND (ends <= TIMESTAMP '$p_toDateTime')" - ." GROUP BY group_id" - ." ORDER BY starts"; - //var_dump($sql); - $rows = $CC_DBC->GetAll($sql); - if (!PEAR::isError($rows)) { - foreach ($rows as &$row) { - $row["playlistId"] = $row["playlist_id"]; - $row["start"] = $row["starts"]; - $row["end"] = $row["ends"]; - $row["id"] = $row["group_id"]; - } - } - } - return $rows; - } - - public function getSchedulerTime() { - - } - - public function getCurrentlyPlaying() { - - } - - public function getNextItem($nextCount = 1) { - - } - - public function getStatus() { - - } - - /** - * Convert a time string in the format "YYYY-MM-DD HH:mm:SS" - * to "YYYY-MM-DD-HH-mm-SS". - * - * @param string $p_time - * @return string - */ - private static function CcTimeToPypoTime($p_time) - { - $p_time = substr($p_time, 0, 19); - $p_time = str_replace(" ", "-", $p_time); - $p_time = str_replace(":", "-", $p_time); - return $p_time; - } - - /** - * Convert a time string in the format "YYYY-MM-DD-HH-mm-SS" to - * "YYYY-MM-DD HH:mm:SS". - * - * @param string $p_time - * @return string - */ - private static function PypoTimeToCcTime($p_time) - { - $t = explode("-", $p_time); - return $t[0]."-".$t[1]."-".$t[2]." ".$t[3].":".$t[4].":00"; - } - - /** - * Converts a time value as a string (with format HH:MM:SS.mmmmmm) to - * millisecs. - * - * @param string $p_time - * @return int - */ - private static function WallTimeToMillisecs($p_time) - { - $t = explode(":", $p_time); - $millisecs = 0; - if (strpos($t[2], ".")) { - $secParts = explode(".", $t[2]); - $millisecs = $secParts[1]; - $millisecs = substr($millisecs, 0, 3); - $millisecs = intval($millisecs); - $seconds = intval($secParts[0]); - } else { - $seconds = intval($t[2]); - } - $ret = $millisecs + ($seconds * 1000) + ($t[1] * 60 * 1000) + ($t[0] * 60 * 60 * 1000); - return $ret; - } - - - /** - * Compute the difference between two times in the format "HH:MM:SS.mmmmmm". - * Note: currently only supports calculating millisec differences. - * - * @param string $p_time1 - * @param string $p_time2 - * @return double - */ - private static function TimeDiff($p_time1, $p_time2) - { - $parts1 = explode(".", $p_time1); - $parts2 = explode(".", $p_time2); - $diff = 0; - if ( (count($parts1) > 1) && (count($parts2) > 1) ) { - $millisec1 = substr($parts1[1], 0, 3); - $millisec1 = str_pad($millisec1, 3, "0"); - $millisec1 = intval($millisec1); - $millisec2 = substr($parts2[1], 0, 3); - $millisec2 = str_pad($millisec2, 3, "0"); - $millisec2 = intval($millisec2); - $diff = abs(millisec1 - millisec2)/1000; - } - return $diff; - } - - - /** - * Export the schedule in json formatted for pypo (the liquidsoap scheduler) - * - * @param string $range - * In the format "YYYY-MM-DD HH:mm:ss" - * @param string $source - * In the format "YYYY-MM-DD HH:mm:ss" - */ - public static function ExportRangeAsJson($p_fromDateTime, $p_toDateTime) - { - global $CC_CONFIG, $CC_DBC; - $range_start = Schedule::PypoTimeToCcTime($p_fromDateTime); - $range_end = Schedule::PypoTimeToCcTime($p_toDateTime); - $range_dt = array('start' => $range_start, 'end' => $range_end); - //var_dump($range_dt); - - // Scheduler wants everything in a playlist - $data = Schedule::GetItems($range_start, $range_end, true); - //echo "
";var_dump($data);
-        $playlists = array();
-
-        if (is_array($data) && count($data) > 0)
-        {
-            foreach ($data as $dx)
-            {
-                // Is this the first item in the playlist?
-                $start = $dx['start'];
-                // chop off subseconds
-                $start = substr($start, 0, 19);
-
-                // Start time is the array key, needs to be in the format "YYYY-MM-DD-HH-mm-ss"
-                $pkey = Schedule::CcTimeToPypoTime($start);
-                $timestamp =  strtotime($start);
-                $playlists[$pkey]['source'] = "PLAYLIST";
-                $playlists[$pkey]['x_ident'] = $dx["playlist_id"];
-                $playlists[$pkey]['subtype'] = '1'; // Just needs to be between 1 and 4 inclusive
-                $playlists[$pkey]['timestamp'] = $timestamp;
-                $playlists[$pkey]['duration'] = $dx['clip_length'];
-                $playlists[$pkey]['played'] = '0';
-                $playlists[$pkey]['schedule_id'] = $dx['group_id'];
-                $playlists[$pkey]['user_id'] = 0;
-                $playlists[$pkey]['id'] = $dx["playlist_id"];
-            	$playlists[$pkey]['start'] = Schedule::CcTimeToPypoTime($dx["start"]);
-            	$playlists[$pkey]['end'] = Schedule::CcTimeToPypoTime($dx["end"]);
-            }
-        }
-
-        foreach ($playlists as &$playlist)
-        {
-            $scheduleGroup = new ScheduleGroup($playlist["schedule_id"]);
-            $items = $scheduleGroup->getItems();
-            $medias = array();
-            $playlist['subtype'] = '1';
-            foreach ($items as $item)
-            {
-                $storedFile = StoredFile::Recall($item["file_id"]);
-                $uri = $storedFile->getFileUrl();
-
-                // For pypo, a cueout of zero means no cueout
-                $cueOut = "0";
-                if (Schedule::TimeDiff($item["cue_out"], $item["clip_length"]) > 0.001) {
-                    $cueOut = Schedule::WallTimeToMillisecs($item["cue_out"]);
-                }
-                $medias[] = array(
-					'id' => $storedFile->getGunid(), //$item["file_id"],
-					'uri' => $uri,
-					'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
-					'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
-					'fade_cross' => 0,
-					'cue_in' => Schedule::WallTimeToMillisecs($item["cue_in"]),
-					'cue_out' => $cueOut,
-                    'export_source' => 'scheduler'
-                );
-            }
-            $playlist['medias'] = $medias;
-        }
-
-        $result = array();
-        $result['status'] = array('range' => $range_dt, 'version' => "0.2");
-        $result['playlists'] = $playlists;
-        $result['check'] = 1;
-
-        print json_encode($result);
-    }
-
-
-    /**
-     * Remove all items from the schedule in the given range.
-     *
-     * @param string $p_start
-     *    In the format YYYY-MM-DD HH:MM:SS.nnnnnn
-     * @param string $p_end
-     *    In the format YYYY-MM-DD HH:MM:SS.nnnnnn
-     */
-    public static function RemoveItemsInRange($p_start, $p_end)
-    {
-        $items = Schedule::GetItems($p_start, $p_end);
-        foreach ($items as $item) {
-            $scheduleGroup = new ScheduleGroup($item["group_id"]);
-            $scheduleGroup->remove();
-        }
-    }
-
-}
-
-?>
\ No newline at end of file
diff --git a/backend/SmilPlaylist.php b/backend/SmilPlaylist.php
deleted file mode 100644
index 739667dc8..000000000
--- a/backend/SmilPlaylist.php
+++ /dev/null
@@ -1,313 +0,0 @@
-lock($gb, $subjid);
-        if (PEAR::isError($r)) {
-            return $r;
-        }
-        $r = $pl->setMetadata($lspl, 'string', 'playlist');
-        if (PEAR::isError($r)) {
-            return $r;
-        }
-        $r = $pl->unlock($gb);
-        if (PEAR::isError($r)) {
-            return $r;
-        }
-        return $pl;
-    }
-
-
-    /**
-     * Import SMIL file to storage.
-     *
-     * @param GreenBox $gb
-     * @param string $data
-     * 		local path to SMIL file
-     * @param hasharray $gunids
-     * 		hash relation from filenames to gunids
-     * @param array $parr
-     * 		array of subjid, aPath, plid, rPath
-     * @return string
-     * 		XML of playlist in Campcaster playlist format
-     */
-    public static function convert2lspl(&$gb, $data, &$gunids, $parr)
-    {
-        extract($parr);
-        $tree = SmilPlaylist::parse($data);
-        if (PEAR::isError($tree)) {
-            return $tree;
-        }
-        if ($tree->name != 'smil') {
-            return PEAR::raiseError("SmilPlaylist::parse: smil tag expected");
-        }
-        if (isset($tree->children[1])) {
-            return PEAR::raiseError(sprintf(
-                "SmilPlaylist::parse: unexpected tag %s in tag smil",
-            $tree->children[1]->name
-            ));
-        }
-        $res = SmilPlaylistBodyElement::convert2lspl(
-        $gb, $tree->children[0], &$gunids, $parr);
-        return $res;
-    }
-
-} // SmilPlaylist
-
-
-/**
- * @package Campcaster
- * @subpackage StorageServer
- * @copyright 2010 Sourcefabric O.P.S.
- * @license http://www.gnu.org/licenses/gpl.txt
- */
-class SmilPlaylistBodyElement {
-
-    public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
-    {
-        extract($parr);
-        $ind2 = $ind.INDCH;
-        if ($tree->name != 'body') {
-            return PEAR::raiseError("SmilPlaylist::parse: body tag expected");
-        }
-        if (isset($tree->children[1])) {
-            return PEAR::raiseError(sprintf(
-                "SmilPlaylist::parse: unexpected tag %s in tag body",
-            $tree->children[1]->name
-            ));
-        }
-        $res = SmilPlaylistParElement::convert2lspl(
-        $gb, $tree->children[0], &$gunids, $parr, $ind2);
-        if (PEAR::isError($res)) {
-            return $res;
-        }
-        $title = basename($rPath);
-        $playlength = '0';
-        $res = "$ind\n".
-            "$ind\n".
-            "$ind2\n".
-            "$res".
-            "$ind\n";
-        return $res;
-    }
-
-} // class SmilPlaylistBodyElement
-
-
-/**
- * @package Campcaster
- * @subpackage StorageServer
- * @copyright 2010 Sourcefabric O.P.S.
- * @license http://www.gnu.org/licenses/gpl.txt
- */
-class SmilPlaylistParElement {
-
-    public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
-    {
-        extract($parr);
-        if ($tree->name != 'par') {
-            return PEAR::raiseError("SmilPlaylist::parse: par tag expected");
-        }
-        $res = '';
-        foreach ($tree->children as $i => $ch) {
-            $ch =& $tree->children[$i];
-            $r = SmilPlaylistAudioElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind.INDCH);
-            if (PEAR::isError($r)) {
-                return $r;
-            }
-            $res .= $r;
-        }
-        return $res;
-    }
-}
-
-
-/**
- * @package Campcaster
- * @subpackage StorageServer
- * @copyright 2010 Sourcefabric O.P.S.
- * @license http://www.gnu.org/licenses/gpl.txt
- */
-class SmilPlaylistAudioElement {
-    public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
-    {
-        extract($parr);
-        $uri = $tree->attrs['src']->val;
-        $gunid  = ( isset($gunids[basename($uri)]) ?  $gunids[basename($uri)] : NULL);
-        $ind2 = $ind.INDCH;
-        if ($tree->name != 'audio') {
-            return PEAR::raiseError("SmilPlaylist::parse: audio tag expected");
-        }
-        if (isset($tree->children[2])) {
-            return PEAR::raiseError(sprintf(
-                "SmilPlaylist::parse: unexpected tag %s in tag audio",
-            $tree->children[2]->name
-            ));
-        }
-        $res = ''; $fadeIn = 0; $fadeOut = 0;
-        foreach ($tree->children as $i => $ch) {
-            $ch =& $tree->children[$i];
-            $r = SmilPlaylistAnimateElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind2);
-            if (PEAR::isError($r)) {
-                return $r;
-            }
-            switch ($r['type']) {
-                case "fadeIn":  $fadeIn  = $r['val']; break;
-                case "fadeOut": $fadeOut = $r['val']; break;
-            }
-        }
-        if ($fadeIn > 0 || $fadeOut > 0) {
-            $fiGunid = StoredFile::CreateGunid();
-            $fadeIn  = Playlist::secondsToPlaylistTime($fadeIn);
-            $fadeOut = Playlist::secondsToPlaylistTime($fadeOut);
-            $fInfo   = "$ind2\n";
-        } else {
-            $fInfo = '';
-        }
-        $plElGunid  = StoredFile::CreateGunid();
-        $acGunid     = $gunid;
-        $type = 'audioClip';
-        if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) {
-            switch (strtolower($ext = $va[1])) {
-                case "lspl":
-                case "xml":
-                case "smil":
-                case "m3u":
-                    $type = 'playlist';
-                    $acId = $gb->bsImportPlaylistRaw($gunid,
-                    $aPath, $uri, $ext, $gunids, $subjid);
-                    if (PEAR::isError($acId)) {
-                        return $r;
-                    }
-                    //break;
-                default:
-                    $ac = StoredFile::RecallByGunid($gunid);
-                    if (is_null($ac) || PEAR::isError($ac)) {
-                        return $ac;
-                    }
-                    $r = $ac->md->getMetadataElement('dcterms:extent');
-                    if (PEAR::isError($r)) {
-                        return $r;
-                    }
-                    $playlength = $r[0]['value'];
-            }
-        }
-
-        $title = basename($tree->attrs['src']->val);
-        $offset = Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
-        $clipStart = Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
-        $clipEnd = Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
-        $clipLength = Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
-        $res = "$ind\n".
-            "$ind2<$type id=\"$acGunid\" playlength=\"$playlength\" title=\"$title\"/>\n".
-        $fInfo.
-            "$ind\n";
-        return $res;
-    }
-} // class SmilPlaylistAudioElement
-
-
-/**
- * @package Campcaster
- * @subpackage StorageServer
- * @copyright 2010 Sourcefabric O.P.S.
- * @license http://www.gnu.org/licenses/gpl.txt
- */
-class SmilPlaylistAnimateElement {
-
-    public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
-    {
-        extract($parr);
-        if ($tree->name != 'animate') {
-            return PEAR::raiseError("SmilPlaylist::parse: animate tag expected");
-        }
-        if ($tree->attrs['attributeName']->val == 'soundLevel' &&
-        $tree->attrs['from']->val == '0%' &&
-        $tree->attrs['to']->val == '100%' &&
-        $tree->attrs['calcMode']->val == 'linear' &&
-        $tree->attrs['fill']->val == 'freeze' &&
-        $tree->attrs['begin']->val == '0s' &&
-        preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $va)
-        ) {
-            return array('type'=>'fadeIn', 'val'=>intval($va[1]));
-        }
-        if ($tree->attrs['attributeName']->val == 'soundLevel' &&
-        $tree->attrs['from']->val == '100%' &&
-        $tree->attrs['to']->val == '0%' &&
-        $tree->attrs['calcMode']->val == 'linear' &&
-        $tree->attrs['fill']->val == 'freeze' &&
-        preg_match("|^([0-9.]+)s$|", $tree->attrs['begin']->val, $vaBegin) &&
-        preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $vaEnd)
-        ) {
-            return array('type'=>'fadeOut', 'val'=>($vaEnd[1] - $vaBegin[1]));
-        }
-        return PEAR::raiseError(
-            "SmilPlaylistAnimateElement::convert2lspl: animate parameters too general"
-            );
-    }
-} // class SmilPlaylistAnimateElement
-
-?>
\ No newline at end of file
diff --git a/backend/StoredFile.php b/backend/StoredFile.php
deleted file mode 100644
index d1313c66d..000000000
--- a/backend/StoredFile.php
+++ /dev/null
@@ -1,1729 +0,0 @@
- "format",
-    "ls:bitrate" => "bit_rate",
-    "ls:samplerate" => "sample_rate",
-    "dcterms:extent" => "length",
-    "dc:title" => "track_title",
-    "dc:description" => "comments",
-    "dc:type" => "genre",
-    "dc:creator" => "artist_name",
-    "dc:source" => "album_title",
-    "ls:channels" => "channels",
-    "ls:filename" => "name",
-    "ls:year" => "year",
-    "ls:url" => "url",
-    "ls:track_num" => "track_number",
-    "ls:mood" => "mood",
-    "ls:bpm" => "bpm",
-    "ls:disc_num" => "disc_number",
-    "ls:rating" => "rating",
-    "ls:encoded_by" => "encoded_by",
-    "dc:publisher" => "label",
-    "ls:composer" => "composer",
-    "ls:encoder" => "encoder",
-    "ls:crc" => "checksum",
-    "ls:lyrics" => "lyrics",
-    "ls:orchestra" => "orchestra",
-    "ls:conductor" => "conductor",
-    "ls:lyricist" => "lyricist",
-    "ls:originallyricist" => "original_lyricist",
-    "ls:radiostationname" => "radio_station_name",
-    "ls:audiofileinfourl" => "info_url",
-    "ls:artisturl" => "artist_url",
-    "ls:audiosourceurl" => "audio_source_url",
-    "ls:radiostationurl" => "radio_station_url",
-    "ls:buycdurl" => "buy_this_url",
-    "ls:isrcnumber" => "isrc_number",
-    "ls:catalognumber" => "catalog_number",
-    "ls:originalartist" => "original_artist",
-    "dc:rights" => "copyright",
-    "dcterms:temporal" => "report_datetime",
-    "dcterms:spatial" => "report_location",
-    "dcterms:entity" => "report_organization",
-    "dc:subject" => "subject",
-    "dc:contributor" => "contributor",
-    "dc:language" => "language");
-
-/**
- * Track numbers in metadata tags can come in many formats:
- * "1 of 20", "1/20", "20/1".  This function parses the track
- * number and gets the real number so that we can sort by it
- * in the database.
- *
- * @param string $p_trackNumber
- * @return int
- */
-function camp_parse_track_number($p_trackNumber)
-{
-    $num = trim($p_trackNumber);
-    if (!is_numeric($num)) {
-        $matches = preg_match("/\s*([0-9]+)([^0-9]*)([0-9]*)\s*/", $num, $results);
-        $trackNum = 0;
-        foreach ($results as $result) {
-            if (is_numeric($result)) {
-                if ($trackNum == 0) {
-                    $trackNum = $result;
-                } elseif ($result < $trackNum) {
-                    $trackNum = $result;
-                }
-            }
-        }
-    } else {
-        $trackNum = $num;
-    }
-    return $trackNum;
-}
-
-
-/**
- * Add data to the global array $mdata, also sets global variables
- * $titleHaveSet and $titleKey.
- *
- * Converts the given string ($val) into UTF-8.
- *
- * @param array $p_mdata
- * 		The array to add the metadata to.
- * @param string $p_key
- * 		Metadata key.
- * @param string $p_val
- * 		Metadata value.
- * @param string $p_inputEncoding
- * 		Encoding type of the input value.
- */
-function camp_add_metadata(&$p_mdata, $p_key, $p_val, $p_inputEncoding='iso-8859-1')
-{
-    if (!is_null($p_val)) {
-        $data = $p_val;
-        $outputEncoding = 'UTF-8';
-        //if (function_exists('iconv') && ($p_inputEncoding != $outputEncoding) ) {
-        if (function_exists('iconv') && is_string($p_val)) {
-            $newData = @iconv($p_inputEncoding, $outputEncoding, $data);
-            if ($newData === FALSE) {
-                echo "Warning: convert $key data to unicode failed\n";
-            } elseif ($newData != $data) {
-                echo "Converted string: '$data' (".gettype($data).") -> '$newData' (".gettype($newData).").\n";
-                $data = $newData;
-            }
-        }
-        $p_mdata[$p_key] = trim($data);
-    }
-}
-
-
-/**
- * Return an array with the given audio file's ID3 tags.  The keys in the
- * array can be:
- * 
- * 		dc:format ("mime type")
- * 		dcterms:extent ("duration")
- * 		dc:title
- * 		dc:creator ("artist")
- * 		dc:source ("album")
- *      dc:type ("genre")
- * 		ls:bitrate
- * 		ls:encoded_by
- * 		ls:track_num
- * 		ls:channels
- * 		ls:year
- * 		ls:filename
- * 
- * - * @param string $p_filename - * @param boolean $p_testonly - * For diagnostic and debugging purposes - setting this to TRUE - * will print out the values found in the file and the ones assigned - * to the return array. - * @return array|PEAR_Error - */ -function camp_get_audio_metadata($p_filename, $p_testonly = false) -{ - $getID3 = new getID3(); - $infoFromFile = $getID3->analyze($p_filename); - if (PEAR::isError($infoFromFile)) { - return $infoFromFile; - } - if (isset($infoFromFile['error'])) { - return new PEAR_Error(array_pop($infoFromFile['error'])); - } - if (!$infoFromFile['bitrate']) { - return new PEAR_Error("File given is not an audio file."); - } - - if ($p_testonly) { - print_r($infoFromFile); - } - $titleKey = 'dc:title'; - $flds = array( - 'dc:format' => array( - array('path'=>"['mime_type']", 'ignoreEnc'=>TRUE), - ), - 'ls:bitrate' => array( - array('path'=>"['bitrate']", 'ignoreEnc'=>TRUE), - array('path'=>"['audio']['bitrate']", 'ignoreEnc'=>TRUE), - ), - 'ls:samplerate' => array( - array('path'=>"['audio']['sample_rate']", 'ignoreEnc'=>TRUE), - ), - 'ls:encoder' => array( - array('path'=>"['audio']['codec']", 'ignoreEnc'=>TRUE), - ), - 'dcterms:extent'=> array( - array('path'=>"['playtime_seconds']", 'ignoreEnc'=>TRUE), - ), - 'ls:composer'=> array( - array('path'=>"['id3v2']['comments']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - array('path'=>"['id3v2']['TCOM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['id3v2']['composer']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - array('path'=>"['ogg']['comments']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['composer']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'dc:description'=> array( - array('path'=>"['id3v1']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['comments']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - array('path'=>"['id3v2']['COMM'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['id3v2']['comments']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - array('path'=>"['ogg']['comments']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['comment']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'dc:type'=> array( - array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'dc:title' => array( - array('path'=>"['id3v2']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TIT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TT2'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v1']", 'dataPath'=>"['title']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['title']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'dc:creator' => array( - array('path'=>"['id3v2']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TPE1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TP1'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v1']", 'dataPath'=>"['artist']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['artist']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'dc:source' => array( - array('path'=>"['id3v2']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TALB'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TAL'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['album']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'ls:encoded_by' => array( - array('path'=>"['id3v2']['TENC'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TEN'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['encoded-by']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'ls:track_num' => array( - array('path'=>"['id3v2']['TRCK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['id3v2']['TRK'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - // 'ls:genre' => array( - // array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"), - // array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"), - // array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE), - // array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - // array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - // ), - 'ls:channels' => array( - array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE), - ), - 'ls:year' => array( - array('path'=>"['comments']['date']"), - array('path'=>"['ogg']['comments']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - array('path'=>"['tags']['vorbiscomment']['date']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), - ), - 'ls:filename' => array( - array('path'=>"['filename']"), - ), - ); - $mdata = array(); - if (isset($infoFromFile['audio'])) { - $mdata['audio'] = $infoFromFile['audio']; - } - if (isset($infoFromFile['playtime_seconds'])) { - $mdata['playtime_seconds'] = $infoFromFile['playtime_seconds']; - } - - $titleHaveSet = FALSE; - foreach ($flds as $key => $getid3keys) { - foreach ($getid3keys as $getid3key) { - $path = $getid3key["path"]; - $ignoreEnc = isset($getid3key["ignoreEnc"])? - $getid3key["ignoreEnc"]:FALSE; - $dataPath = isset($getid3key["dataPath"])?$getid3key["dataPath"]:""; - $encPath = isset($getid3key["encPath"])?$getid3key["encPath"]:""; - $enc = "UTF-8"; - - $tagElement = "\$infoFromFile$path$dataPath"; - eval("\$tagExists = isset($tagElement);"); - if ($tagExists) { - //echo "ignore encoding: ".($ignoreEnc?"yes":"no")."\n"; - //echo "tag exists\n"; - //echo "encode path: $encPath\n"; - eval("\$data = $tagElement;"); - if (!$ignoreEnc && $encPath != "") { - $encodedElement = "\$infoFromFile$path$encPath"; - eval("\$encodedElementExists = isset($encodedElement);"); - if ($encodedElementExists) { - eval("\$enc = $encodedElement;"); - } - } - - // Special case handling for track number - if ($key == "ls:track_num") { - $data = camp_parse_track_number($data); - } - camp_add_metadata($mdata, $key, $data, $enc); - if ($key == $titleKey) { - $titleHaveSet = TRUE; - } - break; - } - } - } - if ($p_testonly) { - var_dump($mdata); - } - - if (!$titleHaveSet || trim($mdata[$titleKey]) == '') { - camp_add_metadata($mdata, $titleKey, basename($p_filename)); - } - return $mdata; -} - - -/** - * StoredFile class - * - * Campcaster file storage support class.
- * Represents one virtual file in storage. Virtual file has up to two parts: - *
    - *
  • metadata in database - represented by MetaData class
  • - *
  • binary media data in real file
  • - *
- * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @see MetaData - */ -class StoredFile { - - // *** Variables stored in the database *** - - /** - * @var int - */ - private $id; - - /** - * Unique ID for the file. This is stored in HEX format. It is - * converted to a bigint whenever it is used in a database call. - * - * @var string - */ - public $gunid; - - /** - * The unique ID of the file as it is stored in the database. - * This is for debugging purposes and may not always exist in this - * class. - * - * @var string - */ - //private $gunidBigint; - - /** - * @var string - */ - private $name; - - /** - * @var string - */ - private $mime; - - /** - * Can be 'audioclip'...others might be coming, like webstream. - * - * @var string - */ - private $ftype; - - /** - * Can be 'ready', 'edited', 'incomplete'. - * - * @var string - */ - private $state; - - /** - * @var int - */ - private $currentlyaccessing; - - /** - * @var int - */ - private $editedby; - - /** - * @var timestamp - */ - private $mtime; - - /** - * @var string - */ - private $md5; - - /** - * @var string - */ - private $filepath; - - - // *** Variables NOT stored in the database *** - - /** - * Directory where the file is located. - * - * @var string - */ - private $resDir; - - /** - * @var boolean - */ - private $exists; - - /** - * @var MetaData - */ - public $md; - - /* ========================================================== constructor */ - /** - * Constructor, but shouldn't be externally called - * - * @param string $p_gunid - * globally unique id of file - */ - public function __construct($p_gunid=NULL) - { - $this->gunid = $p_gunid; - if (empty($this->gunid)) { - $this->gunid = StoredFile::generateGunid(); - } - else { - $this->loadMetadata(); - $this->exists = is_file($this->filepath) && is_readable($this->filepath); - } - } - - /** - * For testing only, do not use. - */ - public function __setGunid($p_guid) { - $this->gunid = $p_guid; - } - - /** - * Convert XML name to database column name. Used for backwards compatibility - * with old code. - * - * @param string $p_category - * @return string|null - */ - public static function xmlCategoryToDbColumn($p_category) - { - global $g_metadata_xml_to_db_mapping; - if (array_key_exists($p_category, $g_metadata_xml_to_db_mapping)) { - return $g_metadata_xml_to_db_mapping[$p_category]; - } - return null; - } - - - /** - * Convert database column name to XML name. - * - * @param string $p_dbColumn - * @return string|null - */ - public static function dbColumnToXmlCatagory($p_dbColumn) - { - global $g_metadata_xml_to_db_mapping; - $str = array_search($p_dbColumn, $g_metadata_xml_to_db_mapping); - // make return value consistent with xmlCategoryToDbColumn() - if ($str === FALSE) { - $str = null; - } - return $str; - } - - - /** - * GUNID needs to be set before you call this function. - * - */ - public function loadMetadata() - { - global $CC_CONFIG, $CC_DBC; - $escapedValue = pg_escape_string($this->gunid); - $sql = "SELECT * FROM ".$CC_CONFIG["filesTable"] - ." WHERE gunid='$escapedValue'"; - //var_dump($sql); - $this->md = $CC_DBC->getRow($sql); - //var_dump($this->md); - if (PEAR::isError($this->md)) { - $error = $this->md; - $this->md = null; - return $error; - } - $this->filepath = $this->md["filepath"]; - if (is_null($this->md)) { - $this->md = array(); - return; - } - $compatibilityData = array(); - foreach ($this->md as $key => $value) { - if ($xmlName = StoredFile::dbColumnToXmlCatagory($key)) { - $compatibilityData[$xmlName] = $value; - } - } - //var_dump($compatibilityData); - $this->md = array_merge($this->md, $compatibilityData); - //var_dump($this->md); - //$_SESSION["debug"] = $this->md; - } - - public function setFormat($p_value) - { - $this->md["format"] = $p_value; - } - - public function replaceMetadata($p_values) - { - global $CC_CONFIG, $CC_DBC; - foreach ($p_values as $category => $value) { - $escapedValue = pg_escape_string($value); - $columnName = StoredFile::xmlCategoryToDbColumn($category); - if (!is_null($columnName)) { - $sql = "UPDATE ".$CC_CONFIG["filesTable"] - ." SET $columnName='$escapedValue'" - ." WHERE gunid = '".$this->gunid."'"; - $CC_DBC->query($sql); - } - } - $this->loadMetadata(); - } - - public function clearMetadata() - { - $metadataColumns = array("format", "bit_rate", "sample_rate", "length", - "track_title", "comments", "genre", "artist_name", "channels", "name", - "year", "url", "track_number"); - foreach ($metadataColumns as $columnName) { - if (!is_null($columnName)) { - $sql = "UPDATE ".$CC_CONFIG["filesTable"] - ." SET $columnName=''" - ." WHERE gunid = '".$this->gunid."'"; - $CC_DBC->query($sql); - } - } - } - - - /* ========= 'factory' methods - should be called to construct StoredFile */ - /** - * Create instance of StoredFile object and insert new file - * - * @param array $p_values - * "filepath" - required, local path to media file (where it is before import) - * "id" - optional, local object id, will be generated if not given - * "gunid" - optional, unique id, for insert file with gunid, will be generated if not given - * "filename" - optional, will use "filepath" if not given - * "metadata" - optional, array of extra metadata, will be automatically calculated if not given. - * "mime" - optional, MIME type, highly recommended to pass in, will be automatically calculated if not given. - * "md5" - optional, MD5 sum, highly recommended to pass in, will be automatically calculated if not given. - * - * @param boolean $p_copyMedia - * copy the media file if true, make symlink if false - * - * @return StoredFile|NULL|PEAR_Error - */ - public static function Insert($p_values, $p_copyMedia=TRUE) - { - global $CC_CONFIG, $CC_DBC; - - if (!isset($p_values["filepath"])) { - return new PEAR_Error("StoredFile::Insert: filepath not set."); - } - if (!file_exists($p_values['filepath'])) { - return PEAR::raiseError("StoredFile::Insert: ". - "media file not found ({$p_values['filepath']})"); - } - - $gunid = isset($p_values['gunid'])?$p_values['gunid']:NULL; - - // Create the StoredFile object - $storedFile = new StoredFile($gunid); - - // Get metadata - if (isset($p_values["metadata"])) { - $metadata = $p_values['metadata']; - } else { - $metadata = camp_get_audio_metadata($p_values["filepath"]); - } - - $storedFile->name = isset($p_values['filename']) ? $p_values['filename'] : $p_values["filepath"]; - $storedFile->id = isset($p_values['id']) && is_integer($p_values['id'])?(int)$p_values['id']:null; - // NOTE: POSTGRES-SPECIFIC KEYWORD "DEFAULT" BEING USED, WOULD BE "NULL" IN MYSQL - $sqlId = !is_null($storedFile->id)?"'".$storedFile->id."'":'DEFAULT'; - $storedFile->ftype = isset($p_values['filetype']) ? strtolower($p_values['filetype']) : "audioclip"; - $storedFile->mime = (isset($p_values["mime"]) ? $p_values["mime"] : NULL ); - // $storedFile->filepath = $p_values['filepath']; - if (isset($p_values['md5'])) { - $storedFile->md5 = $p_values['md5']; - } elseif (file_exists($p_values['filepath'])) { - //echo "StoredFile::Insert: WARNING: Having to recalculate MD5 value\n"; - $storedFile->md5 = md5_file($p_values['filepath']); - } - - // Check for duplicates -- return duplicate - $duplicate = StoredFile::RecallByMd5($storedFile->md5); - if ($duplicate) { - return $duplicate; - } - - $storedFile->exists = FALSE; - - // Insert record into the database - $escapedName = pg_escape_string($storedFile->name); - $escapedFtype = pg_escape_string($storedFile->ftype); - $sql = "INSERT INTO ".$CC_CONFIG['filesTable'] - ."(id, name, gunid, mime, state, ftype, mtime, md5)" - ."VALUES ({$sqlId}, '{$escapedName}', " - ." '{$storedFile->gunid}'," - ." '{$storedFile->mime}', 'incomplete', '$escapedFtype'," - ." now(), '{$storedFile->md5}')"; - //$_SESSION["debug"] .= "sql: ".$sql."
"; - //echo $sql."\n"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - $CC_DBC->query("ROLLBACK"); - return $res; - } - - if (!is_integer($storedFile->id)) { - // NOTE: POSTGRES-SPECIFIC - $sql = "SELECT currval('".$CC_CONFIG["filesSequence"]."_seq')"; - $storedFile->id = $CC_DBC->getOne($sql); - } - $storedFile->setMetadataBatch($metadata); - - // Save media file - $res = $storedFile->addFile($p_values['filepath'], $p_copyMedia); - if (PEAR::isError($res)) { - echo "StoredFile::Insert -- addFile(): '".$res->getMessage()."'\n"; - return $res; - } - - if (empty($storedFile->mime)) { - //echo "StoredFile::Insert: WARNING: Having to recalculate MIME value\n"; - $storedFile->setMime($storedFile->getMime()); - } - - // Save state - $storedFile->setState('ready'); - - // Recall the object to get all the proper values - $storedFile = StoredFile::RecallByGunid($storedFile->gunid); - return $storedFile; - } - - /** - * Fetch instance of StoreFile object.
- * Should be supplied with only ONE parameter, all the rest should - * be NULL. - * - * @param int $p_id - * local id - * @param string $p_gunid - * global unique id of file - * @param string $p_md5sum - * MD5 sum of the file - * @return StoredFile|Playlist|NULL - * Return NULL if the object doesnt exist in the DB. - */ - public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null) - { - global $CC_DBC; - global $CC_CONFIG; - if (!is_null($p_id)) { - $cond = "id='".intval($p_id)."'"; - } elseif (!is_null($p_gunid)) { - $cond = "gunid='$p_gunid'"; - } elseif (!is_null($p_md5sum)) { - $cond = "md5='$p_md5sum'"; - } else { - return null; - } - $sql = "SELECT *" - ." FROM ".$CC_CONFIG['filesTable'] - ." WHERE $cond"; - //echo $sql; - $row = $CC_DBC->getRow($sql); - if (PEAR::isError($row) || is_null($row)) { - return $row; - } - $gunid = $row['gunid']; - $storedFile = new StoredFile($gunid); - $storedFile->id = $row['id']; - $storedFile->name = $row['name']; - $storedFile->mime = $row['mime']; - $storedFile->ftype = $row['ftype']; - $storedFile->state = $row['state']; - $storedFile->currentlyaccessing = $row['currentlyaccessing']; - $storedFile->editedby = $row['editedby']; - $storedFile->mtime = $row['mtime']; - $storedFile->md5 = $row['md5']; - $storedFile->filepath = $row['filepath']; - $storedFile->exists = TRUE; - $storedFile->setFormat($row['ftype']); - return $storedFile; - } - - - /** - * Create instance of StoreFile object and recall existing file - * by gunid. - * - * @param string $p_gunid - * global unique id of file - * @return StoredFile - */ - public static function RecallByGunid($p_gunid='') - { - return StoredFile::Recall(null, $p_gunid); - } - - - /** - * Fetch the StoredFile by looking up the MD5 value. - * - * @param string $p_md5sum - * @return StoredFile|NULL|PEAR_Error - */ - public static function RecallByMd5($p_md5sum) - { - return StoredFile::Recall(null, null, $p_md5sum); - } - - - /** - * Create instance of StoreFile object and recall existing file - * by access token. - * - * @param string $p_token - * access token - * @return StoredFile - */ - public static function RecallByToken($p_token) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT gunid" - ." FROM ".$CC_CONFIG['accessTable'] - ." WHERE token=x'$p_token'::bigint"; - $gunid = $CC_DBC->getOne($sql); - if (PEAR::isError($gunid)) { - return $gunid; - } - if (is_null($gunid)) { - return PEAR::raiseError( - "StoredFile::RecallByToken: invalid token ($p_token)", GBERR_AOBJNEX); - } - return StoredFile::Recall(null, $gunid); - } - - - /** - * Generate the location to store the file. - * It creates the subdirectory if needed. - */ - private function generateFilePath() - { - global $CC_CONFIG, $CC_DBC; - $resDir = $CC_CONFIG['storageDir']."/".substr($this->gunid, 0, 3); - // see Transport::_getResDir too for resDir name create code - if (!is_dir($resDir)) { - mkdir($resDir, 02775); - chmod($resDir, 02775); - } - $info = pathinfo($this->name); - $fileExt = strtolower($info["extension"]); - return "{$resDir}/{$this->gunid}.{$fileExt}"; - } - - /** - * Insert media file to filesystem - * - * @param string $p_localFilePath - * local path - * @param boolean $p_copyMedia - * copy the media file if true, make symlink if false - * @return TRUE|PEAR_Error - */ - public function addFile($p_localFilePath, $p_copyMedia=TRUE) - { - global $CC_CONFIG, $CC_DBC; - if ($this->exists) { - return FALSE; - } - // for files downloaded from remote instance: - if ($p_localFilePath == $this->filepath) { - $this->exists = TRUE; - return TRUE; - } - umask(0002); - $dstFile = ''; - if ($p_copyMedia) { - $dstFile = $this->generateFilePath(); - $r = @copy($p_localFilePath, $dstFile); - if (!$r) { - $this->exists = FALSE; - return PEAR::raiseError( - "StoredFile::addFile: file save failed". - " ($p_localFilePath, {$this->filepath})",GBERR_FILEIO - ); - } - } else { - $dstFile = $p_localFilePath; - $r = TRUE; - //$r = @symlink($p_localFilePath, $dstFile); - } - $this->filepath = $dstFile; - $sqlPath = pg_escape_string($this->filepath); - $sql = "UPDATE ".$CC_CONFIG["filesTable"] - ." SET filepath='{$sqlPath}'" - ." WHERE id={$this->id}"; - //echo $sql."\n"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $this->exists = TRUE; - return TRUE; - } - - - /** - * Find and return the first exact match for the original file name - * that was used on import. - * @param string $p_name - */ - public static function findByOriginalName($p_name) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT id FROM ".$CC_CONFIG["filesTable"] - ." WHERE name='".pg_escape_string($p_name)."'"; - $id = $CC_DBC->getOne($sql); - if (is_numeric($id)) { - return StoredFile::Recall($id); - } else { - return NULL; - } - } - - - /** - * Delete and insert media file - * - * @param string $p_localFilePath - * local path - * @return TRUE|PEAR_Error - */ - public function replaceFile($p_localFilePath) - { - // Dont do anything if the source and destination files are - // the same. - if ($this->name == $p_localFilePath) { - return TRUE; - } - - if ($this->exists) { - $r = $this->deleteFile(); - if (PEAR::isError($r)) { - return $r; - } - } - return $this->addFile($p_localFilePath); - } - - - /** - * Return true if file corresponding to the object exists - * - * @return boolean - */ - public function existsFile() - { - return $this->exists; - } - - - /** - * Delete media file from filesystem. - * You cant delete a file if it is being accessed. - * You cant delete a file if it is scheduled to be played in the future. - * The file will be removed from all playlists it is a part of. - * - * @return boolean|PEAR_Error - */ - public function deleteFile() - { - global $CC_CONFIG; - if (!$this->exists) { - return FALSE; - } - if ($this->isAccessed()) { - return PEAR::raiseError( - 'Cannot delete a file that is currently accessed.' - ); - } - - // Check if the file is scheduled to be played in the future - if (Schedule::IsFileScheduledInTheFuture($this->id)) { - return PEAR::raiseError( - 'Cannot delete a file that is scheduled in the future.' - ); - } - - // Delete it from all playlists - //Playlist::DeleteFileFromAllPlaylists($this->id); - - // Only delete the file from filesystem if it has been copied to the - // storage directory. (i.e. dont delete linked files) - if (substr($this->filepath, 0, strlen($CC_CONFIG["storageDir"])) == $CC_CONFIG["storageDir"]) { - // Delete the file - if (!file_exists($this->filepath) || @unlink($this->filepath)) { - $this->exists = FALSE; - return TRUE; - } else { - return PEAR::raiseError( - "StoredFile::deleteFile: unlink failed ({$this->filepath})", - GBERR_FILEIO - ); - } - } else { - $this->exists = FALSE; - return TRUE; - } - } - - - /** - * Analyze file with getid3 module.
- * Obtain some metadata stored in media file.
- * This method should be used for prefilling metadata input form. - * - * @return array - * hierarchical hasharray with information about media file - */ - public function analyzeFile() - { - if (!$this->exists) { - return FALSE; - } - $ia = camp_get_audio_metadata($this->filepath); - return $ia; - } - - - /** - * Create instance of StoredFile object and make copy of existing file - * - * @param StoredFile $p_src - * source object - * @param int $p_nid - * new local id - * @return StoredFile - */ - public static function CopyOf(&$p_src, $p_nid) - { - $values = array( - "id" => $p_nid, - "filename" => $p_src->name, - "filepath" => $p_src->getRealFilePath(), - "filetype" => $p_src->getType() - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - $storedFile->replaceMetadata($p_src->getAllMetadata(), 'string'); - return $storedFile; - } - - - /** - * Replace existing file with new data. - * - * @param int $p_oid - * NOT USED - * @param string $p_name - * name of file - * @param string $p_localFilePath - * local path to media file - * @param string $p_metadata - * local path to metadata XML file or XML string - * @param string $p_mdataLoc - * 'file'|'string' - * @return TRUE|PEAR_Error - */ - // public function replace($p_oid, $p_name, $p_localFilePath='', $p_metadata='', - // $p_mdataLoc='file') - // { - // global $CC_CONFIG, $CC_DBC; - // $CC_DBC->query("BEGIN"); - // $res = $this->setName($p_name); - // if (PEAR::isError($res)) { - // $CC_DBC->query("ROLLBACK"); - // return $res; - // } - // if ($p_localFilePath != '') { - // $res = $this->setRawMediaData($p_localFilePath); - // } else { - // $res = $this->deleteFile(); - // } - // if (PEAR::isError($res)) { - // $CC_DBC->query("ROLLBACK"); - // return $res; - // } - // if ($p_metadata != '') { - // $res = $this->setMetadata($p_metadata, $p_mdataLoc); - // } else { - //// $res = $this->md->delete(); - // $res = $this->clearMetadata(); - // } - // if (PEAR::isError($res)) { - // $CC_DBC->query("ROLLBACK"); - // return $res; - // } - // $res = $CC_DBC->query("COMMIT"); - // if (PEAR::isError($res)) { - // $CC_DBC->query("ROLLBACK"); - // return $res; - // } - // return TRUE; - // } - - - /** - * Increase access counter, create access token, insert access record. - * - * @param int $parent - * parent token - * @return array - * array with: access URL, access token - */ - public function accessRawMediaData($p_parent='0') - { - $realFname = $this->getRealFilePath(); - $ext = $this->getFileExtension(); - $res = BasicStor::bsAccess($realFname, $ext, $this->gunid, 'access', $p_parent); - if (PEAR::isError($res)) { - return $res; - } - $resultArray = - array('url'=>"file://{$res['fname']}", 'token'=>$res['token']); - return $resultArray; - } - - - /** - * Decrease access couter, delete access record. - * - * @param string $p_token - * access token - * @return boolean - */ - public function releaseRawMediaData($p_token) - { - $res = BasicStor::bsRelease($p_token); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Replace media file only with new binary file - * - * @param string $p_localFilePath - * local path to media file - * @return TRUE|PEAR_Error - */ - public function setRawMediaData($p_localFilePath) - { - $res = $this->replaceFile($p_localFilePath); - if (PEAR::isError($res)) { - return $res; - } - $mime = $this->getMime(); - if ($mime !== FALSE) { - $res = $this->setMime($mime); - if (PEAR::isError($res)) { - return $res; - } - } - // $r = $this->md->regenerateXmlFile(); - // if (PEAR::isError($r)) { - // return $r; - // } - return TRUE; - } - - - private static function NormalizeExtent($v) - { - if (!preg_match("|^\d{2}:\d{2}:\d{2}.\d{6}$|", $v)) { - $s = Playlist::playlistTimeToSeconds($v); - $t = Playlist::secondsToPlaylistTime($s); - return $t; - } - return $v; - } - - - /** - * Replace metadata with new XML file - * - * @param string $p_metadata - * local path to metadata XML file or XML string - * @param string $p_mdataLoc - * 'file'|'string' - * @param string $p_format - * metadata format for validation - * ('audioclip' | 'playlist' | 'webstream' | NULL) - * (NULL = no validation) - * @return boolean - */ - // public function setMetadata($p_metadata, $p_mdataLoc='file', $p_format=NULL) - // { - // global $CC_CONFIG, $CC_DBC; - // $CC_DBC->query("BEGIN"); - // $res = $this->md->replace($p_metadata, $p_mdataLoc, $p_format); - // if (PEAR::isError($res)) { - // $CC_DBC->query("ROLLBACK"); - // return $res; - // } - // $res = $CC_DBC->query("COMMIT"); - // if (PEAR::isError($res)) { - // return $res; - // } - // return TRUE; - // } - - /** - * Set metadata element value - * - * @param string $category - * Metadata element identification (e.g. dc:title) - * @param string $value - * value to store, if NULL then delete record - * @return boolean - */ - public function setMetadataValue($p_category, $p_value) - { - global $CC_CONFIG, $CC_DBC; - if (!is_string($p_category) || is_array($p_value)) { - return FALSE; - } - if ($p_category == 'dcterms:extent') { - $p_value = StoredFile::NormalizeExtent($p_value); - } - $columnName = StoredFile::xmlCategoryToDbColumn($p_category); // Get column name - - if (!is_null($columnName)) { - $escapedValue = pg_escape_string($p_value); - $sql = "UPDATE ".$CC_CONFIG["filesTable"] - ." SET $columnName='$escapedValue'" - ." WHERE id={$this->id}"; - //var_dump($sql); - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - } - return TRUE; - } - - - /** - * Set metadata values in 'batch' mode - * - * @param array $values - * array of key/value pairs - * (e.g. 'dc:title'=>'New title') - * @return boolean - */ - public function setMetadataBatch($values) - { - global $CC_CONFIG, $CC_DBC; - if (!is_array($values)) { - $values = array($values); - } - if (count($values) == 0) { - return true; - } - foreach ($values as $category => $oneValue) { - $columnName = StoredFile::xmlCategoryToDbColumn($category); - if (!is_null($columnName)) { - if ($category == 'dcterms:extent') { - $oneValue = StoredFile::NormalizeExtent($oneValue); - } - // Since track_number is an integer, you cannot set - // it to be the empty string, so we NULL it instead. - if ($columnName == 'track_number' && empty($oneValue)) { - $sqlPart = "$columnName = NULL"; - } elseif (($columnName == 'length') && (strlen($oneValue) > 8)) { - // Postgres doesnt like it if you try to store really large hour - // values. TODO: We need to fix the underlying problem of getting the - // right values. - $parts = explode(':', $oneValue); - $hour = intval($parts[0]); - if ($hour > 24) { - continue; - } else { - $sqlPart = "$columnName = '$oneValue'"; - } - } else { - $escapedValue = pg_escape_string($oneValue); - $sqlPart = "$columnName = '$escapedValue'"; - } - $sqlValues[] = $sqlPart; - } - } - if (count($sqlValues)==0) { - return TRUE; - } - $sql = "UPDATE ".$CC_CONFIG["filesTable"] - ." SET ".join(",", $sqlValues) - ." WHERE id={$this->id}"; - $CC_DBC->query($sql); - return TRUE; - } - - - /** - * Get metadata as array, indexed by the column names in the database. - * - * @return array - */ - public function getMetadata() - { - return $this->md; - } - - /** - * Get one metadata value. - * - * @param string $p_name - * @return string - */ - public function getMetadataValue($p_name) - { - if (isset($this->md[$p_name])){ - return $this->md[$p_name]; - } else { - return ""; - } - } - - /** - * Rename stored virtual file - * - * @param string $p_newname - * @return TRUE|PEAR_Error - */ - public function setName($p_newname) - { - global $CC_CONFIG, $CC_DBC; - $escapedName = pg_escape_string($p_newname); - $sql = "UPDATE ".$CC_CONFIG['filesTable'] - ." SET name='$escapedName', mtime=now()" - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $this->name = $p_newname; - return TRUE; - } - - - /** - * Set state of virtual file - * - * @param string $p_state - * 'empty'|'incomplete'|'ready'|'edited' - * @param int $p_editedby - * user id | 'NULL' for clear editedBy field - * @return TRUE|PEAR_Error - */ - public function setState($p_state, $p_editedby=NULL) - { - global $CC_CONFIG, $CC_DBC; - $escapedState = pg_escape_string($p_state); - $eb = (!is_null($p_editedby) ? ", editedBy=$p_editedby" : ''); - $sql = "UPDATE ".$CC_CONFIG['filesTable'] - ." SET state='$escapedState'$eb, mtime=now()" - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $this->state = $p_state; - $this->editedby = $p_editedby; - return TRUE; - } - - /** - * Set mime-type of virtual file - * - * @param string $p_mime - * mime-type - * @return boolean|PEAR_Error - */ - public function setMime($p_mime) - { - global $CC_CONFIG, $CC_DBC; - if (!is_string($p_mime)) { - $p_mime = 'application/octet-stream'; - } - $escapedMime = pg_escape_string($p_mime); - $sql = "UPDATE ".$CC_CONFIG['filesTable'] - ." SET mime='$escapedMime', mtime=now()" - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $this->mime = $p_mime; - return TRUE; - } - - - /** - * Set md5 of virtual file - * - * @param string $p_md5sum - * @return boolean|PEAR_Error - */ - public function setMd5($p_md5sum) - { - global $CC_CONFIG, $CC_DBC; - $escapedMd5 = pg_escape_string($p_md5sum); - $sql = "UPDATE ".$CC_CONFIG['filesTable'] - ." SET md5='$escapedMd5', mtime=now()" - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $this->md5 = $p_md5sum; - return TRUE; - } - - - /** - * Delete stored virtual file - * - * @param boolean $p_deleteFile - * - * @return TRUE|PEAR_Error - */ - public function delete($p_deleteFile = true) - { - global $CC_CONFIG, $CC_DBC; - if ($p_deleteFile) { - $res = $this->deleteFile(); - if (PEAR::isError($res)) { - return $res; - } - } - $sql = "SELECT to_hex(token)as token, ext " - ." FROM ".$CC_CONFIG['accessTable'] - ." WHERE gunid='{$this->gunid}'"; - $tokens = $CC_DBC->getAll($sql); - if (is_array($tokens)) { - foreach ($tokens as $i => $item) { - $file = $this->_getAccessFileName($item['token'], $item['ext']); - if (file_exists($file)) { - @unlink($file); - } - } - } - $sql = "DELETE FROM ".$CC_CONFIG['accessTable'] - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - $sql = "DELETE FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='{$this->gunid}'"; - $res = $CC_DBC->query($sql); - if (PEAR::isError($res)) { - return $res; - } - return TRUE; - } - - - /** - * Returns an array of playlist objects that this file is a part of. - * @return array - */ - public function getPlaylists() { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT playlist_id " - ." FROM ".$CC_CONFIG['playistTable'] - ." WHERE file_id='{$this->id}'"; - $ids = $CC_DBC->getAll($sql); - $playlists = array(); - if (is_array($ids) && count($ids) > 0) { - foreach ($ids as $id) { - $playlists[] = Playlist::Recall($id); - } - } - return $playlists; - } - - - /** - * Returns true if virtual file is currently in use.
- * Static or dynamic call is possible. - * - * @param string $p_gunid - * optional (for static call), global unique id - * @return boolean|PEAR_Error - */ - public function isAccessed($p_gunid=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (is_null($p_gunid)) { - return ($this->currentlyaccessing > 0); - } - $sql = "SELECT currentlyAccessing FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='$p_gunid'"; - $ca = $CC_DBC->getOne($sql); - if (is_null($ca)) { - return PEAR::raiseError( - "StoredFile::isAccessed: invalid gunid ($p_gunid)", - GBERR_FOBJNEX - ); - } - return ($ca > 0); - } - - - /** - * Returns true if virtual file is edited - * - * @param string $p_playlistId - * playlist global unique ID - * @return boolean - */ - public function isEdited($p_playlistId=NULL) - { - if (is_null($p_playlistId)) { - return ($this->state == 'edited'); - } - $state = $this->getState($p_playlistId); - if ($state != 'edited') { - return FALSE; - } - return TRUE; - } - - - /** - * Returns id of user editing playlist - * - * @param string $p_playlistId - * playlist global unique ID - * @return int|null|PEAR_Error - * id of user editing it - */ - public function isEditedBy($p_playlistId=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (is_null($p_playlistId)) { - $p_playlistId = $this->gunid; - } - $sql = "SELECT editedBy FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='$p_playlistId'"; - $ca = $CC_DBC->getOne($sql); - if (PEAR::isError($ca)) { - return $ca; - } - if (is_null($ca)) { - return $ca; - } - return intval($ca); - } - - - /** - * Return local ID of virtual file. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - - /** - * Return global ID of virtual file. - * - * @return string - */ - public function getGunid() - { - return $this->gunid; - } - - - /** - * Returns true if raw media file exists - * @return boolean|PEAR_Error - */ - public function exists() - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT gunid " - ." FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='{$this->gunid}'"; - $indb = $CC_DBC->getRow($sql); - if (PEAR::isError($indb)) { - return $indb; - } - if (is_null($indb)) { - return FALSE; - } - if ($this->ftype == 'audioclip') { - return $this->existsFile(); - } - return TRUE; - } - - - /** - * Create new global unique id - * @return string - */ - public static function generateGunid() - { - return md5(uniqid("", true)); - - // $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''); - // $initString = microtime().$ip.rand(); - // $hash = md5($initString); - // // non-negative int8 - // $hsd = substr($hash, 0, 1); - // $res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15); - // return StoredFile::NormalizeGunid($res); - } - - - /** - * Pad the gunid with zeros if it isnt 16 digits. - * - * @return string - */ - // public static function NormalizeGunid($p_gunid) - // { - // return str_pad($p_gunid, 16, "0", STR_PAD_LEFT); - // } - - - /** - * Return suitable extension. - * - * @todo make it general - is any tool for it? - * - * @return string - * file extension without a dot - */ - public function getFileExtension() - { - $fname = $this->getName(); - $pos = strrpos($fname, '.'); - if ($pos !== FALSE) { - $ext = substr($fname, $pos+1); - if ($ext !== FALSE) { - return $ext; - } - } - switch (strtolower($this->mime)) { - case "audio/mpeg": - $ext = "mp3"; - break; - case "audio/x-wav": - case "audio/x-wave": - $ext = "wav"; - break; - case "audio/x-ogg": - case "application/x-ogg": - $ext = "ogg"; - break; - default: - $ext = "bin"; - break; - } - return $ext; - } - - - /** - * Get mime-type stored in the file. - * Warning: this function is slow! - * - * @return string - */ - public function getMime() - { - $a = $this->analyzeFile(); - if (PEAR::isError($a)) { - return $a; - } - if (isset($a['dc:format'])) { - return $a['dc:format']; - } - return ''; - } - - - /** - * Convenience function. - * @return string - */ - public function getTitle() - { - return $this->md["title"]; - } - - public function getType() - { - return $this->ftype; - } - - /** - * Get storage-internal file state - * - * @param string $p_gunid - * global unique id of file - * @return string - * see install() - */ - public function getState($p_gunid=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (is_null($p_gunid)) { - return $this->state; - } - $sql = "SELECT state FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='$p_gunid'"; - return $CC_DBC->getOne($sql); - } - - - /** - * Get mnemonic file name - * - * @param string $p_gunid - * global unique id of file - * @return string - */ - public function getName($p_gunid=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (is_null($p_gunid)) { - return $this->name; - } - $sql = "SELECT name FROM ".$CC_CONFIG['filesTable'] - ." WHERE gunid='$p_gunid'"; - return $CC_DBC->getOne($sql); - } - - - /** - * Get real filename of raw media data - * - * @return string - */ - public function getRealFilePath() - { - return $this->filepath; - } - - /** - * Get the URL to access this file. - */ - public function getFileUrl() - { - global $CC_CONFIG; - return "http://".$CC_CONFIG["storageUrlHost"] - .$CC_CONFIG["apiPath"]."get_media.php?file=" - .$this->gunid.".".$this->getFileExtension(); - } - - /** - * Get real filename of metadata file - * - * @return string - * @see MetaData - */ - public function getRealMetadataFileName() - { - //return $this->md->getFileName(); - return $this->md["name"]; - } - - - /** - * Create and return name for temporary symlink. - * - * @todo Should be more unique - * @return string - */ - private function _getAccessFileName($p_token, $p_ext='EXT') - { - global $CC_CONFIG; - return $CC_CONFIG['accessDir']."/$p_token.$p_ext"; - } - -} // class StoredFile -?> \ No newline at end of file diff --git a/backend/Subjects.php b/backend/Subjects.php deleted file mode 100644 index f99cea1c6..000000000 --- a/backend/Subjects.php +++ /dev/null @@ -1,683 +0,0 @@ -raiseError("Subjects::AddSubj: empty login"); - } - $id = $CC_DBC->nextId($CC_CONFIG['subjSequence']); - if (PEAR::isError($id)) { - return $id; - } - if (!is_null($p_pass) && !$p_passenc) { - $p_pass = md5($p_pass); - } - $sql = "INSERT INTO ".$CC_CONFIG['subjTable']." (id, login, pass, type, realname)" - ." VALUES ($id, '$p_login', ". - (is_null($p_pass) ? "'!', 'G'" : "'$p_pass', 'U'").", - '$p_realname')"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - return $id; - } - - - /** - * Remove subject by uid or by login - * - * @param string $login - * @param int $uid - * @return boolean|PEAR_Error - */ - public static function RemoveSubj($login, $uid=NULL) - { - global $CC_CONFIG, $CC_DBC; - if (is_null($uid)) { - $uid = Subjects::GetSubjId($login); - } - if (PEAR::isError($uid)) { - return $uid; - } - $sql = "DELETE FROM ".$CC_CONFIG['smembTable'] - ." WHERE (uid='$uid' OR gid='$uid') AND mid is null"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - $sql2 = "DELETE FROM ".$CC_CONFIG['subjTable'] - ." WHERE login='$login'"; - $r = $CC_DBC->query($sql2); - if (PEAR::isError($r)) { - return $r; - } - return Subjects::_rebuildRels(); - } // fn removeSubj - - - /** - * Check login and password - * - * @param string $login - * @param string $pass - * optional - * @return boolean|int|PEAR_Error - */ - public static function Authenticate($login, $pass='') - { - global $CC_CONFIG, $CC_DBC; - $cpass = md5($pass); - $sql = "SELECT id FROM ".$CC_CONFIG['subjTable'] - ." WHERE login='$login' AND pass='$cpass' AND type='U'"; - $id = $CC_DBC->getOne($sql); - if (PEAR::isError($id)) { - return $id; - } - return (is_null($id) ? FALSE : $id); - } // fn authenticate - - - /** - * Set lastlogin or lastfail timestamp - * - * @param string $login - * @param boolean $failed - * true=> set lastfail, false=> set lastlogin - * @return boolean|int|PEAR_Error - */ - public static function SetTimeStamp($login, $failed=FALSE) - { - global $CC_CONFIG, $CC_DBC; - $fld = ($failed ? 'lastfail' : 'lastlogin'); - $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET $fld=now()" - ." WHERE login='$login'"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } // fn setTimeStamp - - - /** - * Change user password - * - * @param string $login - * @param string $oldpass - * old password (optional for 'superuser mode') - * @param string $pass - * optional - * @param boolean $passenc - * optional, password already encrypted if true - * @return boolean|PEAR_Error - */ - public static function Passwd($login, $oldpass=null, $pass='', $passenc=FALSE) - { - global $CC_CONFIG, $CC_DBC; - if (!$passenc) { - $cpass = md5($pass); - } else { - $cpass = $pass; - } - if (!is_null($oldpass)) { - $oldcpass = md5($oldpass); - $oldpCond = "AND pass='$oldcpass'"; - } else { - $oldpCond = ''; - } - $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET pass='$cpass'" - ." WHERE login='$login' $oldpCond AND type='U'"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } // fn passwd - - - /* --------------------------------------------------------------- groups */ - - /** - * Add {login} and direct/indirect members to {gname} and to groups, - * where {gname} is [in]direct member - * - * @param string $login - * @param string $gname - * @return int|PEAR_Error - */ - public static function AddSubjectToGroup($login, $gname) - { - $uid = Subjects::GetSubjId($login); - if (PEAR::isError($uid)) { - return $uid; - } - $gid = Subjects::GetSubjId($gname); - if (PEAR::isError($gid)) { - return $gid; - } - $isgr = Subjects::IsGroup($gid); - if (PEAR::isError($isgr)) { - return $isgr; - } - if (!$isgr) { - return PEAR::raiseError("Subjects::addSubj2Gr: Not a group ($gname)", ALIBERR_NOTGR); - } - // add subject and all [in]direct members to group $gname: - $mid = Subjects::_plainAddSubjectToGroup($uid, $gid); - if (PEAR::isError($mid)) { - return $mid; - } - // add it to all groups where $gname is [in]direct member: - $marr = Subjects::_listRMemb($gid); - if (PEAR::isError($marr)) { - return $marr; - } - foreach ($marr as $k => $v) { - $r = Subjects::_plainAddSubjectToGroup( - $uid, $v['gid'], intval($v['level'])+1, $v['id']); - if (PEAR::isError($r)) { - return $r; - } - } - return $mid; - } // fn addSubj2Gr - - - /** - * Remove subject from group - * - * @param string $login - * @param string $gname - * @return boolean|PEAR_Error - */ - public static function RemoveSubjectFromGroup($login, $gname) - { - global $CC_CONFIG, $CC_DBC; - $uid = Subjects::GetSubjId($login); - if (PEAR::isError($uid)) { - return $uid; - } - $gid = Subjects::GetSubjId($gname); - if (PEAR::isError($gid)) { - return $gid; - } - $sql = "SELECT id FROM ".$CC_CONFIG['smembTable'] - ." WHERE uid='$uid' AND gid='$gid' AND mid is null"; - $mid = $CC_DBC->getOne($sql); - if (is_null($mid)) { - return FALSE; - } - if (PEAR::isError($mid)) { - return $mid; - } - // remove it: - $r = Subjects::_removeMemb($mid); - if (PEAR::isError($r)) { - return $r; - } - // and rebuild indirect memberships: - $r = Subjects::_rebuildRels(); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } // fn removeSubjFromGr - - - /* --------------------------------------------------------- info methods */ - - /** - * Get subject id from login - * - * @param string $login - * @return int|PEAR_Error - */ - public static function GetSubjId($login) - { - global $CC_CONFIG; - global $CC_DBC; - $sql = "SELECT id FROM ".$CC_CONFIG['subjTable'] - ." WHERE login='$login'"; - return $CC_DBC->getOne($sql); - } // fn getSubjId - - - /** - * Get subject name (login) from id - * - * @param int $id - * @param string $fld - * @return string|PEAR_Error - */ - public static function GetSubjName($id, $fld='login') - { - global $CC_CONFIG; - global $CC_DBC; - $sql = "SELECT $fld FROM ".$CC_CONFIG['subjTable'] - ." WHERE id='$id'"; - return $CC_DBC->getOne($sql); - } // fn getSubjName - - - /** - * Get one subject from the table. - * - * @param string $p_fieldValue - * @param string $p_fieldName - * @return array - */ - public static function GetSubject($p_fieldValue, $p_fieldName='login') - { - global $CC_CONFIG, $CC_DBC; - if (!in_array($p_fieldName, array("login", "id"))) { - return null; - } - $escapedValue = pg_escape_string($p_fieldValue); - $sql = "SELECT * FROM ".$CC_CONFIG['subjTable'] - ." WHERE $p_fieldName='$escapedValue'"; - $row = $CC_DBC->GetRow($sql); - return $row; - } - - - /** - * Get all subjects - * - * @param string $flds - * @return array|PEAR_Error - */ - public static function GetSubjects($flds='id, login') - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT $flds FROM ".$CC_CONFIG['subjTable']; - return $CC_DBC->getAll($sql); - } // fn getSubjects - - - /** - * Get subjects with count of direct members - * - * @return array|PEAR_Error - */ - public static function GetSubjectsWCnt() - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT count(m.uid)as cnt, s.id, s.login, s.type" - ." FROM ".$CC_CONFIG['subjTable']." s" - ." LEFT JOIN ".$CC_CONFIG['smembTable']." m ON m.gid=s.id" - ." WHERE m.mid is null" - ." GROUP BY s.id, s.login, s.type" - ." ORDER BY s.id"; - return $CC_DBC->getAll($sql); - } // fn getSubjectsWCnt - - - /** - * Return true if subject is a group - * - * @param int $gid - * @return boolean|PEAR_Error - */ - public static function IsGroup($gid) - { - global $CC_CONFIG, $CC_DBC; - if (empty($gid)) { - return FALSE; - } - $sql = "SELECT type FROM ".$CC_CONFIG['subjTable'] - ." WHERE id='$gid'"; - $r = $CC_DBC->getOne($sql); - if (PEAR::isError($r)) { - return $r; - } - return ($r === 'G'); - } // fn isGroup - - - /** - * List direct members of group - * - * @param int $gid - * @return array|PEAR_Error - */ - public static function ListGroup($gid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT s.id, s.login, s.type" - ." FROM ".$CC_CONFIG['smembTable']." m, ".$CC_CONFIG['subjTable']." s" - ." WHERE m.uid=s.id AND m.mid is null AND m.gid='$gid'"; - return $CC_DBC->getAll($sql); - } // fn listGroup - - - /** - * Return true if uid is [id]direct member of gid - * - * @param int $uid - * local user id - * @param int $gid - * local group id - * @return boolean - */ - public static function IsMemberOf($uid, $gid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT count(*)as cnt" - ." FROM ".$CC_CONFIG['smembTable'] - ." WHERE uid='$uid' AND gid='$gid'"; - $res = $CC_DBC->getOne($sql); - if (PEAR::isError($res)) { - return $res; - } - return (intval($res) > 0); - } // fn isMemberOf - - - /* ==================================================== "private" methods */ - - /** - * Create membership record - * - * @param int $uid - * @param int $gid - * @param int $level - * @param int $mid - * @return int|PEAR_Error - */ - private static function _addMemb($uid, $gid, $level=0, $mid='null') - { - global $CC_CONFIG, $CC_DBC; - if ($uid == $gid) { - return PEAR::raiseError("Subjects::_addMemb: uid==gid ($uid)", ALIBERR_BADSMEMB); - } - $sql = "SELECT id, level, mid FROM ".$CC_CONFIG['smembTable'] - ." WHERE uid='$uid' AND gid='$gid' ORDER BY level ASC"; - $a = $CC_DBC->getAll($sql); - if (PEAR::isError($a)) { - return $a; - } - if (count($a) > 0) { - $a0 = $a[0]; - $id = $a0['id']; - if ($level < intval($a0['level'])){ - $sql2 = "UPDATE ".$CC_CONFIG['smembTable'] - ." SET level='$level', mid=$mid WHERE id='{$a0['id']}'"; - $r = $CC_DBC->query($sql2); - if (PEAR::isError($r)) { - return $r; - } - } - } else { - $id = $CC_DBC->nextId($CC_CONFIG['smembSequence']); - if (PEAR::isError($id)) { - return $id; - } - $sql3 = "INSERT INTO ".$CC_CONFIG['smembTable']." (id, uid, gid, level, mid)" - ." VALUES ($id, $uid, $gid, $level, $mid)"; - $r = $CC_DBC->query($sql3); - if (PEAR::isError($r)) { - return $r; - } - } - return $id; - } // fn _addMemb - - - /** - * Remove membership record - * - * @param int $mid - * @return null|PEAR_Error - */ - private static function _removeMemb($mid) - { - global $CC_CONFIG, $CC_DBC; - $sql = "DELETE FROM ".$CC_CONFIG['smembTable'] - ." WHERE id='$mid'"; - return $CC_DBC->query($sql); - } // fn _removeMemb - - - /** - * List [in]direct members of group - * - * @param int $gid - * @param int $uid - * @return array|PEAR_Error - */ - private static function _listMemb($gid, $uid=NULL) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT id, uid, level FROM ".$CC_CONFIG['smembTable'] - ." WHERE gid='$gid'".(is_null($uid) ? '' : " AND uid='$uid'"); - return $CC_DBC->getAll($sql); - } // fn _listMemb - - - /** - * List groups where uid is [in]direct member - * - * @param int $gid - * @param int $uid - * @return array|PEAR_Error - */ - private static function _listRMemb($uid, $gid=NULL) - { - global $CC_CONFIG, $CC_DBC; - $sql = "SELECT id, gid, level FROM ".$CC_CONFIG['smembTable'] - ." WHERE uid='$uid'".(is_null($gid) ? '' : " AND gid='$gid'"); - return $CC_DBC->getAll($sql); - } // fn listRMemb - - - /** - * Add uid and its [in]direct members to gid - * - * @param int $uid - * @param int $gid - * @param int $level - * @param int $rmid - * @return int|PEAR_Error - */ - private static function _plainAddSubjectToGroup($uid, $gid, $level=0, $rmid='null') - { - $mid = Subjects::_addMemb($uid, $gid, $level, $rmid); - if (PEAR::isError($mid)) { - return $mid; - } - $marr = Subjects::_listMemb($uid); - if (PEAR::isError($marr)) { - return $marr; - } - foreach ($marr as $k => $v) { - $r = Subjects::_addMemb( - $v['uid'], $gid, intval($v['level'])+$level+1, $mid - ); - if (PEAR::isError($r)) { - return $r; - } - } - return $mid; - } - - - /** - * Rebuild indirect membership records
- * it's probably more complicated to do removing without rebuild ... - * - * @return true|PEAR_Error - */ - private static function _rebuildRels() - { - global $CC_CONFIG, $CC_DBC; - $CC_DBC->query("BEGIN"); - $r = $CC_DBC->query("LOCK TABLE ".$CC_CONFIG['smembTable']); - if (PEAR::isError($r)) { - return $r; - } - $sql = "DELETE FROM ".$CC_CONFIG['smembTable'] - ." WHERE mid is not null"; - $r = $CC_DBC->query($sql); - if (PEAR::isError($r)) { - return $r; - } - $arr = $CC_DBC->getAll("SELECT uid, gid FROM ".$CC_CONFIG['smembTable']); - // WHERE mid is null - if (PEAR::isError($arr)) { - return $arr; - } - foreach ($arr as $it) { - $marr = Subjects::_listRMemb($it['gid']); - if (PEAR::isError($marr)) { - return $marr; - } - foreach ($marr as $k => $v) { - $r = Subjects::_plainAddSubjectToGroup( - $it['uid'], $v['gid'], intval($v['level'])+1, $v['id'] - ); - if (PEAR::isError($r)) { - return $r; - } - } - } - $r = $CC_DBC->query("COMMIT"); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } // fn _rebuildRels - - - /* =============================================== test and debug methods */ - - /** - * Dump subjects for debug - * - * @param string $indstr - * indentation string - * @param string $ind - * actual indentation - * @return string - */ - public static function DumpSubjects($indstr=' ', $ind='') - { - $r = $ind.join(', ', array_map( - create_function('$v', 'return "{$v[\'login\']}({$v[\'cnt\']})";'), - Subjects::GetSubjectsWCnt() - ))."\n"; - return $r; - } // fn dumpSubjects - - - /** - * Delete all subjects and membership records - * - * @return void - */ - public static function DeleteData() - { - global $CC_CONFIG, $CC_DBC; - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['subjTable']); - $CC_DBC->query("DELETE FROM ".$CC_CONFIG['smembTable']); - //ObjClasses::DeleteData(); - } // fn deleteData - - - /** - * Insert test data - * - * @return array - */ - public function TestData() - { -// $tdata = ObjClasses::TestData(); -// $o['root'] = Subjects::AddSubj('root', 'q'); -// $o['test1'] = Subjects::AddSubj('test1', 'a'); -// $o['test2'] = Subjects::AddSubj('test2', 'a'); -// $o['test3'] = Subjects::AddSubj('test3', 'a'); -// $o['test4'] = Subjects::AddSubj('test4', 'a'); -// $o['test5'] = Subjects::AddSubj('test5', 'a'); -// $o['gr1'] = Subjects::AddSubj('gr1'); -// $o['gr2'] = Subjects::AddSubj('gr2'); -// $o['gr3'] = Subjects::AddSubj('gr3'); -// $o['gr4'] = Subjects::AddSubj('gr4'); -// Subjects::AddSubjectToGroup('test1', 'gr1'); -// Subjects::AddSubjectToGroup('test2', 'gr2'); -// Subjects::AddSubjectToGroup('test3', 'gr3'); -// Subjects::AddSubjectToGroup('test4', 'gr4'); -// Subjects::AddSubjectToGroup('test5', 'gr1'); -// Subjects::AddSubjectToGroup('gr4', 'gr3'); -// Subjects::AddSubjectToGroup('gr3', 'gr2'); -// $tdata['subjects'] = $o; -// return $tdata; - } // fn TestData - - - /** - * Make basic test - * - */ - public static function Test() - { -// $p = ObjClasses::Test(); -// if (PEAR::isError($p)) { -// return $p; -// } -// Subjects::DeleteData(); -// Subjects::TestData(); -// $test_correct = "root(0), test1(0), test2(0), test3(0),". -// " test4(0), test5(0), gr1(2), gr2(2), gr3(2), gr4(1)\n"; -// $test_dump = Subjects::DumpSubjects(); -// Subjects::RemoveSubj('test1'); -// Subjects::RemoveSubj('test3'); -// Subjects::RemoveSubjectFromGroup('test5', 'gr1'); -// Subjects::RemoveSubjectFromGroup('gr3', 'gr2'); -// $test_correct .= "root(0), test2(0), test4(0), test5(0),". -// " gr1(0), gr2(1), gr3(1), gr4(1)\n"; -// $test_dump .= Subjects::DumpSubjects(); -// Subjects::DeleteData(); -// if ($test_dump == $test_correct) { -// $test_log .= "subj: OK\n"; -// return TRUE; -// } else { -// return PEAR::raiseError( -// 'Subjects::test:', 1, PEAR_ERROR_DIE, '%s'. -// "
\ncorrect:\n{$test_correct}\n".
-//                "dump:\n{$test_dump}\n
\n"); -// } - } // fn test - -} // class Subjects -?> \ No newline at end of file diff --git a/backend/Transport.php b/backend/Transport.php deleted file mode 100644 index e5ee6f548..000000000 --- a/backend/Transport.php +++ /dev/null @@ -1,1833 +0,0 @@ - - * over unreliable network and from behind firewall

- * - * Transport states: - *
    - *
  • init: transport is prepared, but not started - * (e.g. no network connection is present)
  • - *
  • pending: transport is in progress, file is not fully transported to - * target system
  • - *
  • waiting: transport is in progress, but not running now
  • - *
  • finished: transport is finished, but file processing on target side - * is not completed
  • - *
  • closed: processing on target side is completed without errors
  • - *
  • failed: error - error message stored in errmsg field
  • - *
  • paused: transport have been paused
  • - *
- * - * Transport types: - *
    - *
  • audioclip
  • - *
  • playlist
  • - *
  • metadata
  • - *
  • file
  • - *
- * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class Transport -{ - /** - * @var GreenBox - */ - public $gb; - - /** - * File name - * @var string - */ - private $cronJobScript; - - /** - * wget --read-timeout parameter [s] - * @var int - */ - private $downTimeout = 900; - - /** - * wget --waitretry parameter [s] - * @var int - */ - private $downWaitretry = 10; - - /** - * wget --limit-rate parameter - */ - private $downLimitRate = NULL; - # private $downLimitRate = 500; - - /** - * wget -t parameter - * @var int - */ - private $downRetries = 6; - - /** - * curl --max-time parameter - * @var int - */ - private $upTrMaxTime = 1800; - - /** - * curl --speed-time parameter - * @var int - */ - private $upTrSpeedTime = 30; - - /** - * curl --speed-limit parameter - * @var int - */ - private $upTrSpeedLimit = 30; - - /** - * curl --connect-timeout parameter - * @var int - */ - private $upTrConnectTimeout = 20; - - /** - * curl --limit-rate parameter - * @var int - */ - private $upLimitRate = NULL; - # private $upLimitRate = 500; - - - /** - * Constructor - * - * @param LocStor $gb - * @return Transport - */ - public function __construct(&$gb) - { - $this->gb =& $gb; - $this->cronJobScript = realpath( - dirname(__FILE__). - '/../../storageServer/var/cron/transportCronJob.php' - ); - } - - - /* ==================================================== transport methods */ - /* ------------------------------------------------------- common methods */ - /** - * Common "check" method for transports - * - * @param string $trtok - * transport token - * @return array - * struct/hasharray with fields: - * trtype: string - - * audioclip | playlist | playlistPkg | metadata | file - * state: string - transport state - * init | pending | waiting | finished | closed | failed - * direction: string - up | down - * expectedsize: int - file size in bytes - * realsize: int - currently transported bytes - * expectedsum: string - orginal file checksum - * realsum: string - transported file checksum - * title: string - dc:title or filename etc. - * errmsg: string - error message for failed transports - * ... ? - */ - function getTransportInfo($trtok) - { - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $res = array(); - foreach (array( - 'trtype', 'state', 'direction', 'expectedsize', 'realsize', - 'expectedsum', 'realsum', 'title', 'errmsg' - ) as $k) { - $res[$k] = ( isset($trec->row[$k]) ? $trec->row[$k] : NULL ); - } - if ( ($trec->row['direction'] == 'down') && file_exists($trec->row['localfile']) ){ - $res['realsize'] = filesize($trec->row['localfile']); - $res['realsum'] = $this->_chsum($trec->row['localfile']); - } - if ( ($trec->row['direction'] == 'up') ){ - $check = $this->uploadCheck($trec->row['pdtoken']); - if (!PEAR::isError($check)) { - $res['realsize'] = $check['size']; - $res['realsum'] = $check['realsum']; - } - } - return $res; - } - - - /** - * Turn transports on/off, optionaly return current state. - * (true=On / false=off) - * - * @param string $sessid - * session id - * @param boolean $onOff - * optional (if not used, current state is returned) - * @return boolea - * previous state - */ - function turnOnOffTransports($sessid, $onOff=NULL) - { - require_once('Prefs.php'); - $pr = new Prefs($this->gb); - $group = $CC_CONFIG['StationPrefsGr']; - $key = 'TransportsDenied'; - $res = $pr->loadGroupPref($group, $key); - if (PEAR::isError($res)) { - if ($res->getCode() !== GBERR_PREF) { - return $res; - } else { - $res = FALSE; // default - } - } - $state = !$res; - if (is_null($onOff)) { - return $state; - } - $res = $pr->saveGroupPref($sessid, $group, $key, !$onOff); - if (PEAR::isError($res)) { - return $res; - } - return $state; - } - - - /** - * Pause, resume or cancel transport - * - * @param string $trtok - * transport token - * @param string $action - * pause | resume | cancel - * @return string - * resulting transport state - */ - function doTransportAction($trtok, $action) - { - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - if ($trec->getState() == 'closed') { - return PEAR::raiseError( - "Transport::doTransportAction:". - " closed transport token ($trtok)", TRERR_TOK - ); - } - switch ($action) { - case 'pause'; - $newState = 'paused'; - break; - case 'resume'; - $newState = 'waiting'; - break; - case 'cancel'; - $newState = 'closed'; - break; - default: - return PEAR::raiseError( - "Transport::doTransportAction:". - " unknown action ($action)" - ); - } - $res = $trec->setState($newState); - switch ($action) { - case 'pause'; - case 'cancel'; - $trec->killJob(); - } - return $res; - } - - /* ------------- special methods for audioClip/webstream object transport */ - - /** - * Start upload of audioClip/webstream/playlist from local storageServer - * to hub. - * - * @param string $gunid - * global unique id of object being transported - * @param boolean $withContent - * if true, transport playlist content too (optional) - * @param array $pars - * default parameters (optional, internal use) - * @return string - * transport token - */ - function upload2Hub($gunid, $withContent=TRUE, $pars=array()) - { - global $CC_CONFIG, $CC_DBC; - $this->trLog("upload2Hub start: ".strftime("%H:%M:%S")); - switch ($ftype = BasicStor::GetType($gunid)) { - case "audioclip": - case "webstream": - $storedFile = StoredFile::RecallByGunid($gunid); - if (is_null($storedFile) || PEAR::isError($storedFile)) { - return $storedFile; - } - // handle metadata: - $mdfpath = $storedFile->getRealMetadataFileName(); - if (PEAR::isError($mdfpath)) { - return $mdfpath; - } - $mdtrec = $this->_uploadGeneralFileToHub($mdfpath, 'metadata', - array_merge(array('gunid'=>$gunid, 'fname'=>'metadata',), $pars) - ); - if (PEAR::isError($mdtrec)) { - return $mdtrec; - } - // handle raw media file: - $fpath = $storedFile->getRealFilePath(); - if (PEAR::isError($fpath)) { - return $fpath; - } - $fname = $storedFile->getName(); - if (PEAR::isError($fname)) { - return $fname; - } - $trec = $this->_uploadGeneralFileToHub($fpath, 'audioclip', - array_merge(array( - 'gunid'=>$gunid, 'fname'=>$fname, 'mdtrtok'=>$mdtrec->trtok, - ), $pars) - ); - if (PEAR::isError($trec)) { - return $trec; - } - $this->startCronJobProcess($mdtrec->trtok); - break; - - case "playlist": - $plid = $gunid; - require_once("Playlist.php"); - $pl = StoredFile::RecallByGunid($plid); - if (is_null($pl) || PEAR::isError($pl)) { - return $pl; - } - $fname = $pl->getName(); - if (PEAR::isError($fname)) { - return $fname; - } - if ($withContent) { - $this->trLog("upload2Hub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S")); - $res = $this->gb->bsExportPlaylistOpen($plid); - $this->trLog("upload2Hub exportPlaylistOpen END: ".strftime("%H:%M:%S")); - if (PEAR::isError($res)) { - return $res; - } - $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_'); - $plfpath = "$tmpn.lspl"; - $this->trLog("upload2Hub begin copy: ".strftime("%H:%M:%S")); - copy($res['fname'], $plfpath); - $this->trLog("upload2Hub end copy: ".strftime("%H:%M:%S")); - $res = $this->gb->bsExportPlaylistClose($res['token']); - if (PEAR::isError($res)) { - return $res; - } - $fname = $fname.".lspl"; - $trtype = 'playlistPkg'; - } else { - $plfpath = $pl->getRealMetadataFileName(); - if (PEAR::isError($plfpath)) { - return $plfpath; - } - $trtype = 'playlist'; - } - $trec = $this->_uploadGeneralFileToHub($plfpath, $trtype, - array_merge(array('gunid'=>$plid,'fname'=>$fname,), $pars)); - if (PEAR::isError($trec)) { - return $trec; - } - break; - default: - return PEAR::raiseError("Transport::upload2Hub: ftype not supported ($ftype)"); - } - $this->startCronJobProcess($trec->trtok); - $this->trLog("upload2Hub end: ".strftime("%H:%M:%S")); - return $trec->trtok; - } - - - /** - * Start download of audioClip/webstream/playlist from hub to local - * storageServer - * - * @param int $uid - * local user id of transport owner - * (for downloading file to homedir in storage) - * @param string $gunid - * global unique id of object being transported - * @param boolean $withContent - * if true, transport playlist content too (optional) - * @param array $pars - * default parameters (optional, internal use) - * @return string - * transport token - */ - function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array()) - { - $trtype = ($withContent ? 'playlistPkg' : 'unknown' ); - $trec = TransportRecord::create($this, $trtype, 'down', - array_merge(array('gunid'=>$gunid, 'uid'=>$uid), $pars)); - if (PEAR::isError($trec)) { - return $trec; - } - $this->startCronJobProcess($trec->trtok); - return $trec->trtok; - } - - - /* ------------------------------------------------ remote-search methods */ - /** - * Start search job on remote Campcaster instance. - * - * @param array $criteria - * LS criteria format (see localSearch) - * @param string $resultMode - * 'php' | 'xmlrpc' - * @param array $pars - * default parameters (optional, internal use) - * @return string - * transport token - */ - function remoteSearch($criteria, $resultMode='php') - { - global $CC_CONFIG, $CC_DBC; - $criteria['resultMode'] = $resultMode; - - // testing of hub availability and hub account configuration. - $sessid = $this->loginToArchive(); - if (PEAR::isError($sessid)) { - switch(intval($sessid->getCode())) { - case 802: - return PEAR::raiseError("Can't login to Hub ({$sessid->getMessage()})", TRERR_XR_FAIL); - case TRERR_XR_FAIL: - return PEAR::raiseError("Can't connect to Hub ({$sessid->getMessage()})", TRERR_XR_FAIL); - } - return $sessid; - } - $params = array("sessid" => $sessid, "criteria" => $criteria); - $result = $this->xmlrpcCall("locstor.searchMetadata", $params); - //$result = $this->xmlrpcCall("locstor.ping", array("par" => "foo")); - $this->logoutFromArchive($sessid); - return $result; - } - - /** - * Start search job on network hub - * - * @param array $criteria - * LS criteria format (see localSearch) - * @param string $resultMode - * 'php' | 'xmlrpc' - * @param array $pars - * default parameters (optional, internal use) - * @return string - * transport token - */ - // function globalSearch($criteria, $resultMode='php', $pars=array()) - // { - // global $CC_CONFIG, $CC_DBC; - // // testing of hub availability and hub account configuration. - // // it makes searchjob not async - should be removed for real async - // $r = $this->loginToArchive(); - // if (PEAR::isError($r)) { - // switch(intval($r->getCode())) { - // case 802: - // return PEAR::raiseError("Can't login to Hub ({$r->getMessage()})", TRERR_XR_FAIL); - // case TRERR_XR_FAIL: - // return PEAR::raiseError("Can't connect to Hub ({$r->getMessage()})", TRERR_XR_FAIL); - // } - // return $r; - // } - // $this->logoutFromArchive($r); - // $criteria['resultMode'] = $resultMode; - // $localfile = tempnam($CC_CONFIG['transDir'], 'searchjob_'); - // @chmod($localfile, 0660); - // $len = file_put_contents($localfile, serialize($criteria)); - // $trec = $this->_uploadGeneralFileToHub($localfile, 'searchjob', $pars); - // if (PEAR::isError($trec)) { - // return $trec; - // } - // $this->startCronJobProcess($trec->trtok); - // return $trec->trtok; - // } - - - /** - * Get results from search job on network hub - * - * @param string $trtok - * transport token - * @param boolean $andClose - * if TRUE, close transport token - * @return array - * LS search result format (see localSearch) - */ - // function getSearchResults($trtok, $andClose=TRUE) - // { - // $trec = TransportRecord::recall($this, $trtok); - // if (PEAR::isError($trec)) { - // return $trec; - // } - // $row = $trec->row; - // switch ($st = $trec->getState()) { - // case "failed": - // return PEAR::raiseError( - // "Transport::getSearchResults:". - // " global search or results transport failed". - // " ({$trec->row['errmsg']})" - // ); - // case "closed": - ///* - // $res = file_get_contents($row['localfile']); - // $results = unserialize($res); - // return $results; - //*/ - // return PEAR::raiseError( - // "Transport::getSearchResults:". - // " closed transport token ($trtok)", TRERR_TOK - // ); - // case "finished": - // if ($row['direction'] == 'down') { - // // really finished - // $res = file_get_contents($row['localfile']); - // $results = unserialize($res); - // if ($andClose) { - // $ret = $this->xmlrpcCall('archive.downloadClose', - // array( - // 'token' => $row['pdtoken'] , - // 'trtype' => $row['trtype'] , - // )); - // if (PEAR::isError($ret)) { - // return $ret; - // } - // @unlink($row['localfile']); - // $r = $trec->close(); - // if (PEAR::isError($r)) { - // return $r; - // } - // } - // return $results; - // } - // // otherwise not really finished - only request upload finished - // default: - // return PEAR::raiseError( - // "Transport::getSearchResults: not finished ($st)", - // TRERR_NOTFIN - // ); - // } - // } - - - /* ------------------------ methods for ls-archive-format file transports */ - /** - * Open async file transfer from local storageServer to network hub, - * file should be ls-archive-format file. - * - * @param string $filePath - * local path to uploaded file - * @param array $pars - * default parameters (optional, internal use) - * @return string - * transport token - */ - function uploadFile2Hub($filePath, $pars=array()) - { - if (!file_exists($filePath)) { - return PEAR::raiseError( - "Transport::uploadFile2Hub: file not found ($filePath)" - ); - } - $trec = $this->_uploadGeneralFileToHub($filePath, 'file', $pars); - if (PEAR::isError($trec)) { - return $trec; - } - $this->startCronJobProcess($trec->trtok); - return $trec->trtok; - } - - - /** - * Open async file transfer from network hub to local storageServer, - * file should be ls-archive-format file. - * - * @param string $url - * readable url - * @param string $chsum - * checksum from remote side - * @param int $size - * filesize from remote side - * @param array $pars - * default parameters (internal use) - * @return array - * trtok: string - transport token - * localfile: string - filepath of downloaded file - */ - function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array()) - { - global $CC_CONFIG, $CC_DBC; - $tmpn = tempnam($CC_CONFIG['transDir'], 'HITrans_'); - $trec = TransportRecord::create($this, 'file', 'down', - array_merge(array( - 'url' => $url, - 'localfile' => $tmpn, - 'expectedsum' => $chsum, - 'expectedsize' => $size, - ), $pars) - ); - if (PEAR::isError($trec)) { - return $trec; - } - $this->startCronJobProcess($trec->trtok); - return array('trtok'=>$trec->trtok, 'localfile'=>$tmpn); - } - - - /** - * Get list of prepared transfers initiated by hub - * - * @return array - * array of structs/hasharrays with fields: - * trtok: string transport token - */ - function getHubInitiatedTransfers() - { - $ret = $this->xmlrpcCall('archive.listHubInitiatedTransfers', - array('target' => HOSTNAME)); - if (PEAR::isError($ret)) { - return $ret; - } - $res = array(); - foreach ($ret as $it) { - $res[] = array('trtok'=>$it['trtok']); - } - return $res; - } - - - /** - * Start of download initiated by hub - * - * @param int $uid - * local user id of transport owner - * (for downloading file to homedir in storage) - * @param string $rtrtok - * transport token obtained from the getHubInitiatedTransfers method - * @return string - * transport token - */ - function startHubInitiatedTransfer($uid, $rtrtok) - { - $ret = $this->xmlrpcCall('archive.listHubInitiatedTransfers', - array( - 'target' => HOSTNAME, - 'trtok' => $rtrtok, - )); - if (PEAR::isError($ret)) { - return $ret; - } - if (count($ret) != 1) { - return PEAR::raiseError( - "Transport::startHubInitiatedTransfer:". - " wrong number of transports (".count($ret).")" - ); - } - $ta = $ret[0]; - // direction invertation to locstor point of view: - $direction = ( $ta['direction']=='up' ? 'down' : 'up' ); - $gunid = $ta['gunid']; - switch ($direction) { - case "up": - switch ($ta['trtype']) { - case "audioclip": - case "playlist": - case "playlistPkg": - $trtok = $this->upload2Hub($gunid, TRUE, - array('rtrtok'=>$rtrtok)); - if (PEAR::isError($trtok)) { - return $trtok; - } - break; - //case "searchjob": break; // not supported yet - //case "file": break; // probably unusable - default: - return PEAR::raiseError( - "Transport::startHubInitiatedTransfer:". - " wrong direction / transport type combination". - " ({$ta['direction']}/{$ta['trtype']})" - ); - } - break; - case "down": - switch ($ta['trtype']) { - case "audioclip": - case "playlist": - case "playlistPkg": - $trtok = $this->downloadFromHub($uid, $gunid, TRUE, - array('rtrtok'=>$rtrtok)); - if (PEAR::isError($trtok)) { - return $trtok; - } - break; - //case "searchjob": break; // probably unusable - case "file": - $r = $this->downloadFileFromHub( - $ta['url'], $ta['expectedsum'], $ta['expectedsize'], - array('rtrtok'=>$rtrtok)); - if (PEAR::isError($r)) { - return $r; - } - extract($r); // trtok, localfile - break; - default: - return PEAR::raiseError( - "Transport::startHubInitiatedTransfer:". - " wrong direction / transport type combination". - " ({$ta['direction']}/{$ta['trtype']})" - ); - } - break; - default: - return PEAR::raiseError( - "Transport::startHubInitiatedTransfer: ???" - ); - } - $ret = $this->xmlrpcCall('archive.setHubInitiatedTransfer', - array( - 'target' => HOSTNAME, - 'trtok' => $rtrtok, - 'state' => 'waiting', - )); - if (PEAR::isError($ret)) { - return $ret; - } - $this->startCronJobProcess($trtok); - return $trtok; - } - - - /* =============================================== authentication methods */ - - /** - * Login to archive server - * (account info is taken from storageServer's config) - * - * @return string - * sessid or error - */ - function loginToArchive() - { - global $CC_CONFIG; - $res = $this->xmlrpcCall('locstor.login', - array( - 'login' => $CC_CONFIG['archiveAccountLogin'], - 'pass' => $CC_CONFIG['archiveAccountPass'] - )); - if (PEAR::isError($res)) { - return $res; - } - return $res['sessid']; - } - - - /** - * Logout from archive server - * - * @param unknown $sessid - * session id - * @return string - * Bye or error - */ - function logoutFromArchive($sessid) - { - $res = $this->xmlrpcCall('locstor.logout', - array('sessid'=>$sessid)); - return $res; - } - - - /* ========================================================= cron methods */ - /* -------------------------------------------------- common cron methods */ - /** - * Main method for periodical transport tasks - called by cron - * - * @param string $direction - * optional - * @return boolean - * TRUE - */ - function cronMain($direction=NULL) - { - global $CC_CONFIG; - if (is_null($direction)) { - $r = $this->cronMain('up'); - if (PEAR::isError($r)) { - return $r; - } - $r = $this->cronMain('down'); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - // fetch all opened transports - $transports = $this->getTransports($direction); - if (PEAR::isError($transports)) { - $this->trLog("cronMain: DB error"); - return FALSE; - } - if (count($transports) == 0) { - if (TR_LOG_LEVEL > 1) { - $this->trLog("cronMain: $direction - nothing to do."); - } - return TRUE; - } - // ping to archive server: - $r = $this->ping(); - chdir($CC_CONFIG['transDir']); - // for all opened transports: - foreach ($transports as $i => $row) { - $r = $this->startCronJobProcess($row['trtok']); - } // foreach transports - return TRUE; - } - - - /** - * Cron job process starter - * - * @param string $trtok - * transport token - * @return boolean - * status - */ - function startCronJobProcess($trtok) - { - global $CC_CONFIG, $CC_DBC; - if (TR_LOG_LEVEL > 2) { - $redirect = $CC_CONFIG['transDir']."/debug.log"; - } else { - $redirect = "/dev/null"; - } - $redirect_escaped = escapeshellcmd($redirect); - $command = "{$this->cronJobScript} {$trtok}"; - $command_escaped = escapeshellcmd($command); - $command_final = "$command_escaped >> $redirect_escaped 2>&1 &"; - $res = system($command_final, $status); - if ($res === FALSE) { - $this->trLog( - "cronMain: Error on execute cronJobScript with trtok {$trtok}" - ); - return FALSE; - } - return TRUE; - } - - - /** - * Dynamic method caller - wrapper - * - * @param string $trtok - * transport token - * @return mixed - * inherited from called method - */ - function cronCallMethod($trtok) - { - global $CC_CONFIG; - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $row = $trec->row; - $state = $row['state']; - - $states = array('init'=>'init', - 'pending'=>'pending', - 'waiting'=>'waiting', - 'finished'=>'finished', - 'failed'=>'failed', - 'closed'=>'closed'); - $directions = array('up'=>'upload', 'down'=>'download'); - // method name construction: - $mname = "cron"; - if (isset($directions[$row['direction']])) { - $mname .= ucfirst($directions[$row['direction']]); - } else { - return PEAR::raiseError( - "Transport::cronCallMethod: invalid direction ({$row['direction']})" - ); - } - if (isset($states[$state])) { - $mname .= ucfirst($states[$state]); - } else { - return PEAR::raiseError( - "Transport::cronCallMethod: invalid state ({$state})" - ); - } - switch ($state) { - // do nothing if closed, penfing or failed: - case 'closed': // excluded in SQL query too, but let check it here - case 'failed': // -"- - case 'pending': - case 'paused': - return TRUE; - case 'waiting': - require_once('Prefs.php'); - $pr = new Prefs($this->gb); - $group = $CC_CONFIG['StationPrefsGr']; - $key = 'TransportsDenied'; - $res = $pr->loadGroupPref($group, $key); - if (PEAR::isError($res)) { - if ($res->getCode() !== GBERR_PREF) { - return $res; - } else { - $res = FALSE; // default - } - } - // transfers turned off - // if ($res) { return TRUE; break; } - if ($res) { - return PEAR::raiseError( - "Transport::cronCallMethod: transfers turned off" - ); - } - // NO break here! - default: - if (method_exists($this, $mname)) { - // lock the job: - $pid = getmypid(); - $r = $trec->setLock(TRUE, $pid); - if (PEAR::isError($r)) { - return $r; - } - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - $trec->setLock(FALSE); - return $trec; - } - $row = $trec->row; - $state = $row['state']; - - // login to archive server: - $r = $this->loginToArchive(); - if (PEAR::isError($r)) { - $r2 = $trec->setLock(FALSE); - return $r; - } - $asessid = $r; - // method call: - if (TR_LOG_LEVEL > 2) { - $this->trLog("cronCallMethod($pid): $mname($trtok) >"); - } - $ret = call_user_func(array($this, $mname), $row, $asessid); - if (PEAR::isError($ret)) { - $trec->setLock(FALSE); - return $this->_failFatal($ret, $trec); - } - if (TR_LOG_LEVEL > 2) { - $this->trLog("cronCallMethod($pid): $mname($trtok) <"); - } - // unlock the job: - $r = $trec->setLock(FALSE); - if (PEAR::isError($r)) { - return $r; - } - // logout: - $r = $this->logoutFromArchive($asessid); - if (PEAR::isError($r)) { - return $r; - } - return $ret; - } else { - return PEAR::raiseError( - "Transport::cronCallMethod: unknown method ($mname)" - ); - } - } - } - - - /** - * Upload initialization - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronUploadInit($row, $asessid) - { - $trtok = $row['trtok']; - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $ret = $this->xmlrpcCall('archive.uploadOpen', - array( - 'sessid' => $asessid , - 'chsum' => $row['expectedsum'], - )); - if (PEAR::isError($ret)) { - return $ret; - } - $r = $trec->setState('waiting', - array('url'=>$ret['url'], 'pdtoken'=>$ret['token'])); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /** - * Download initialization - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronDownloadInit($row, $asessid) - { - global $CC_CONFIG; - $trtok = $row['trtok']; - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $ret = $this->xmlrpcCall('archive.downloadOpen', - array( - 'sessid'=> $asessid, - 'trtype'=> $row['trtype'], - 'pars'=>array( - 'gunid' => $row['gunid'], - 'token' => $row['pdtoken'], - ), - )); - if (PEAR::isError($ret)) { - return $ret; - } - $trtype = $ret['trtype']; - $title = $ret['title']; - $pars = array(); - switch ($trtype) { - // case "searchjob": - // $r = $trec->setState('waiting', $pars); - // break; - case "file": - $r = $trec->setState('waiting',array_merge($pars, array( - 'trtype'=>$trtype, - 'url'=>$ret['url'], 'pdtoken'=>$ret['token'], - 'expectedsum'=>$ret['chsum'], 'expectedsize'=>$ret['size'], - 'fname'=>$ret['filename'], - 'localfile'=>$CC_CONFIG['transDir']."/$trtok", - ))); - break; - case "audioclip": - $mdtrec = TransportRecord::create($this, 'metadata', 'down', - array('gunid'=>$row['gunid'], 'uid'=>$row['uid'], ) - ); - if (PEAR::isError($mdtrec)) { - return $mdtrec; - } - $this->startCronJobProcess($mdtrec->trtok); - $pars = array('mdtrtok'=>$mdtrec->trtok); - // NO break here ! - default: - $r = $trec->setState('waiting',array_merge($pars, array( - 'trtype'=>$trtype, - 'url'=>$ret['url'], 'pdtoken'=>$ret['token'], - 'expectedsum'=>$ret['chsum'], 'expectedsize'=>$ret['size'], - 'fname'=>$ret['filename'], 'title'=>$title, - 'localfile'=>$CC_CONFIG['transDir']."/$trtok", - ))); - } - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /** - * Upload next part of transported file - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronUploadWaiting($row, $asessid) - { - $trtok = $row['trtok']; - $check = $this->uploadCheck($row['pdtoken']); - if (PEAR::isError($check)) { - return $check; - } - // test filesize - if (!file_exists($row['localfile'])) { - return PEAR::raiseError("Transport::cronUploadWaiting:". - " file being uploaded does not exist! ({$row['localfile']})" - ); - } - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $size = escapeshellarg($check['size']); - $localfile = escapeshellarg($row['localfile']); - $url = escapeshellarg($row['url']); - $command = - "curl -f -s -C $size --max-time {$this->upTrMaxTime}". - " --speed-time {$this->upTrSpeedTime}". - " --speed-limit {$this->upTrSpeedLimit}". - " --connect-timeout {$this->upTrConnectTimeout}". - (!is_null($this->upLimitRate)? - " --limit-rate {$this->upLimitRate}" : ""). - " -T $localfile $url"; - $r = $trec->setState('pending', array(), 'waiting'); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - return TRUE; - } - $res = system($command, $status); - - // leave paused and closed transports - $trec2 = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $state2 = $trec2->row['state']; - if ($state2 == 'paused' || $state2 == 'closed' ) { - return TRUE; - } - - - // status 18 - Partial file. Only a part of the file was transported. - // status 28 - Timeout. Too long/slow upload, try to resume next time rather. - // status 6 - Couldn't resolve host. - // status 7 - Failed to connect to host. - // status 56 - Failure in receiving network data. Important - this status is - // returned if file is locked on server side - if ($status == 0 || $status == 18 || $status == 28 || $status == 6 || $status == 7 || $status == 56) { - $check = $this->uploadCheck($row['pdtoken']); - if (PEAR::isError($check)) { - return $check; - } - // test checksum - if ($check['status'] == TRUE) { - // finished - $r = $trec->setState('finished', - array('realsum'=>$check['realsum'], 'realsize'=>$check['size'])); - if (PEAR::isError($r)) { - return $r; - } - } else { - if (intval($check['size']) < $row['expectedsize']) { - $r = $trec->setState('waiting', - array('realsum'=>$check['realsum'], 'realsize'=>$check['size'])); - if (PEAR::isError($r)) { - return $r; - } - } else { - // wrong md5 at finish - TODO: start again - // $this->xmlrpcCall('archive.uploadReset', array()); - $trec->fail('file uploaded with bad md5'); - return PEAR::raiseError("Transport::cronUploadWaiting:". - " file uploaded with bad md5 ". - "($trtok: {$check['realsum']}/{$check['expectedsum']})" - ); - } - } - } else { - return PEAR::raiseError("Transport::cronUploadWaiting:". - " wrong return status from curl: $status on $url". - "($trtok)" - ); - } - return TRUE; - } - - - /** - * Download next part of transported file - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronDownloadWaiting($row, $asessid) - { - $trtok = $row['trtok']; - // wget the file - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $localfile = escapeshellarg($row['localfile']); - $url = escapeshellarg($row['url']); - $command = - "wget -q -c". - " --read-timeout={$this->downTimeout}". - " --waitretry={$this->downWaitretry}". - " -t {$this->downRetries}". - (!is_null($this->downLimitRate)? - " --limit-rate={$this->downLimitRate}" : ""). - " -O $localfile $url" - ; - $r = $trec->setState('pending', array(), 'waiting'); - if (PEAR::isError($r)) { - return $r; - } - if ($r === FALSE) { - return TRUE; - } - $res = system($command, $status); - - // leave paused and closed transports - $trec2 = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - $state2 = $trec2->row['state']; - if ($state2 == 'paused' || $state2 == 'closed' ) { - return TRUE; - } - - // check consistency - $size = filesize($row['localfile']); - if ($size < $row['expectedsize']) { - // not finished - return to the 'waiting' state - $r = $trec->setState('waiting', array('realsize'=>$size)); - if (PEAR::isError($r)) { - return $r; - } - } elseif ($size >= $row['expectedsize']) { - $chsum = $this->_chsum($row['localfile']); - if ($chsum == $row['expectedsum']) { - // mark download as finished - $r = $trec->setState('finished', - array('realsum'=>$chsum, 'realsize'=>$size)); - if (PEAR::isError($r)) { - return $r; - } - } else { - // bad checksum, retry from the scratch - @unlink($row['localfile']); - $r = $trec->setState('waiting', - array('realsum'=>$chsum, 'realsize'=>$size)); - if (PEAR::isError($r)) { - return $r; - } - } - } - return TRUE; - } - - - /** - * Finish the upload - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronUploadFinished($row, $asessid) - { - global $CC_CONFIG; - $trtok = $row['trtok']; - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - // don't close metadata transport - audioclip will close it - if ($row['trtype'] == 'metadata') { - return TRUE; - } - // handle metadata transport on audioclip trtype: - if ($row['trtype'] == 'audioclip') { - $mdtrec = TransportRecord::recall($this, $trec->row['mdtrtok']); - if (PEAR::isError($mdtrec)) { - return $mdtrec; - } - switch ($mdtrec->row['state']) { - case 'failed': - case 'closed': - return PEAR::raiseError("Transport::cronUploadFinished:". - " metadata transport in wrong state: {$mdtrec->row['state']}". - " ({$this->trtok})" - ); - break; - // don't close transport with nonfinished metadata transport: - case 'init': - case 'waiting': - case 'pending': - case 'paused': - return TRUE; - default: // finished - ok close parent transport - $mdpdtoken = $mdtrec->row['pdtoken']; - } - } else { - $mdpdtoken = NULL; - } - $ret = $this->xmlrpcCall('archive.uploadClose', - array( - 'token' => $row['pdtoken'] , - 'trtype' => $row['trtype'], - 'pars' => array( - 'gunid' => $row['gunid'], - 'name' => $row['fname'], - 'mdpdtoken' => $mdpdtoken, - ), - )); - if (PEAR::isError($ret)) { - if ($row['trtype'] == 'audioclip') { - $r2 = $mdtrec->close(); - } - return $ret; - } - - // if ($row['trtype'] == 'searchjob') { - // @unlink($row['localfile']); - // $r = $trec->setState('init', array( - // 'direction' => 'down', - // 'pdtoken' => $ret['token'], - // 'expectedsum' => $ret['chsum'], - // 'expectedsize' => $ret['size'], - // 'url' => $ret['url'], - // 'realsize' => 0, - // )); - // $this->startCronJobProcess($trec->trtok); - // } else { - $r = $trec->close(); - // } - if (PEAR::isError($r)) { - return $r; - } - switch ($row['trtype']) { - case 'audioclip': - // close metadata transport: - $r = $mdtrec->close(); - if (PEAR::isError($r)) { - return $r; - } - break; - case 'playlistPkg': - // remove exported playlist (playlist with content) - $ep = $row['localfile']; - @unlink($ep); - if (preg_match("|/(plExport_[^\.]+)\.lspl$|", $ep, $va)) { - list(,$tmpn) = $va; $tmpn = $CC_CONFIG['transDir']."/$tmpn"; - if (file_exists($tmpn)) { - @unlink($tmpn); - } - } - - break; - default: - } - - return TRUE; - } - - - /** - * Finish the download - * - * @param array $row - * row from getTransport results - * @param string $asessid - * session id (from network hub) - * @return mixed - * boolean TRUE or error object - */ - function cronDownloadFinished($row, $asessid) - { - $trtok = $row['trtok']; - $trec = TransportRecord::recall($this, $trtok); - if (PEAR::isError($trec)) { - return $trec; - } - switch ($row['trtype']) { - case "audioclip": - $mdtrtok = $trec->row['mdtrtok']; - $mdtrec = TransportRecord::recall($this, $mdtrtok); - if (PEAR::isError($mdtrec)) { - return $mdtrec; - } - $pid = getmypid(); - $r = $mdtrec->setLock(TRUE, $pid); - if (PEAR::isError($r)) { - return $r; - } - switch ($mdtrec->row['state']) { - // don't close transport with nonfinished metadata transport: - case 'init': - case 'waiting': - case 'pending': - case 'paused': - $r = $mdtrec->setLock(FALSE); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - case 'finished': // metadata finished, close main transport - $values = array( - "filename" => $row['fname'], - "filepath" => $trec->row['localfile'], - "metadata" => $mdtrec->row['localfile'], - "gunid" => $row['gunid'], - "filetype" => "audioclip" - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - $mdtrec->setLock(FALSE); - return $storedFile; - } - $res = $storedFile->getId(); - $ret = $this->xmlrpcCall('archive.downloadClose', - array( - 'token' => $mdtrec->row['pdtoken'] , - 'trtype' => 'metadata' , - )); - if (PEAR::isError($ret)) { - $mdtrec->setLock(FALSE); - return $ret; - } - $r = $mdtrec->close(); - if (PEAR::isError($r)) { - $r2 = $mdtrec->setLock(FALSE); - return $r; - } - @unlink($trec->row['localfile']); - @unlink($mdtrec->row['localfile']); - break; - default: - $r = $mdtrec->setLock(FALSE); - return PEAR::raiseError("Transport::cronDownloadFinished:". - " metadata transport in wrong state: {$mdtrec->row['state']}". - " ({$this->trtok})" - ); - } - $r = $mdtrec->setLock(FALSE); - if (PEAR::isError($r)) { - return $r; - } - break; - case "metadata": - // case "searchjob": - return TRUE; // don't close - getSearchResults should close it - break; - } - $ret = $this->xmlrpcCall('archive.downloadClose', - array( - 'token' => $row['pdtoken'] , - 'trtype' => $row['trtype'] , - )); - if (PEAR::isError($ret)) { - return $ret; - } - switch ($row['trtype']) { - case "playlist": - $values = array( - "filename" => $row['fname'], - "metadata" => $trec->row['localfile'], - "gunid" => $row['gunid'], - "filetype" => "playlist" - ); - $storedFile = StoredFile::Insert($values); - if (PEAR::isError($storedFile)) { - return $storedFile; - } - $res = $storedFile->getId(); - @unlink($row['localfile']); - break; - case "playlistPkg": - $subjid = $trec->row['uid']; - $fname = $trec->row['localfile']; - $res = $this->gb->bsImportPlaylist($fname, $subjid); - if (PEAR::isError($res)) { - return $res; - } - @unlink($fname); - break; - case "audioclip": - case "metadata": - // case "searchjob": - case "file": - break; - default: - return PEAR::raiseError("DEBUG: NotImpl ".var_export($row,TRUE)); - } - if (!is_null($rtrtok = $trec->row['rtrtok'])) { - $ret = $this->xmlrpcCall('archive.setHubInitiatedTransfer', - array( - 'target' => HOSTNAME, - 'trtok' => $rtrtok, - 'state' => 'closed', - )); - if (PEAR::isError($ret)) { - return $ret; - } - } - $r = $trec->close(); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /* ==================================================== auxiliary methods */ - /** - * Prepare upload for general file - * - * @param string $fpath - * local filepath of uploaded file - * @param string $trtype - * transport type - * @param array $pars - * default parameters (optional, internal use) - * @return object - transportRecord instance - */ - function _uploadGeneralFileToHub($fpath, $trtype, $pars=array()) - { - $chsum = $this->_chsum($fpath); - $size = filesize($fpath); - $trec = TransportRecord::create($this, $trtype, 'up', - array_merge(array( - 'localfile'=>$fpath, 'fname'=>basename($fpath), - 'expectedsum'=>$chsum, 'expectedsize'=>$size - ), $pars) - ); - if (PEAR::isError($trec)) { - return $trec; - } - return $trec; - } - - - /** - * Create new transport token - * - * @return string - * transport token - */ - function _createTransportToken() - { - $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''); - $initString = microtime().$ip.rand()."org.mdlf.campcaster"; - $hash = md5($initString); - $res = substr($hash, 0, 16); - return $res; - } - - - /** - * Get all relevant transport records - * - * @param string $direction - * 'up' | 'down' - * @param string $target - * target hostname - * @param string $trtok - * transport token for specific query - * @return array - * array of transportRecords (as hasharrays) - */ - function getTransports($direction=NULL, $target=NULL, $trtok=NULL) - { - global $CC_CONFIG, $CC_DBC; - switch ($direction) { - case 'up': - $dirCond = "direction='up' AND"; - break; - case 'down': - $dirCond = "direction='down' AND"; - break; - default: - $dirCond = ''; - break; - } - if (is_null($target)) { - $targetCond = ""; - } else { - $targetCond = "target='$target' AND"; - } - if (is_null($trtok)) { - $trtokCond = ""; - } else { - $trtokCond = "trtok='$trtok' AND"; - } - $rows = $CC_DBC->getAll(" - SELECT - id, trtok, state, trtype, direction, - to_hex(gunid)as gunid, to_hex(pdtoken)as pdtoken, - fname, localfile, expectedsum, expectedsize, url, - uid, target - FROM ".$CC_CONFIG['transTable']." - WHERE $dirCond $targetCond $trtokCond - state not in ('closed', 'failed', 'paused') - ORDER BY start DESC - "); - if (PEAR::isError($rows)) { - return $rows; - } - foreach ($rows as $i => $row) { - $rows[$i]['pdtoken'] = StoredFile::NormalizeGunid($row['pdtoken']); - $rows[$i]['gunid'] = StoredFile::NormalizeGunid($row['gunid']); - } - return $rows; - } - - - /** - * Check remote state of uploaded file - * - * @param string $pdtoken - * put/download token (from network hub) - * @return array - * hash: chsum, size, url - */ - function uploadCheck($pdtoken) - { - $ret = $this->xmlrpcCall('archive.uploadCheck', - array('token'=>$pdtoken)); - return $ret; - } - - - /** - * Ping to remote Campcaster server - * - * @return string - * network hub response or error object - */ - function ping() - { - $res = $this->xmlrpcCall('ping', - array('par'=>'ping_'.date('H:i:s'))); - return $res; - } - - - /** - * XMLRPC call to network hub. - * - * @param string $method - * method name - * @param array $pars - * call parameters - * @return mixed - * response - */ - function xmlrpcCall($method, $pars=array()) - { - global $CC_CONFIG; - $xrp = XML_RPC_encode($pars); - - $pr = new Prefs($this->gb); - $group = $CC_CONFIG["StationPrefsGr"]; - $key = 'archiveServerLocation'; - $archiveUrl = $pr->loadGroupPref($group, $key, false); - - if ($archiveUrl) { - $archiveUrlInfo = parse_url($archiveUrl); - if ($archiveUrlInfo['port']) { - $port = $archiveUrlInfo['port']; - } - else { - $port = 80; - } - - $c = new XML_RPC_Client($archiveUrlInfo['path'], $archiveUrlInfo['host'], $port); - } - else { - $c = new XML_RPC_Client( - $CC_CONFIG['archiveUrlPath']."/".$CC_CONFIG['archiveXMLRPC'], - $CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort'] - ); - } - - $f = new XML_RPC_Message($method, array($xrp)); - $r = $c->send($f); - if (!$r) { - return PEAR::raiseError("XML-RPC request failed", TRERR_XR_FAIL); - } elseif ($r->faultCode() > 0) { - return PEAR::raiseError($r->faultString(), $r->faultCode()); - // return PEAR::raiseError($r->faultString(). - // " (code ".$r->faultCode().")", TRERR_XR_FAIL); - } else { - $v = $r->value(); - return XML_RPC_decode($v); - } - } - - - /** - * Checksum of local file - * - * @param string $fpath - * local filepath - * @return string - * checksum - */ - function _chsum($fpath) - { - return md5_file($fpath); - } - - - /** - * Check exception and eventually mark transport as failed - * - * @param mixed $res - * result object to be checked - * @param unknown $trec - * transport record object - * @return unknown - */ - function _failFatal($res, $trec) - { - if (PEAR::isError($res)) { - switch ($res->getCode()) { - // non fatal: - case TRERR_XR_FAIL: - break; - // fatal: - default: - $trec->fail('', $res); - } - } - return $res; - } - - - /** - * Clean up transport jobs - * - * @param string $interval - * psql time interval - older closed jobs will be deleted - * @param boolean $forced - * if true, delete non-closed jobs too - * @return boolean true or error - */ - function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE) - { - global $CC_CONFIG, $CC_DBC; - $cond = ($forced ? '' : " AND state='closed' AND lock = 'N'"); - $r = $CC_DBC->query(" - DELETE FROM ".$CC_CONFIG['transTable']." - WHERE ts < now() - interval '$interval'".$cond - ); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /** - * Logging wrapper for PEAR error object - * - * @param string $txt - * log message - * @param PEAR_Error $eo - * @param array $row - * array returned from getRow - * @return mixed - * void or error object - */ - function trLogPear($txt, $eo, $row=NULL) - { - $msg = $txt.$eo->getMessage()." ".$eo->getUserInfo(). - " [".$eo->getCode()."]"; - if (!is_null($row)) { - $trec = TransportRecord::recall($this, $row['trtok']); - if (!PEAR::isError($trec)) { - $trec->setState('failed', array('errmsg'=>$msg)); - } - $msg .= "\n ".serialize($row); - } - $this->trLog($msg); - } - - - /** - * Logging for debug transports - * - * @param string $msg - * log message - * @return mixed - * void or error object - */ - function trLog($msg) - { - global $CC_CONFIG; - $logfile = $CC_CONFIG['transDir']."/activity.log"; - if (FALSE === ($fp = fopen($logfile, "a"))) { - return PEAR::raiseError( - "Transport::trLog: Can't write to log ($logfile)" - ); - } - flock($fp,LOCK_SH); - fputs($fp, "---".date("H:i:s")."---\n $msg\n"); - flock($fp,LOCK_UN); - fclose($fp); - } - - - /* ====================================================== install methods */ - /** - * Delete all transports - * - * @return mixed - * void or error object - */ - function resetData() - { - global $CC_CONFIG, $CC_DBC; - return $CC_DBC->query("DELETE FROM ".$CC_CONFIG['transTable']); - } - -} - -?> \ No newline at end of file diff --git a/backend/TransportRecord.php b/backend/TransportRecord.php deleted file mode 100644 index 6c804279c..000000000 --- a/backend/TransportRecord.php +++ /dev/null @@ -1,419 +0,0 @@ -tr =& $tr; - $this->gb =& $tr->gb; - } - - - /** - * Factory method - * - * @param Transport $tr - * @param string $trtype - * transport type (see Transport::install) - * @param string $direction - * 'up' | 'down' - * @param array $defaults - * default parameters (optional, internal use) - * @return TransportRecord - */ - function create(&$tr, $trtype, $direction='up', $defaults=array()) - { - global $CC_DBC, $CC_CONFIG; - $trec = new TransportRecord($tr); - $trec->trtok = $trtok = $tr->_createTransportToken(); - $trec->row = array_merge($defaults, - array('trtype'=>$trtype, 'direction'=>$direction)); - $trec->recalled = TRUE; - if (!isset($defaults['title'])) { - $defaults['title'] = $trec->getTitle(); - if (PEAR::isError($defaults['title'])) { - return $defaults['title']; - } - } - $id = $CC_DBC->nextId($CC_CONFIG['transSequence']); - $names = "id, trtok, direction, state, trtype, start, ts"; - $values = "$id, '$trtok', '$direction', 'init', '$trtype', now(), now()"; - foreach ($defaults as $k => $v) { - $sqlVal = $trec->_getSqlVal($k, $v); - $names .= ", $k"; - $values .= ", $sqlVal"; - } - $query = " - INSERT INTO ".$CC_CONFIG['transTable']." - ($names) - VALUES - ($values) - "; - $res = $CC_DBC->query($query); - if (PEAR::isError($res)) { - return $res; - } - return $trec; - } - - - /** - * Recall transport record from DB - * - * @param Transport $tr - * @param string $trtok - * transport token - * @return TransportRecord - */ - function recall(&$tr, $trtok) - { - global $CC_DBC, $CC_CONFIG; - $trec = new TransportRecord($tr); - $trec->trtok = $trtok; - $row = $CC_DBC->getRow(" - SELECT - id, trtok, state, trtype, direction, - to_hex(gunid)as gunid, to_hex(pdtoken)as pdtoken, - fname, localfile, url, rtrtok, mdtrtok, uid, - expectedsize, realsize, expectedsum, realsum, - errmsg, title, jobpid - FROM ".$CC_CONFIG['transTable']." - WHERE trtok='$trtok' - "); - if (PEAR::isError($row)) { - return $row; - } - if (is_null($row)) { - return PEAR::raiseError("TransportRecord::recall:". - " invalid transport token ($trtok)", TRERR_TOK - ); - } - $row['pdtoken'] = StoredFile::NormalizeGunid($row['pdtoken']); - $row['gunid'] = StoredFile::NormalizeGunid($row['gunid']); - $trec->row = $row; - $trec->recalled = TRUE; - return $trec; - } - - - /** - * Set state of transport record - * - * @param string $newState - * @param array $data - * other data fields to set - * @param string $oldState - * check old state and do nothing if differ - * @param boolean $lock - * check lock and do nothing if differ - * @return boolean success - */ - function setState($newState, $data=array(), $oldState=NULL, $lock=NULL) - { - global $CC_CONFIG, $CC_DBC; - $set = " state='$newState', ts=now()"; - if (!is_null($lock)) { - $slock = ($lock ? 'Y' : 'N'); - $nlock = (!$lock); - $snlock = ($nlock ? 'Y' : 'N'); - $set .= ", lock='$snlock'"; - } - foreach ($data as $k => $v) { - $set .= ", $k=".$this->_getSqlVal($k, $v); - } - $r = $CC_DBC->query(" - UPDATE ".$CC_CONFIG['transTable']." - SET $set - WHERE trtok='{$this->trtok}'". - (is_null($oldState) ? '' : " AND state='$oldState'"). - (is_null($lock) ? '' : " AND lock = '$slock'") - ); - if (PEAR::isError($r)) { - return $r; - } - // return TRUE; - $affRows = $CC_DBC->affectedRows(); - if (PEAR::isError($affRows)) { - return $affRows; - } - return ($affRows == 1); - } - - - /** - * Return state of transport record - * - * @return string - * state - */ - function getState() - { - if (!$this->recalled) { - return PEAR::raiseError("TransportRecord::getState:". - " not recalled ({$this->trtok})", TRERR_TOK - ); - } - return $this->row['state']; - } - - - /** - * Set lock on transport record and save/clear process id - * - * @param boolean $lock - * lock if true, release lock if false - * @param int $pid - * process id - * @return mixed - * true or error - */ - function setLock($lock, $pid=NULL) - { - global $CC_CONFIG, $CC_DBC; - $pidsql = (is_null($pid) ? "NULL" : "$pid" ); - if ($this->dropped) { - return TRUE; - } - $slock = ($lock ? 'Y' : 'N'); - $nlock = (!$lock); - $snlock = ($nlock ? 'Y' : 'N'); - $r = $CC_DBC->query(" - UPDATE ".$CC_CONFIG['transTable']." - SET lock='$slock', jobpid=$pidsql, ts=now() - WHERE trtok='{$this->trtok}' AND lock = '$snlock'" - ); - if (PEAR::isError($r)) { - return $r; - } - $affRows = $CC_DBC->affectedRows(); - if (PEAR::isError($affRows)) { - return $affRows; - } - if ($affRows === 0) { - $ltxt = ($lock ? 'lock' : 'unlock' ); - return PEAR::raiseError( - "TransportRecord::setLock: can't $ltxt ({$this->trtok})" - ); - } - return TRUE; - } - - - /** - * Return type of transport - * - * @return string - * Transport type - */ - function getTransportType() - { - if (!$this->recalled) { - return PEAR::raiseError("TransportRecord::getTransportType:". - " not recalled ({$this->trtok})", TRERR_TOK - ); - } - return $this->row['trtype']; - } - - - /** - * Kill transport job (on pause or cancel) - * - * @return string - * Transport type - */ - function killJob() - { - if (!$this->recalled) { - return PEAR::raiseError("TransportRecord::getTransportType:". - " not recalled ({$this->trtok})", TRERR_TOK - ); - } - $jobpid = $this->row['jobpid']; - $res = system("pkill -P $jobpid", $status); - } - - - /** - * Set state to failed and set error message in transport record - * - * @param string $txt - * base part of error message - * @param PEAR_Error $eo - * (opt.) error msg can be construct from it - * @return mixed - * boolean true or error - */ - function fail($txt='', $eo=NULL) - { - if (!$this->recalled) { - return PEAR::raiseError("TransportRecord::fail:". - " not recalled ({$this->trtok})", TRERR_TOK - ); - } - $msg = $txt; - if (!is_null($eo)) { - $msg .= $eo->getMessage()." ".$eo->getUserInfo(). - " [".$eo->getCode()."]"; - } - $r = $this->setState('failed', array('errmsg'=>$msg)); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /** - * Close transport record - * - * @return mixed - * boolean true or error - */ - function close() - { - global $CC_CONFIG, $CC_DBC; - if (!$this->recalled) { - return PEAR::raiseError("TransportRecord::close:". - " not recalled ({$this->trtok})", TRERR_TOK - ); - } - if (TR_LEAVE_CLOSED) { - $r = $this->setState('closed'); - if (PEAR::isError($r)) { - return $r; - } - } else { - $r = $CC_DBC->query(" - DELETE FROM ".$CC_CONFIG['transTable']." - WHERE trtok='{$this->trtok}' - "); - if (PEAR::isError($r)) { - return $r; - } - $this->recalled = FALSE; - $this->dropped = TRUE; - } - return TRUE; - } - - - /** - * Add field specific envelopes to values (e.g. ' around strings) - * - * @param string $fldName - * field name - * @param mixed $fldVal - * field value - * @return string - */ - function _getSqlVal($fldName, $fldVal) - { - switch ($fldName) { - case 'realsize': - case 'expectedsize': - case 'uid': - return ("$fldVal"!='' ? "$fldVal" : "NULL"); - break; - case 'gunid': - case 'pdtoken': - return "x'$fldVal'::bigint"; - break; - default: - $fldVal = pg_escape_string($fldVal); - return "'$fldVal'"; - break; - } - } - - - /** - * Get title from transported object's metadata (if exists) - * - * @return string - * the title or descriptive string - */ - function getTitle() - { - $defStr = 'unknown'; - $trtype = $this->getTransportType(); //contains recall check - if (PEAR::isError($trtype)) { - return $trtype; - } - switch ($trtype) { - case "audioclip": - case "playlist": - case "playlistPkg": - case "metadata": - $title = $this->gb->bsGetTitle(NULL, $this->row['gunid']); - if (is_null($title)) { - $title = $defStr; - } - if (PEAR::isError($title)) { - if ($title->getCode() == GBERR_FOBJNEX) { - $title = $defStr; - } else { - return $title; - } - } - break; - case "searchjob": - $title = 'searchjob'; - break; - case "file": - $title = ( isset($this->row['localfile']) ? - basename($this->row['localfile']) : 'regular file'); - break; - default: - $title = $defStr; - } - return $title; - } - -} // class TransportRecord -?> \ No newline at end of file diff --git a/backend/Validator.php b/backend/Validator.php deleted file mode 100644 index d730aee10..000000000 --- a/backend/Validator.php +++ /dev/null @@ -1,385 +0,0 @@ - - *
  • audioClipFormat.php
  • - *
  • webstreamFormat.php
  • - *
  • playlistFormat.php
  • - * - * It probably should be replaced by XML schema validation in the future. - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - */ -class Validator { - /** - * Format type of validated document - * @var string - */ - private $format = NULL; - - /** - * Preloaded format tree structure - * @var array - */ - private $formTree = NULL; - - /** - * Gunid of validated file for identification in mass input - * @var string - */ - private $gunid = NULL; - - - /** - * Constructor - * - * @param string $format - * format type of validated document - * @param string $gunid - * gunid of validated file for identification in mass input - */ - public function __construct($format, $gunid) - { - $format = strtolower($format); - $this->format = $format; - $this->gunid = $gunid; - $formats = array( - 'audioclip' => "audioClipFormat", - 'playlist' => "playlistFormat", - 'webstream' => "webstreamFormat", - ); - if (!isset($formats[$format])) { - return $this->_err(VAL_FORMAT); - } - $formatName = $formats[$format]; - $formatFile = dirname(__FILE__)."/$formatName.php"; - if (!file_exists($formatFile)) { - return $this->_err(VAL_FORMAT); - } - require($formatFile); - $this->formTree = $$formatName; - } - - - /** - * Validate document - only wrapper for validateNode method - * - * @param object $data - * validated object tree - * @return mixed - * TRUE or PEAR::error - */ - function validate(&$data) - { - $r = $this->validateNode($data, $this->formTree['_root']); - return $r; - } - - - /** - * Validate one metadata value (on insert/update) - * - * @param string $fname - * parent element name - * @param string $category - * qualif.category name - * @param string $predxml - * 'A' | 'T' (attr or tag) - * @param string $value - * validated element value - * @return TRUE|PEAR_Error - */ - function validateOneValue($fname, $category, $predxml, $value) - { - $formTree =& $this->formTree; - switch ($predxml) { - case 'T': - if (!$this->isChildInFormat($fname, $category)) { - return $this->_err(VAL_UNKNOWNE, "$category in $fname"); - } - break; - case 'A': - if (!$this->isAttrInFormat($fname, $category)) { - return $this->_err(VAL_UNKNOWNA, "$category in $fname"); - } - break; - case 'N': - return TRUE; - break; - default: - return $this->_err(VAL_PREDXML, $predxml); - } - if (isset($formTree[$category]['regexp'])) { - // echo "XXX {$formTree[$fname]['regexp']} / ".$node->content."\n"; - if (!preg_match("|{$formTree[$category]['regexp']}|", $value)) { - return $this->_err(VAL_CONTENT, "$category/$value"); - } - } - } - - - /** - * Validation of one element node from object tree - * - * @param object $node - * validated node - * @param string $fname - * actual name in format structure - * @return mixed - * TRUE or PEAR::error - */ - function validateNode(&$node, $fname) - { - $dname = (($node->ns? $node->ns.":" : '').$node->name); - $formTree =& $this->formTree; - if (DEBUG) { - echo"\nVAL::validateNode: 1 $dname/$fname\n"; - } - // check root node name: - if ($dname != $fname) { - return $this->_err(VAL_ROOT, $fname); - } - // check if this element is defined in format: - if (!isset($formTree[$fname])) { - return $this->_err(VAL_NOTDEF, $fname); - } - // check element content - if (isset($formTree[$fname]['regexp'])) { - // echo "XXX {$formTree[$fname]['regexp']} / ".$node->content."\n"; - if (!preg_match("|{$formTree[$fname]['regexp']}|", $node->content)) { - return $this->_err(VAL_CONTENT, "$fname/{$node->content}"); - } - } - // validate attributes: - $ra = $this->validateAttributes($node, $fname); - if (PEAR::isError($ra)) { - return $ra; - } - // validate children: - $r = $this->validateChildren($node, $fname); - if (PEAR::isError($r)) { - return $r; - } - return TRUE; - } - - - /** - * Validation of attributes - * - * @param object $node - * validated node - * @param string $fname - * actual name in format structure - * @return mixed - * TRUE or PEAR::error - */ - function validateAttributes(&$node, $fname) - { - $formTree =& $this->formTree; - $attrs = array(); - // check if all attrs are permitted here: - foreach ($node->attrs as $i => $attr) { - $aname = (($attr->ns? $attr->ns.":" : '').$attr->name); - $attrs[$aname] =& $node->attrs[$i]; - if (!$this->isAttrInFormat($fname, $aname)) { - return $this->_err(VAL_UNKNOWNA, $aname); - } - // check attribute format - // echo "XXA $aname\n"; - if (isset($formTree[$aname]['regexp'])) { - // echo "XAR {$formTree[$fname]['regexp']} / ".$node->content."\n"; - if (!preg_match("|{$formTree[$aname]['regexp']}|", $attr->val)) { - return $this->_err(VAL_ATTRIB, "$aname [".var_export($attr->val,TRUE)."]"); - } - } - } - // check if all required attrs are here: - if (isset($formTree[$fname]['attrs'])) { - $fattrs =& $formTree[$fname]['attrs']; - if (isset($fattrs['required'])) { - foreach ($fattrs['required'] as $i => $attr) { - if (!isset($attrs[$attr])) { - return $this->_err(VAL_NOREQA, $attr); - } - } - } - } - return TRUE; - } - - - /** - * Validation children nodes - * - * @param object $node - * validated node - * @param string $fname - * actual name in format structure - * @return mixed - * TRUE or PEAR::error - */ - function validateChildren(&$node, $fname) - { - $formTree =& $this->formTree; - $childs = array(); - // check if all children are permitted here: - foreach ($node->children as $i => $ch) { - $chname = (($ch->ns? $ch->ns.":" : '').$ch->name); - // echo "XXE $chname\n"; - if (!$this->isChildInFormat($fname, $chname)) { - return $this->_err(VAL_UNKNOWNE, $chname); - } - // call children recursive: - $r = $this->validateNode($node->children[$i], $chname); - if (PEAR::isError($r)) { - return $r; - } - $childs[$chname] = TRUE; - } - // check if all required children are here: - if (isset($formTree[$fname]['childs'])) { - $fchilds =& $formTree[$fname]['childs']; - if (isset($fchilds['required'])) { - foreach ($fchilds['required'] as $i => $ch) { - if (!isset($childs[$ch])) return $this->_err(VAL_NOREQE, $ch); - } - } - // required one from set - if (isset($fchilds['oneof'])) { - $one = FALSE; - foreach ($fchilds['oneof'] as $i => $ch) { - if (isset($childs[$ch])) { - if ($one) { - return $this->_err(VAL_UNEXPONEOF, "$ch in $fname"); - } - $one = TRUE; - } - } - if (!$one) { - return $this->_err(VAL_NOONEOF); - } - } - } - return TRUE; - } - - - /** - * Test if child is presented in format structure - * - * @param string $fname - * node name in format structure - * @param string $chname - * child node name - * @return boolean - */ - function isChildInFormat($fname, $chname) - { - $listo = $this->isInFormatAs($fname, $chname, 'childs', 'optional'); - $listr = $this->isInFormatAs($fname, $chname, 'childs', 'required'); - $list1 = $this->isInFormatAs($fname, $chname, 'childs', 'oneof'); - return ($listo!==FALSE || $listr!==FALSE || $list1!==FALSE); - } - - - /** - * Test if attribute is presented in format structure - * - * @param string $fname - * node name in format structure - * @param string $aname - * attribute name - * @return boolean - */ - function isAttrInFormat($fname, $aname) - { - $listr = $this->isInFormatAs($fname, $aname, 'attrs', 'required'); - $listi = $this->isInFormatAs($fname, $aname, 'attrs', 'implied'); - $listn = $this->isInFormatAs($fname, $aname, 'attrs', 'normal'); - return ($listr!==FALSE || $listi!==FALSE || $listn!==FALSE); - } - - - /** - * Check if node/attribute is presented in format structure - * - * @param string $fname - * node name in format structure - * @param string $chname - * node/attribute name - * @param string $nType - * 'childs' | 'attrs' - * @param string $reqType - *
      - *
    • for elements: 'required' | 'optional' | 'oneof'
    • - *
    • for attributes: 'required' | 'implied' | 'normal'
    • - *
    - * @return mixed - * boolean/int (index int format array returned if found) - */ - function isInFormatAs($fname, $chname, $nType='childs', $reqType='required') - { - $formTree =& $this->formTree; - $listed = ( - isset($formTree[$fname][$nType][$reqType]) ? - array_search($chname, $formTree[$fname][$nType][$reqType]) : - FALSE - ); - return $listed; - } - - - /** - * Error exception generator - * - * @param int $errno - * erron code - * @param string $par - * optional string for more descriptive error messages - * @return PEAR_Error - */ - function _err($errno, $par='') - { - $msg = array( - VAL_ROOT => 'Wrong root element', - VAL_NOREQE => 'Required element missing', - VAL_NOONEOF => 'One-of element missing', - VAL_UNKNOWNE => 'Unknown element', - VAL_UNKNOWNA => 'Unknown attribute', - VAL_NOTDEF => 'Not defined', - VAL_UNEXPONEOF => 'Unexpected second object from one-of set', - VAL_FORMAT => 'Unknown format', - VAL_CONTENT => 'Invalid content', - VAL_NOREQA => 'Required attribute missing', - VAL_ATTRIB => 'Invalid attribute format', - VAL_PREDXML => 'Invalid predicate type', - ); - return PEAR::raiseError( - "Validator: {$msg[$errno]} #$errno ($par, gunid={$this->gunid})", - $errno - ); - } - - -} // class Validator - -?> \ No newline at end of file diff --git a/backend/XmlParser.php b/backend/XmlParser.php deleted file mode 100644 index 7d440460b..000000000 --- a/backend/XmlParser.php +++ /dev/null @@ -1,398 +0,0 @@ -ns = $a['namespace']; - $this->name = $a['localPart']; - $this->attrs = $attrs; - $this->nSpaces = $nSpaces; - $this->children = $children; - } -} // class XmlElement - - -/* ================================================================ Attribute */ -/** - * Object representation of one XML attribute - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @see MetaData - */ -class XmlAttrib { - /** - * Namespace prefix - * @var string - */ - public $ns; - - /** - * Attribute name - * @var string - */ - public $name; - - /** - * Attribute value - * @var string - */ - public $val; - - /** - * @param string $atns - * namespace prefix - * @param string $atnm - * attribute name - * @param string $atv - * attribute value - */ - public function __construct($atns, $atnm, $atv) - { - $this->ns = $atns; - $this->name = $atnm; - $this->val = $atv; - } -} // fn XmlAttrib - - -/* =================================================================== Parser */ -/** - * XML parser object encapsulation - * - * @package Campcaster - * @subpackage StorageServer - * @copyright 2010 Sourcefabric O.P.S. - * @license http://www.gnu.org/licenses/gpl.txt - * @see MetaData - */ -class XmlParser { - /** - * Tree of nodes - * @var array - */ - private $tree = NULL; - - /** - * Parse stack - * @var array - */ - private $stack = array(); - - /** - * Error structure - * @var array - */ - private $err = array(FALSE, ''); - - /** - * @param string $data - * XML string to be parsed - */ - public function __construct($data){ - $xml_parser = xml_parser_create('UTF-8'); - xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, FALSE); - xml_set_object($xml_parser, $this); - xml_set_element_handler($xml_parser, "startTag", "endTag"); - xml_set_character_data_handler($xml_parser, 'characterData'); - $res = xml_parse($xml_parser, $data, TRUE); - if (!$res) { - $this->err = array(TRUE, - sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser) - ) - ); - // var_dump($data); - } - xml_parser_free($xml_parser); - } - - - /** - * Parse XML file or string - * - * @param string $data - * local path to XML file or XML string - * @param string $loc - * location: 'file'|'string' - * @return array - * reference, parse result tree (or PEAR::error) - */ - function &parse($data='', $loc='file') - { - switch ($loc) { - case "file": - if (!is_file($data)) { - return PEAR::raiseError( - "XmlParser::parse: file not found ($data)" - ); - } - if (!is_readable($data)) { - return PEAR::raiseError( - "XmlParser::parse: can't read file ($data)" - ); - } - $data = file_get_contents($data); - case "string": - $parser = new XmlParser($data); - if ($parser->isError()) { - return PEAR::raiseError( - "XmlParser::parse: ".$parser->getError() - ); - } - $tree = $parser->getTree(); - break; - default: - return PEAR::raiseError( - "XmlParser::parse: unsupported source location ($loc)" - ); - } - return $tree; - } - - - /** - * Start tag handler - * - * @param resource $parser - * reference to parser resource - * @param string $fullname - * element name - * @param array $attrs - * array of attributes - * @return none - */ - function startTag($parser, $fullname, $attrs) { - $nSpaces = array(); - foreach ($attrs as $atn => $atv) { - $a = XML_Util::splitQualifiedName($atn); - $atns = $a['namespace']; - $atnm = $a['localPart']; - unset($attrs[$atn]); - if ($atns == 'xmlns') { - $nSpaces[$atnm] = $atv; - } else if ($atns == NULL && $atnm == 'xmlns') { - $nSpaces[''] = $atv; - } else { - $attrs[$atn] = new XmlAttrib($atns, $atnm, $atv); - } - } - $el = new XmlElement($fullname, $attrs, $nSpaces); - array_push($this->stack, $el); - } - - - /** - * End tag handler - * - * @param resource $parser - * reference to parser resource - * @param string $fullname - * element name - * @return none - */ - function endTag($parser, $fullname) { - $cnt = count($this->stack); - if ($cnt > 1) { - $this->stack[$cnt-2]->children[] = $this->stack[$cnt-1]; - $lastEl = array_pop($this->stack); - } else { - $this->tree = $this->stack[0]; - } - } - - - /** - * Character data handler - * - * @param resource $parser - * reference to parser resource - * @param string $data - * @return none - */ - function characterData($parser, $data) { - $cnt = count($this->stack); - if (trim($data)!='') { - $this->stack[$cnt-1]->content .= $data; - } - } - - - /** - * Default handler - * - * @param resource $parser - * reference to parser resource - * @param string $data - * @return none - */ - function defaultHandler($parser, $data) - { - $cnt = count($this->stack); - //if(substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";"){ - // $this->stack[$cnt-1]->content .= trim($data); - //}else{ - $this->stack[$cnt-1]->content .= "*** $data ***"; - //} - } - - - /** - * Return result tree - * - * @return array - * tree structure - */ - function getTree() - { - return $this->tree; - } - - - /** - * Return error string - * - * @return boolean - * whether error occured - */ - function isError() - { - return $this->err[0]; - } - - - /** - * Return error string - * - * @return string - * error message - */ - function getError() - { - return $this->err[1]; - } - - - /* ----------------------------------- auxiliary methos for serialization */ - /** - * Serialize metadata of one file - * - * @return string, serialized XML - */ - function serialize() - { - $res = ''; - $res .= $this->serializeEl($this->tree); - $res .= "\n"; - return $res; - } - - - /** - * Serialize one metadata element - * - * @param el object, element object - * @param lvl int, level for indentation - * @return string, serialized XML - */ - function serializeEl($el, $lvl=0) - { - $ind = str_repeat(" ", $lvl); - $elNs = $el->ns; - $elName = $el->name; - $attrs = XML_Util::attributesToString($el->attrs); - $fullName = ($elNs=='' ? '' : "$elNs:")."$elName"; - $res = "\n{$ind}<{$fullName}{$attrs}>"; - $haveCh = (count($el->children)>0); - foreach ($el->children as $ch) { - $res .= $this->serializeEl($ch, $lvl+1); - } - $res .= XML_Util::replaceEntities("{$el->content}"); - if ($haveCh) { - $res .= "\n{$ind}"; - } - $res .= ""; - return $res; - } - - - /* -------------------------------------------------------- debug methods */ - /** - * Debug dump of tree - * - * @return hash, tree structure - */ - function dump() - { - var_dump($this->tree); - } - -} -?> \ No newline at end of file diff --git a/backend/audioClipFormat.php b/backend/audioClipFormat.php deleted file mode 100644 index f7fd506b7..000000000 --- a/backend/audioClipFormat.php +++ /dev/null @@ -1,328 +0,0 @@ -'audioClip', - 'audioClip'=>array( - 'childs'=>array( - 'required'=>array('metadata'), - ), - ), - 'metadata'=>array( - 'childs'=>array( - 'required'=>array( - 'dc:title', 'dcterms:extent' - ), - 'optional'=>array( - 'dc:identifier', - 'dc:creator', 'dc:source', 'ls:genre', - 'ls:year', 'dc:type', 'dc:description', 'dc:format', - 'ls:bpm', 'ls:rating', 'ls:encoded_by', 'ls:track_num', - 'ls:disc_num', 'ls:disc_num', 'dc:publisher', 'ls:composer', - 'ls:bitrate', 'ls:channels', 'ls:samplerate', 'ls:encoder', - 'ls:crc', 'ls:lyrics', 'ls:orchestra', 'ls:conductor', - 'ls:lyricist', 'ls:originallyricist', 'ls:radiostationname', - 'ls:audiofileinfourl', 'ls:artisturl', 'ls:audiosourceurl', - 'ls:radiostationurl', 'ls:buycdurl', 'ls:isrcnumber', - 'ls:catalognumber', 'ls:originalartist', 'dc:rights', - 'ls:license', 'dc:title', 'dcterms:temporal', - 'dcterms:spatial', 'dcterms:entity', 'dc:description', - 'dc:creator', 'dc:subject', 'dc:type', 'dc:format', - 'dc:contributor', 'dc:language', 'dc:rights', - 'dcterms:isPartOf', 'dc:date', - 'dc:publisher', - // extra - 'dcterms:alternative', 'ls:filename', 'ls:mtime', - // added lately by sebastian - 'ls:mood', - ), - ), - 'namespaces'=>array( - 'dc'=>"http://purl.org/dc/elements/1.1/", - 'dcterms'=>"http://purl.org/dc/terms/", - 'xbmf'=>"http://www.streamonthefly.org/xbmf", - 'xsi'=>"http://www.w3.org/2001/XMLSchema-instance", - 'xml'=>"http://www.w3.org/XML/1998/namespace", - ), - ), - 'dc:identifier'=>array( - 'type'=>'Text', - 'auto'=>TRUE, - ), - 'dc:title'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:alternative'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:extent'=>array( - 'type'=>'Time', -// 'regexp'=>'^\d{2}:\d{2}:\d{2}.\d{6}$', - 'regexp'=>'^((\d{1,2}:)?\d{1,2}:)?\d{1,20}(.\d{1,6})?$', - ), - 'dc:creator'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:source'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:genre'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:year'=>array( - 'type'=>'Menu', - 'area'=>'Music', - ), - 'dc:type'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:description'=>array( - 'type'=>'Longtext', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:format'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:bpm'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:rating'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:encoded_by'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:track_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:disc_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:disc_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:publisher'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:composer'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:bitrate'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:channels'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:samplerate'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:encoder'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:crc'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:lyrics'=>array( - 'type'=>'Longtext', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:orchestra'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:conductor'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:lyricist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:originallyricist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:radiostationname'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:audiofileinfourl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:artisturl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:audiosourceurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:radiostationurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:buycdurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:isrcnumber'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:catalognumber'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:originalartist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:rights'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:license'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:title'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:temporal'=>array( - 'type'=>'Time/Date', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:spatial'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:entity'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:description'=>array( - 'type'=>'Longtext', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:creator'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:subject'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:type'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:format'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:contributor'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:language'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:rights'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:isPartOf'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:date'=>array( - 'type'=>'Date', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:publisher'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - - 'ls:filename'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:mtime'=>array( - 'type'=>'Int', -// 'regexp'=>'^\d{4}(-\d{2}(-\d{2}(T\d{2}:\d{2}(:\d{2}\.\d+)?(Z)|([\+\-]?\d{2}:\d{2}))?)?)?$', - ), -); - -?> \ No newline at end of file diff --git a/backend/configure b/backend/configure deleted file mode 100755 index 30c0822dd..000000000 --- a/backend/configure +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Run this script to configure the environment. -# -# This script in effect calls the real automake / autoconf configure script -#------------------------------------------------------------------------------- - -# assume we're in $basedir -reldir=`dirname $0` -basedir=`cd $reldir; pwd;` -test -z "$basedir" && basedir=. - -bindir=$basedir/bin -tmpdir=$basedir/tmp - - -autogen=$bindir/autogen.sh -configure=$tmpdir/configure - -if [ ! -x $configure ]; then - (cd $basedir && $autogen $*) -fi - -(cd $tmpdir && $configure $*) - diff --git a/backend/cron/Cron.php b/backend/cron/Cron.php deleted file mode 100755 index fba702b62..000000000 --- a/backend/cron/Cron.php +++ /dev/null @@ -1,214 +0,0 @@ - - * $cron = new Cron(); - * $access = $cron->openCrontab('write'); - * if ($access != 'write') { - * do { - * $access = $cron->forceWriteable(); - * } while ($access != 'write'); - * } - * $cron->addCronJob('*','*','*','*','*', - * 'ClassName', - * array('first','secound','third') - * ); - * $cron->closeCrontab(); - *
    - * @package Campcaster - * @subpackage StorageServer.Cron - */ -class Cron { - /** - * @var Crontab - */ - public $ct; - - /** - * @var array This array created with getCommand() function - */ - private $params; - - /** - * @var string available values: read | write - */ - private $ctAccess = 'read'; - - private $lockfile; - private $cronfile; - private $paramdir; - private $cronUserName; - - /** - * Constructor - */ - function Cron() { - global $CC_CONFIG; - $this->lockfile = $CC_CONFIG['lockfile']; - $this->cronfile = $CC_CONFIG['cronfile']; - $this->paramdir = $CC_CONFIG['paramdir']; - $this->cronUserName = $CC_CONFIG['cronUserName']; - } - - - /* ==================================================== Cronjob functions */ - /** - * Add a cronjob to the crontab - * - * @access public - * @param string $m minute - * @param string $h hour - * @param string $dom day of month - * @param string $mo month - * @param string $dow day of week - * @param string $className name of class, which's execute() is called by croncall.php - * @param string $params the parameter(s) - * @return bool true if success else PEAR error. - */ - function addCronJob($m, $h, $dom, $mo, $dow, $className, $params) - { - if ($this->ctAccess == 'write') { - $this->ct->addCron($m, $h, $dom, $mo, $dow, - $this->getCommand($className, $params)); - return true; - } else { - return PEAR::raiseError('CronJob::addCronJob : '. - 'The crontab is not writable'); - } - } - - /** - * This function return with the active cronjobs - * - * @access public - * @return array array of cronjob struct - */ - function listCronJob() - { - return $this->ct->getByType(CRON_CMD); - } - - /** - * Remove a cronjob. - * - * @access public - * @param int $index index of the cronjobs' array. - * @return bool true if success else PEAR error. - */ - function removeCronJob($index) - { - if ($this->ctAccess == 'write') { - $this->crontab->delEntry($index); - return true; - } else { - return PEAR::raiseError('CronJob::removeCronJob : '. - 'The crontab is not writable'); - } - } - - /* ==================================================== Crontab functions */ - /** - * Open the crontab - * - * @access public - * @param string $access only for listing 'read', for add and delete 'write' - * @return string sucessed access - available values read | write - */ - function openCrontab($access = 'read') - { - $access = strtolower($access); - $this->ct = new Crontab($this->cronUserName); - if ($access == 'write' && - $this->isCrontabWritable() && - $this->lockCrontab()) { - $this->ctAccess = $access; - } else { - $this->ctAccess = 'read'; - } - return $this->ctAccess; - } - - /** - * Close the crontab - * - * @access public - * @return bool true if everything is ok, false is the lock file can't delete - */ - function closeCrontab() - { - if ($this->ctAccess == 'write') { - $this->ct->writeCrontab(); - } - return $this->ctAccess == 'write' ? $this->unlockCrontab() : true; - } - - /** - * Check the crontab is writable - * - * @access private - * @return bool - */ - function isCrontabWritable() - { - return !is_file($this->lockfile); - } - - /** - * Try to lock the crontab - * - * @access private - * @return bool true if the locking is success - */ - function lockCrontab() - { - return @touch($this->lockfile); - } - - /** - * Try to unlock the crontab - * - * @access private - * @return bool true if the unlocking is success - */ - function unlockCrontab() - { - return unlink($this->lockfile); - } - - /** - * If the crontab opened with read access. This function force set - * the access to write. - * - * @access public - * @return bool true if the setting is success - */ - function forceWriteable() - { - if ($this->isCrontabWritable() && $this->lockCrontab()) { - $this->ctAccess = 'write'; - return true; - } - return false; - } - - /* ======================================================= Misc functions */ - /** - * Get the shell command for the cronjob - * - * @param string $className name of the class what is called by croncall.php - * @param mixed $params with this parameter could be called the execute() of class - * @return string shell command - */ - function getCommand($className, $params) - { - $this->params = array ( - 'class' => $className, - 'params' => $params - ); - return $this->cronfile.' "'.str_replace('"','\"',serialize($this->params)).'"'; - } -} -?> \ No newline at end of file diff --git a/backend/cron/CronJob.php b/backend/cron/CronJob.php deleted file mode 100755 index bcd1c82d6..000000000 --- a/backend/cron/CronJob.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/backend/cron/Crontab.php b/backend/cron/Crontab.php deleted file mode 100755 index 92b40ac38..000000000 --- a/backend/cron/Crontab.php +++ /dev/null @@ -1,284 +0,0 @@ - "value" - * or a line can be a comment (string beginning with #) - * or it can be a special command (beginning with an @) - * @var array - */ - private $crontabs; - - /** - * The user for whom the crontab will be manipulated - * @var string - */ - private $user; - - /** - * Lists the type of line of each line in $crontabs. - * can be: any of the CRON_* constants. - * so $linetype[5] is the type of $crontabs[5]. - * @var string - */ - private $linetypes; - - // }}} - - /** - * Constructor - * - * Initialises $this->crontabs - * - * @param string $user the user for whom the crontab will be manipulated - */ - function Crontab($user) - { - $this->user = $user; - $this->readCrontab(); - } - - /** - * This reads the crontab of $this->user and parses it in $this->crontabs - * - */ - function readCrontab() - { - // return code is 0 or 1 if crontab was empty, elsewhere stop here - $cmd = "crontab -u {$this->user} -l"; - @exec("crontab -u {$this->user} -l", $crons, $return); - if ($return > 1) { - return PEAR::raiseError("*** Can't read crontab ***\n". - " Set crontab manually!\n"); - } - - foreach ($crons as $line) - { - $line = trim($line); // discarding all prepending spaces and tabs - - // empty lines.. - if (!$line) { - $this->crontabs[] = "empty line"; - $this->linetypes[] = CRON_EMPTY; - continue; - } - - // checking if this is a comment - if ($line[0] == "#") { - $this->crontabs[] = trim($line); - $this->linetypes[] = CRON_COMMENT; - continue; - } - - // Checking if this is an assignment - if (ereg("(.*)=(.*)", $line, $assign)) { - $this->crontabs[] = array ("name" => $assign[1], "value" => $assign[2]); - $this->linetypes[] = CRON_ASSIGN; - continue; - } - - // Checking if this is a special @-entry. check man 5 crontab for more info - if ($line[0] == '@') { - $this->crontabs[] = split("[ \t]", $line, 2); - $this->linetypes[] = CRON_SPECIAL; - continue; - } - - // It's a regular crontab-entry - $ct = split("[ \t]", $line, 6); - $this->addCron($ct[0], $ct[1], $ct[2], $ct[3], $ct[4], $ct[5]); - } - } - - /** - * Writes the current crontab - */ - function writeCrontab() - { - global $DEBUG, $PATH; - - if (empty($this->linetypes)) { - return; - } - $filename = ($DEBUG ? tempnam("$PATH/crons", "cron") : tempnam("/tmp", "cron")); - $file = fopen($filename, "w"); - - foreach($this->linetypes as $i => $line) { - switch ($this->linetypes[$i]) { - case CRON_COMMENT: - $line = $this->crontabs[$i]; - break; - case CRON_ASSIGN: - $line = $this->crontabs[$i][name]." = ".$this->crontabs[$i][value]; - break; - case CRON_CMD: - $line = implode(" ", $this->crontabs[$i]); - break; - case CRON_SPECIAL: - $line = implode(" ", $this->crontabs[$i]); - break; - case CRON_EMPTY: - $line = "\n"; // an empty line in the crontab-file - break; - default: - unset($line); - echo "Something very weird is going on. This line ($i) has an unknown type.\n"; - break; - } - - // echo "line $i : $line\n"; - - if ($line) { - $r = @fwrite($file, $line."\n"); - if($r === FALSE) { - return PEAR::raiseError("*** Can't write crontab ***\n". - " Set crontab manually!\n"); - } - } - } - fclose($file); - - if ($DEBUG) { - echo "DEBUGMODE: not updating crontab. writing to $filename instead.\n"; - } else { - exec("crontab -u {$this->user} $filename", $returnar, $return); - if ($return != 0) { - echo "Error running crontab ($return). $filename not deleted\n"; - } else { - unlink($filename); - } - } - } - - - /** - * Add a item of type CRON_CMD to the end of $this->crontabs - * - * @param string $m - * minute - * @param string $h - * hour - * @param string $dom - * day of month - * @param string $mo - * month - * @param string $dow - * day of week - * @param string $cmd - * command - * - */ - function addCron($m, $h, $dom, $mo, $dow, $cmd) - { - $this->crontabs[] = array ("minute" => $m, "hour" => $h, "dayofmonth" => $dom, "month" => $mo, "dayofweek" => $dow, "command" => $cmd); - $this->linetypes[] = CRON_CMD; - } - - - /** - * Add a comment to the cron to the end of $this->crontabs - * - * @param string $comment - */ - function addComment($comment) - { - $this->crontabs[] = "# $comment\n"; - $this->linetypes[] = CRON_COMMENT; - } - - - /** - * Add a special command (check man 5 crontab for more information) - * - * @param string $sdate special date - * string meaning - * ------ ------- - * @reboot Run once, at startup. - * @yearly Run once a year, "0 0 1 1 *". - * @annually (same as @yearly) - * @monthly Run once a month, "0 0 1 * *". - * @weekly Run once a week, "0 0 * * 0". - * @daily Run once a day, "0 0 * * *". - * @midnight (same as @daily) - * @hourly Run once an hour, "0 * * * *". - * @param string $cmd command - */ - function addSpecial($sdate, $cmd) - { - $this->crontabs[] = array ("special" => $sdate, "command" => $cmd); - $this->linetypes[] = CRON_SPECIAL; - } - - - /** - * Add an assignment (name = value) - * - * @param string $name - * @param string $value - */ - function addAssign($name, $value) - { - $this->crontabs[] = array ("name" => $name, "value" => $value); - $this->linetypes[] = CRON_ASSIGN; - } - - - /** - * Delete a line from the arrays. - * - * @param int $index the index in $this->crontabs - */ - function delEntry($index) - { - unset ($this->crontabs[$index]); - unset ($this->linetypes[$index]); - } - - - /** - * Get all the lines of a certain type in an array - * - * @param string $type - */ - function getByType($type) - { - if ($type < CRON_COMMENT || $type > CRON_EMPTY) - { - trigger_error("Wrong type: $type", E_USER_WARNING); - return 0; - } - - $returnar = array (); - for ($i = 0; $i < count($this->linetypes); $i ++) - if ($this->linetypes[$i] == $type) - $returnar[] = $this->crontabs[$i]; - - return $returnar; - } -} -?> \ No newline at end of file diff --git a/backend/cron/croncall.php b/backend/cron/croncall.php deleted file mode 100755 index bae49815b..000000000 --- a/backend/cron/croncall.php +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/php -execute($p['params']); -exit(0); -?> \ No newline at end of file diff --git a/backend/cron/transportCron.php b/backend/cron/transportCron.php deleted file mode 100755 index 63845ee9d..000000000 --- a/backend/cron/transportCron.php +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/php -setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -$gb = new LocStor(); -$tr = new Transport($gb); - -$r = $tr->cronMain(); -if (!$r) { - exit(1); -} - -exit(0); -?> \ No newline at end of file diff --git a/backend/cron/transportCronJob.php b/backend/cron/transportCronJob.php deleted file mode 100755 index 795dd659a..000000000 --- a/backend/cron/transportCronJob.php +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/php -setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -$gb = new LocStor(); -$tr = new Transport($gb); - -$pid = getmypid(); -list(, $trtok) = $_SERVER['argv']; -if (TR_LOG_LEVEL > 1) { - $tr->trLog("transportCronJob($pid) start ($trtok)"); -} - -// 4-pass on job: -$cnt = 4; -for ($i = 0; $i < $cnt; $i++, sleep(1)) { - // run the action: - $r = $tr->cronCallMethod($trtok); - if (PEAR::isError($r)) { - $tr->trLogPear("transportCronJob($pid): ($trtok): ", $r); - } else { -# $tr->trLog("X transportCronJob: ".var_export($r, TRUE)); - if ($r !== TRUE) { - $tr->trLog("transportCronJob($pid): ($trtok): nonTRUE returned"); - } - } - #if(!$r) exit(1); - #sleep(2); -} - -if (TR_LOG_LEVEL>1) { - $tr->trLog("transportCronJob($pid) end ($trtok)"); -} -exit(0); -?> \ No newline at end of file diff --git a/backend/etc/Makefile.in b/backend/etc/Makefile.in deleted file mode 100644 index 96be1711a..000000000 --- a/backend/etc/Makefile.in +++ /dev/null @@ -1,259 +0,0 @@ -#------------------------------------------------------------------------------- -# StorageServer - file storage component -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# @configure_input@ -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# General command definitions -#------------------------------------------------------------------------------- -SHELL = /bin/bash -MKDIR = mkdir -p -RM = rm -f -RMDIR = rm -rf -DOXYGEN = doxygen -CP = cp -rP -SED = sed -ECHO = echo -CAT = cat -PHP = php - - -#------------------------------------------------------------------------------- -# Misc -#------------------------------------------------------------------------------- - -MODULE_NAME = storageServer -TAR_C = tar -cj --exclude .svn --exclude '*~' -C ${BASE_DIR} -f -DIST_EXT = .tgz -DATE = `date +%y%m%d` - -#------------------------------------------------------------------------------- -# Basic directory and file definitions -#------------------------------------------------------------------------------- -#BASE_DIR = @builddir@ -BASE_DIR = . -BIN_DIR = ${BASE_DIR}/bin -DOC_DIR = ${BASE_DIR}/doc -DOXYGEN_DIR = ${DOC_DIR}/doxygen -ETC_DIR = ${BASE_DIR}/etc -INCLUDE_DIR = ${BASE_DIR}/include -LIB_DIR = ${BASE_DIR}/lib -SRC_DIR = ${BASE_DIR}/src -TMP_DIR = ${BASE_DIR}/tmp -VAR_DIR = ${BASE_DIR}/var - -prefix = @prefix@ - -USR_DIR = ${prefix} -USR_INCLUDE_DIR = ${USR_DIR}/include -USR_LIB_DIR = ${USR_DIR}/lib -USR_VAR_DIR = ${USR_DIR}/var - -DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config - -PHP_DIR = ${VAR_DIR} -INSTALL_DIR = ${PHP_DIR}/install -STOR_DIR = ${PHP_DIR}/stor -ACCESS_DIR = ${PHP_DIR}/access -TRANS_DIR = ${PHP_DIR}/trans -BUFF_DIR = ${STOR_DIR}/buffer -TEST_RUNNER = ${PHP_DIR}/xmlrpc/testRunner.sh - -DEST_DIR = ${USR_VAR_DIR}/Campcaster/storageServer -DEST_VAR_DIR = ${DEST_DIR}/var -DEST_BIN_DIR = ${DEST_DIR}/bin - -HOSTNAME = @HOSTNAME@ -APACHE_GROUP = @APACHE_GROUP@ -WWW_PORT = @WWW_PORT@ -DB_SERVER = @DB_SERVER@ -DATABASE = @DATABASE@ -DB_USER = @DB_USER@ -DB_PASSWORD = @DB_PASSWORD@ -SCHEDULER_PORT = @SCHEDULER_PORT@ -WWW_DOCROOT = @WWW_DOCROOT@ -PHP_URL_PREFIX = @URL_PREFIX@ - -SCHEDULER_URL_PREFIX = -SCHEDULER_XML_RPC_PREFIX = RC2 - -USR_LIB_DIR_S=$(shell ${ECHO} ${USR_LIB_DIR} | ${SED} -e "s/\//\\\\\\\\\//g") -PHP_URL_PREFIX_S=$(shell ${ECHO} ${PHP_URL_PREFIX} | ${SED} -e "s/\//\\\\\\\\\//g") - -REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \ - s/ls_dbuser/${DB_USER}/; \ - s/ls_dbpassword/${DB_PASSWORD}/; \ - s/ls_dbserver/${DB_SERVER}/; \ - s/ls_database/${DATABASE}/; \ - s/ls_apache_group/${APACHE_GROUP}/; \ - s/ls_storageUrlPath/\/${PHP_URL_PREFIX_S}\/storageServer\/var/; \ - s/ls_php_host/${HOSTNAME}/; \ - s/ls_php_port/${WWW_PORT}/; \ - s/ls_archiveUrlPath/\/${PHP_URL_PREFIX_S}\/archiveServer\/var/; \ - s/ls_scheduler_urlPrefix/${SCHEDULER_URL_PREFIX}/; \ - s/ls_scheduler_xmlRpcPrefix/${SCHEDULER_XML_RPC_PREFIX}/; \ - s/ls_scheduler_host/${HOSTNAME}/; \ - s/ls_scheduler_port/${SCHEDULER_PORT}/;" - - -#------------------------------------------------------------------------------- -# Configuration parameters -#------------------------------------------------------------------------------- -#CPPFLAGS = @CPPFLAGS@ -#CXXFLAGS = @CXXFLAGS@ @DEFS@ -I${USR_INCLUDE_DIR} -I${INCLUDE_DIR} -I${TMP_DIR}\ -# -pedantic -Wall -#LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR} - - -#------------------------------------------------------------------------------- -# Dependencies -#------------------------------------------------------------------------------- -#HELLO_LIB_OBJS = ${TMP_DIR}/Hello.o -#TEST_RUNNER_OBJS = ${TMP_DIR}/HelloTest.o ${TMP_DIR}/TestRunner.o - - -#------------------------------------------------------------------------------- -# Targets -#------------------------------------------------------------------------------- -.PHONY: all dir_setup doc clean docclean depclean distclean dist install -.PHONY: db_init db_clean testonly transtest storage reset -.PHONY: copy_files create_database init_database - -all: - -doc: - ${DOXYGEN} ${DOXYGEN_CONFIG} - -clean: db_clean - ${RMDIR} ${STOR_DIR} - ${RMDIR} ${ACCESS_DIR} - ${RMDIR} ${TRANS_DIR} - -docclean: - ${RMDIR} ${DOXYGEN_DIR}/html - -depclean: clean - -dist: - ${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} * - -distclean: clean docclean - -testonly: ${TEST_RUNNER} - ${TEST_RUNNER} - -check: all testonly - -install: copy_files create_database init_database - -copy_files: - ${MKDIR} ${DEST_DIR} - ${MKDIR} ${DEST_VAR_DIR} - ${MKDIR} ${DEST_BIN_DIR} - ${MKDIR} ${DEST_VAR_DIR}/access - ${MKDIR} ${DEST_VAR_DIR}/cron - ${MKDIR} ${DEST_VAR_DIR}/install - ${MKDIR} ${DEST_VAR_DIR}/install/upgrade - ${MKDIR} ${DEST_VAR_DIR}/stor - ${MKDIR} ${DEST_VAR_DIR}/stor/buffer - ${MKDIR} ${DEST_VAR_DIR}/trans - ${MKDIR} ${DEST_VAR_DIR}/xmlrpc - ${CP} ${VAR_DIR}/*.{php,xml} ${DEST_VAR_DIR} - ${CP} ${VAR_DIR}/cron/*.php ${DEST_VAR_DIR}/cron - ${CP} ${VAR_DIR}/install/*.php \ - ${DEST_VAR_DIR}/install - ${CP} ${VAR_DIR}/install/upgrade/*.php \ - ${DEST_VAR_DIR}/install/upgrade - ${CP} ${VAR_DIR}/xmlrpc/*.php \ - ${DEST_VAR_DIR}/xmlrpc - ${CAT} ${VAR_DIR}/conf.php.template | ${SED} -e ${REPLACE_SED_STRING} \ - > ${DEST_VAR_DIR}/conf.php - ${CP} ${BIN_DIR}/backup.sh ${BIN_DIR}/restore.php \ - ${DEST_BIN_DIR} - - chgrp ${APACHE_GROUP} ${DEST_VAR_DIR}/access - chgrp ${APACHE_GROUP} ${DEST_VAR_DIR}/stor - chgrp ${APACHE_GROUP} ${DEST_VAR_DIR}/stor/buffer - chgrp ${APACHE_GROUP} ${DEST_VAR_DIR}/trans - chmod g+sw ${DEST_VAR_DIR}/access - chmod g+sw ${DEST_VAR_DIR}/stor - chmod g+sw ${DEST_VAR_DIR}/stor/buffer - chmod g+sw ${DEST_VAR_DIR}/trans - - ${RM} ${WWW_DOCROOT}/${PHP_URL_PREFIX} - ln -sf ${USR_VAR_DIR}/Campcaster ${WWW_DOCROOT}/${PHP_URL_PREFIX} - -create_database: -ifeq (@CREATE_LS_DATABASE@,yes) - ${BIN_DIR}/createDatabase.sh --database=${DATABASE} \ - --dbserver=${DB_SERVER} \ - --dbuser=${DB_USER} \ - --dbpassword=${DB_PASSWORD} -endif - -init_database: -ifeq (@INIT_LS_DATABASE@,yes) - -cd ${DEST_VAR_DIR}/install && ${PHP} -q install.php -endif - - -recheck: clean check - - -#------------------------------------------------------------------------------- -# Specific targets -#------------------------------------------------------------------------------- -storage: db_init dir_setup - -storagecheck: storage testonly - -dir_setup: - bin/setupDirs.sh ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} - -db_init: - -cd var/install && php -q install.php - chgrp ${APACHE_GROUP} ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} - chmod g+sw ${STOR_DIR} ${ACCESS_DIR} ${TRANS_DIR} ${BUFF_DIR} - -db_clean: - -cd var/install && php -q uninstall.php - -reset: - ./bin/resetStorage.sh - -transtest: - ./var/tests/transTest.sh -# cd var/tests; php -q transTest.php - -${TMP_DIR}: - ${MKDIR} ${TMP_DIR} - -${DOXYGEN_DIR}: - ${MKDIR} ${DOXYGEN_DIR} - -${TEST_RUNNER}: - -#------------------------------------------------------------------------------- -# Pattern rules -#------------------------------------------------------------------------------- -#${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx -# ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $< - diff --git a/backend/etc/configure.ac b/backend/etc/configure.ac deleted file mode 100644 index df1aad37d..000000000 --- a/backend/etc/configure.ac +++ /dev/null @@ -1,220 +0,0 @@ -dnl----------------------------------------------------------------------------- -dnl Copyright (c) 2010 Sourcefabric O.P.S. -dnl -dnl This file is part of the Campcaster project. -dnl http://campcaster.sourcefabric.org/ -dnl -dnl Campcaster is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl Campcaster is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with Campcaster; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -dnl -dnl----------------------------------------------------------------------------- - -dnl----------------------------------------------------------------------------- -dnl NOTE: Run all configure related scripts from the tmp directory of the -dnl project. -dnl This is due to the fact that configure spreads a lot of trash around, -dnl like atom4te cache directories, config.* files, etc. into the directory -dnl it is being run from. We clearly don't want these in our base directory. -dnl----------------------------------------------------------------------------- -AC_INIT(StorageServer, 0.0, bugs@campware.org) -AC_PREREQ(2.59) -AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL]) -AC_REVISION($Revision$) - -AC_CONFIG_SRCDIR(../var/BasicStor.php) - -dnl----------------------------------------------------------------------------- -dnl specify wether the Campcaster database and user should be created -dnl----------------------------------------------------------------------------- -AC_SUBST(CREATE_LS_DATABASE) - -AC_ARG_WITH([create-database], - AC_HELP_STRING([--with-create-database], - [specify wether the Campcaster database and database user - should be created (no)]), - [CREATE_LS_DATABASE=${withval}], - [CREATE_LS_DATABASE=no]) - -AC_MSG_RESULT([creating Campcaster database: ${CREATE_LS_DATABASE}]) - - -dnl----------------------------------------------------------------------------- -dnl specify wether the Campcaster database tables should be initialized -dnl----------------------------------------------------------------------------- -AC_SUBST(INIT_LS_DATABASE) - -AC_ARG_WITH([init-database], - AC_HELP_STRING([--with-init-database], - [specify wether the Campcaster database tables should be - initialized (no)]), - [INIT_LS_DATABASE=${withval}], - [INIT_LS_DATABASE=no]) - -AC_MSG_RESULT([initializing Campcaster database: ${INIT_LS_DATABASE}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the FQDN -dnl----------------------------------------------------------------------------- -AC_SUBST(HOSTNAME) - -AC_ARG_WITH([hostname], - AC_HELP_STRING([--with-hostname], - [use the specified hostname (guess)]), - [HOSTNAME=${withval}], [HOSTNAME=`hostname -f`]) - -AC_MSG_RESULT([using hostname: ${HOSTNAME}]) - - -dnl----------------------------------------------------------------------------- -dnl specify group in which apache is running -dnl----------------------------------------------------------------------------- -AC_SUBST(APACHE_GROUP) - -AC_ARG_WITH([apache-group], - AC_HELP_STRING([--with-apache-group], - [use apache running in the specified group (apache)]), - [APACHE_GROUP=${withval}], [APACHE_GROUP=apache]) - -AC_MSG_RESULT([using apache group: ${APACHE_GROUP}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the web server port -dnl----------------------------------------------------------------------------- -AC_SUBST(WWW_PORT) - -AC_ARG_WITH([www-port], - AC_HELP_STRING([--with-www-port], - [use the specified www port (80)]), - [WWW_PORT=${withval}], [WWW_PORT=80]) - -AC_MSG_RESULT([using www port: ${WWW_PORT}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the scheduler server port -dnl----------------------------------------------------------------------------- -AC_SUBST(SCHEDULER_PORT) - -AC_ARG_WITH([scheduler-port], - AC_HELP_STRING([--with-scheduler-port], - [use the specified scheduler port (3344)]), - [SCHEDULER_PORT=${withval}], [SCHEDULER_PORT=3344]) - -AC_MSG_RESULT([using scheduler port: ${SCHEDULER_PORT}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the database server name -dnl----------------------------------------------------------------------------- -AC_SUBST(DB_SERVER) - -AC_ARG_WITH([database-server], - AC_HELP_STRING([--with-database-server], - [use the specified database server (localhost)]), - [DB_SERVER=${withval}], [DB_SERVER=localhost]) - -AC_MSG_RESULT([using database server: ${DB_SERVER}]) - - -dnl----------------------------------------------------------------------------- -dnl get the name of the Campcaster database -dnl----------------------------------------------------------------------------- -AC_SUBST(DATABASE) - -AC_ARG_WITH([database], - AC_HELP_STRING([--with-database], - [the name of the postgresql database to use (Campcaster)]), - [DATABASE=${withval}], [DATABASE=Campcaster]) - -AC_MSG_RESULT([using database: ${DATABASE}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the database server user -dnl----------------------------------------------------------------------------- -AC_SUBST(DB_USER) - -AC_ARG_WITH([database-user], - AC_HELP_STRING([--with-database-user], - [use the specified database server user (campcaster)]), - [DB_USER=${withval}], [DB_USER=campcaster]) - -AC_MSG_RESULT([using database server user: ${DB_USER}]) - - -dnl----------------------------------------------------------------------------- -dnl specify the database server user password -dnl----------------------------------------------------------------------------- -AC_SUBST(DB_PASSWORD) - -AC_ARG_WITH([database-password], - AC_HELP_STRING([--with-database-password], - [use the specified database server user password (campcaster)]), - [DB_PASSWORD=${withval}], [DB_PASSWORD=campcaster]) - -AC_MSG_RESULT([using database server user password: ${DB_PASSWORD}]) - - -dnl----------------------------------------------------------------------------- -dnl specify web document root -dnl----------------------------------------------------------------------------- -AC_SUBST(WWW_DOCROOT) - -AC_ARG_WITH([www-docroot], - AC_HELP_STRING([--with-www-docroot], - [deploy Campcaster under the specified docroot (/var/www)]), - [WWW_DOCROOT=${withval}], [WWW_DOCROOT=/var/www]) - -AC_MSG_RESULT([using www document root: ${WWW_DOCROOT}]) - - -dnl----------------------------------------------------------------------------- -dnl specify url prefix -dnl----------------------------------------------------------------------------- -AC_SUBST(URL_PREFIX) - -AC_ARG_WITH([url-prefix], - AC_HELP_STRING([--with-url-prefix], - [use the specified url prefix (campcaster)]), - [URL_PREFIX=${withval}], [URL_PREFIX=campcaster]) - -AC_MSG_RESULT([using url prefix: ${URL_PREFIX}]) - - -dnl display status info on what libraries will get compiled - -AC_MSG_NOTICE( -[using the following configuration settings: - - hostname: ${HOSTNAME} - www port: ${WWW_PORT} - scheduler port: ${SCHEDULER_PORT} - database server: ${DB_SERVER} - database name: ${DATABASE} - database user: ${DB_USER} - database user password: ${DB_PASSWORD} - creating Campcaster database: ${CREATE_LS_DATABASE} - initialize Campcaster database: ${INIT_LS_DATABASE} - www document root: ${WWW_DOCROOT} - url prefix: ${URL_PREFIX} - -]) - - - -AC_CONFIG_FILES(../Makefile:../etc/Makefile.in) - -AC_OUTPUT() diff --git a/backend/genres.xml b/backend/genres.xml deleted file mode 100644 index 9afb92275..000000000 --- a/backend/genres.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/backend/index.php b/backend/index.php deleted file mode 100644 index cc0d4bdf3..000000000 --- a/backend/index.php +++ /dev/null @@ -1,17 +0,0 @@ - - -StorageServer module - -

    StorageServer module

    -
    -HTML client
    -XmlRpc test
    -Test
    - - \ No newline at end of file diff --git a/backend/playlistFormat.php b/backend/playlistFormat.php deleted file mode 100644 index 457feb938..000000000 --- a/backend/playlistFormat.php +++ /dev/null @@ -1,117 +0,0 @@ -'playlist', - 'playlist'=>array( - 'childs'=>array( - // 'repeatable'=>array('playlistElement'), - 'optional'=>array('metadata', 'playlistElement'), - ), - 'attrs'=>array( - 'required'=>array('id'), - 'implied'=>array('title', 'playlength'), - ), - ), - 'playlistElement'=>array( - 'childs'=>array( - 'oneof'=>array('audioClip', 'playlist'), - 'optional'=>array('fadeInfo'), - ), - 'attrs'=>array( - 'required'=>array('id', 'relativeOffset', 'clipStart', 'clipEnd', 'clipLength'), - ), - ), - 'audioClip'=>array( - 'childs'=>array( - 'optional'=>array('metadata'), - ), - 'attrs'=>array( - 'implied'=>array('id', 'title', 'playlength', 'uri'), - ), - ), - 'fadeInfo'=>array( - 'attrs'=>array( - 'required'=>array('id', 'fadeIn', 'fadeOut'), - ), - ), - 'metadata'=>array( - 'childs'=>array( - 'optional'=>array( - 'dc:title', 'dcterms:extent', 'dc:creator', 'dc:description', - 'dcterms:alternative', 'ls:filename', 'ls:mtime', - ), - ), - 'namespaces'=>array( - 'dc'=>"http://purl.org/dc/elements/1.1/", - 'dcterms'=>"http://purl.org/dc/terms/", - 'xbmf'=>"http://www.streamonthefly.org/xbmf", - 'xsi'=>"http://www.w3.org/2001/XMLSchema-instance", - 'xml'=>"http://www.w3.org/XML/1998/namespace", - ), - ), - 'dc:title'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:alternative'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:extent'=>array( - 'type'=>'Time', - 'regexp'=>'^\d{2}:\d{2}:\d{2}.\d{6}$', - ), - 'dc:creator'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:description'=>array( - 'type'=>'Longtext', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'playlength'=>array( - 'type'=>'Time', - 'regexp'=>'^((\d{2}:)?\d{2}:)?\d{1,2}(.\d{6})?$', - ), - 'id'=>array( - 'type'=>'Attribute', - 'regexp'=>'^[0-9a-f]{16}$', - ), - 'fadeIn'=>array( - 'type'=>'Attribute', - 'regexp'=>'^((\d{2}:)?\d{2}:)?\d{1,2}(.\d{6})?$', - ), - 'fadeOut'=>array( - 'type'=>'Attribute', - 'regexp'=>'^((\d{2}:)?\d{2}:)?\d{1,2}(.\d{6})?$', - ), - 'ls:filename'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:mtime'=>array( - 'type'=>'Int', -// 'regexp'=>'^\d{4}(-\d{2}(-\d{2}(T\d{2}:\d{2}(:\d{2}\.\d+)?(Z)|([\+\-]?\d{2}:\d{2}))?)?)?$', - ), -/* - ''=>array( - 'childs'=>array(''), - 'attrs'=>array('implied'=>array()), - ), -*/ -); - -/* -? -ls:filename Text auto -*/ -?> \ No newline at end of file diff --git a/backend/propel-db/build.properties b/backend/propel-db/build.properties deleted file mode 100644 index 81c06da7d..000000000 --- a/backend/propel-db/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Database driver -propel.database = pgsql -propel.database.url = pgsql:host=localhost dbname=campcaster user=campcaster password=campcaster - -#Project name -propel.project = campcaster - diff --git a/backend/propel-db/build/classes/campcaster/CcAccess.php b/backend/propel-db/build/classes/campcaster/CcAccess.php deleted file mode 100644 index e3171bdfa..000000000 --- a/backend/propel-db/build/classes/campcaster/CcAccess.php +++ /dev/null @@ -1,18 +0,0 @@ -length; - } - - public function setDbLength($time) - { - $this->length = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH; - return Common::setTimeInSub($this, 'LENGTH', $time); - } - - -} // CcFiles diff --git a/backend/propel-db/build/classes/campcaster/CcFilesPeer.php b/backend/propel-db/build/classes/campcaster/CcFilesPeer.php deleted file mode 100644 index 047a8d8bb..000000000 --- a/backend/propel-db/build/classes/campcaster/CcFilesPeer.php +++ /dev/null @@ -1,18 +0,0 @@ -prepare($sql); - $stmt->bindValue(':p1', $this->getDbId()); - $stmt->execute(); - return $stmt->fetchColumn(); - } - - public function computeLength() - { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME); - - $sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length' - . ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME - . ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1'; - - $stmt = $con->prepare($sql); - $stmt->bindValue(':p1', $this->getDbId()); - $stmt->execute(); - return $stmt->fetchColumn(); - } - - -} // CcPlaylist diff --git a/backend/propel-db/build/classes/campcaster/CcPlaylistPeer.php b/backend/propel-db/build/classes/campcaster/CcPlaylistPeer.php deleted file mode 100644 index 097895b10..000000000 --- a/backend/propel-db/build/classes/campcaster/CcPlaylistPeer.php +++ /dev/null @@ -1,18 +0,0 @@ -fadein; - } - - public function setDbFadein($time) - { - $this->fadein = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; - return Common::setTimeInSub($this, 'FADEIN', $time); - } - - public function getDbFadeout() - { - return $this->fadeout; - } - - public function setDbFadeout($time) - { - $this->fadeout = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; - return Common::setTimeInSub($this, 'FADEOUT', $time); - } - - public function getDbCuein() - { - return $this->cuein; - } - - public function setDbCuein($time) - { - $this->cuein = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN; - return Common::setTimeInSub($this, 'CUEIN', $time); - } - - public function getDbCueout() - { - return $this->cueout; - } - - public function setDbCueout($time) - { - $this->cueout = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT; - return Common::setTimeInSub($this, 'CUEOUT', $time); - } - - public function getDbCliplength() - { - return $this->cliplength; - } - - public function setDbCliplength($time) - { - $this->cliplength = $time; - //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH; - return Common::setTimeInSub($this, 'CLIPLENGTH', $time); - } - -} // CcPlaylistcontents diff --git a/backend/propel-db/build/classes/campcaster/CcPlaylistcontentsPeer.php b/backend/propel-db/build/classes/campcaster/CcPlaylistcontentsPeer.php deleted file mode 100644 index 5fe6cf288..000000000 --- a/backend/propel-db/build/classes/campcaster/CcPlaylistcontentsPeer.php +++ /dev/null @@ -1,18 +0,0 @@ -prepare($sql); - $stmt->bindValue(':f1', $time); - $stmt->bindValue(':p1', $row->getDbId()); - $stmt->execute(); - } -} diff --git a/backend/propel-db/build/classes/campcaster/map/CcAccessTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcAccessTableMap.php deleted file mode 100644 index 5da2dae21..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcAccessTableMap.php +++ /dev/null @@ -1,61 +0,0 @@ -setName('cc_access'); - $this->setPhpName('CcAccess'); - $this->setClassname('CcAccess'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_access_id_seq'); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null); - $this->addColumn('TOKEN', 'Token', 'BIGINT', false, null, null); - $this->addColumn('CHSUM', 'Chsum', 'CHAR', true, 32, ''); - $this->addColumn('EXT', 'Ext', 'VARCHAR', true, 128, ''); - $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 20, ''); - $this->addColumn('PARENT', 'Parent', 'BIGINT', false, null, null); - $this->addForeignKey('OWNER', 'Owner', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), null, null); - } // buildRelations() - -} // CcAccessTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcBackupTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcBackupTableMap.php deleted file mode 100644 index a2c3f3af7..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcBackupTableMap.php +++ /dev/null @@ -1,55 +0,0 @@ -setName('cc_backup'); - $this->setPhpName('CcBackup'); - $this->setClassname('CcBackup'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('TOKEN', 'Token', 'VARCHAR', true, 64, null); - $this->addColumn('SESSIONID', 'Sessionid', 'VARCHAR', true, 64, null); - $this->addColumn('STATUS', 'Status', 'VARCHAR', true, 32, null); - $this->addColumn('FROMTIME', 'Fromtime', 'TIMESTAMP', true, null, null); - $this->addColumn('TOTIME', 'Totime', 'TIMESTAMP', true, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - } // buildRelations() - -} // CcBackupTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcFilesTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcFilesTableMap.php deleted file mode 100644 index 5c8fe05f1..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcFilesTableMap.php +++ /dev/null @@ -1,107 +0,0 @@ -setName('cc_files'); - $this->setPhpName('CcFiles'); - $this->setClassname('CcFiles'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_files_id_seq'); - // columns - $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); - $this->addColumn('GUNID', 'Gunid', 'CHAR', true, 32, null); - $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, ''); - $this->addColumn('MIME', 'Mime', 'VARCHAR', true, 255, ''); - $this->addColumn('FTYPE', 'Ftype', 'VARCHAR', true, 128, ''); - $this->addColumn('FILEPATH', 'filepath', 'LONGVARCHAR', false, null, ''); - $this->addColumn('STATE', 'State', 'VARCHAR', true, 128, 'empty'); - $this->addColumn('CURRENTLYACCESSING', 'Currentlyaccessing', 'INTEGER', true, null, 0); - $this->addForeignKey('EDITEDBY', 'Editedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('MTIME', 'Mtime', 'TIMESTAMP', false, 6, null); - $this->addColumn('MD5', 'Md5', 'CHAR', false, 32, null); - $this->addColumn('TRACK_TITLE', 'TrackTitle', 'VARCHAR', false, 512, null); - $this->addColumn('ARTIST_NAME', 'ArtistName', 'VARCHAR', false, 512, null); - $this->addColumn('BIT_RATE', 'BitRate', 'VARCHAR', false, 32, null); - $this->addColumn('SAMPLE_RATE', 'SampleRate', 'VARCHAR', false, 32, null); - $this->addColumn('FORMAT', 'Format', 'VARCHAR', false, 128, null); - $this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null); - $this->addColumn('ALBUM_TITLE', 'AlbumTitle', 'VARCHAR', false, 512, null); - $this->addColumn('GENRE', 'Genre', 'VARCHAR', false, 64, null); - $this->addColumn('COMMENTS', 'Comments', 'LONGVARCHAR', false, null, null); - $this->addColumn('YEAR', 'Year', 'VARCHAR', false, 16, null); - $this->addColumn('TRACK_NUMBER', 'TrackNumber', 'INTEGER', false, null, null); - $this->addColumn('CHANNELS', 'Channels', 'INTEGER', false, null, null); - $this->addColumn('URL', 'Url', 'VARCHAR', false, 1024, null); - $this->addColumn('BPM', 'Bpm', 'VARCHAR', false, 8, null); - $this->addColumn('RATING', 'Rating', 'VARCHAR', false, 8, null); - $this->addColumn('ENCODED_BY', 'EncodedBy', 'VARCHAR', false, 255, null); - $this->addColumn('DISC_NUMBER', 'DiscNumber', 'VARCHAR', false, 8, null); - $this->addColumn('MOOD', 'Mood', 'VARCHAR', false, 64, null); - $this->addColumn('LABEL', 'Label', 'VARCHAR', false, 512, null); - $this->addColumn('COMPOSER', 'Composer', 'VARCHAR', false, 512, null); - $this->addColumn('ENCODER', 'Encoder', 'VARCHAR', false, 64, null); - $this->addColumn('CHECKSUM', 'Checksum', 'VARCHAR', false, 256, null); - $this->addColumn('LYRICS', 'Lyrics', 'LONGVARCHAR', false, null, null); - $this->addColumn('ORCHESTRA', 'Orchestra', 'VARCHAR', false, 512, null); - $this->addColumn('CONDUCTOR', 'Conductor', 'VARCHAR', false, 512, null); - $this->addColumn('LYRICIST', 'Lyricist', 'VARCHAR', false, 512, null); - $this->addColumn('ORIGINAL_LYRICIST', 'OriginalLyricist', 'VARCHAR', false, 512, null); - $this->addColumn('RADIO_STATION_NAME', 'RadioStationName', 'VARCHAR', false, 512, null); - $this->addColumn('INFO_URL', 'InfoUrl', 'VARCHAR', false, 512, null); - $this->addColumn('ARTIST_URL', 'ArtistUrl', 'VARCHAR', false, 512, null); - $this->addColumn('AUDIO_SOURCE_URL', 'AudioSourceUrl', 'VARCHAR', false, 512, null); - $this->addColumn('RADIO_STATION_URL', 'RadioStationUrl', 'VARCHAR', false, 512, null); - $this->addColumn('BUY_THIS_URL', 'BuyThisUrl', 'VARCHAR', false, 512, null); - $this->addColumn('ISRC_NUMBER', 'IsrcNumber', 'VARCHAR', false, 512, null); - $this->addColumn('CATALOG_NUMBER', 'CatalogNumber', 'VARCHAR', false, 512, null); - $this->addColumn('ORIGINAL_ARTIST', 'OriginalArtist', 'VARCHAR', false, 512, null); - $this->addColumn('COPYRIGHT', 'Copyright', 'VARCHAR', false, 512, null); - $this->addColumn('REPORT_DATETIME', 'ReportDatetime', 'VARCHAR', false, 32, null); - $this->addColumn('REPORT_LOCATION', 'ReportLocation', 'VARCHAR', false, 512, null); - $this->addColumn('REPORT_ORGANIZATION', 'ReportOrganization', 'VARCHAR', false, 512, null); - $this->addColumn('SUBJECT', 'Subject', 'VARCHAR', false, 512, null); - $this->addColumn('CONTRIBUTOR', 'Contributor', 'VARCHAR', false, 512, null); - $this->addColumn('LANGUAGE', 'Language', 'VARCHAR', false, 512, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); - $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); - } // buildRelations() - -} // CcFilesTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcPermsTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcPermsTableMap.php deleted file mode 100644 index 7a869b2c3..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcPermsTableMap.php +++ /dev/null @@ -1,56 +0,0 @@ -setName('cc_perms'); - $this->setPhpName('CcPerms'); - $this->setClassname('CcPerms'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('PERMID', 'Permid', 'INTEGER', true, null, null); - $this->addForeignKey('SUBJ', 'Subj', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('ACTION', 'Action', 'VARCHAR', false, 20, null); - $this->addColumn('OBJ', 'Obj', 'INTEGER', false, null, null); - $this->addColumn('TYPE', 'Type', 'CHAR', false, 1, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subj' => 'id', ), 'CASCADE', null); - } // buildRelations() - -} // CcPermsTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcPlaylistTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcPlaylistTableMap.php deleted file mode 100644 index cfb6f23de..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcPlaylistTableMap.php +++ /dev/null @@ -1,61 +0,0 @@ -setName('cc_playlist'); - $this->setPhpName('CcPlaylist'); - $this->setClassname('CcPlaylist'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_playlist_id_seq'); - // columns - $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); - $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, ''); - $this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty'); - $this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0); - $this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null); - $this->addColumn('CREATOR', 'DbCreator', 'VARCHAR', false, 32, null); - $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); - $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null); - } // buildRelations() - -} // CcPlaylistTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcPlaylistcontentsTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcPlaylistcontentsTableMap.php deleted file mode 100644 index 4ce59117e..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcPlaylistcontentsTableMap.php +++ /dev/null @@ -1,62 +0,0 @@ -setName('cc_playlistcontents'); - $this->setPhpName('CcPlaylistcontents'); - $this->setClassname('CcPlaylistcontents'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_playlistcontents_id_seq'); - // columns - $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); - $this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null); - $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null); - $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null); - $this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00'); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); - $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null); - } // buildRelations() - -} // CcPlaylistcontentsTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcPrefTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcPrefTableMap.php deleted file mode 100644 index 7bc77534e..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcPrefTableMap.php +++ /dev/null @@ -1,56 +0,0 @@ -setName('cc_pref'); - $this->setPhpName('CcPref'); - $this->setClassname('CcPref'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_pref_id_seq'); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('SUBJID', 'Subjid', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('KEYSTR', 'Keystr', 'VARCHAR', false, 255, null); - $this->addColumn('VALSTR', 'Valstr', 'LONGVARCHAR', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subjid' => 'id', ), 'CASCADE', null); - } // buildRelations() - -} // CcPrefTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcScheduleTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcScheduleTableMap.php deleted file mode 100644 index 757998697..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcScheduleTableMap.php +++ /dev/null @@ -1,61 +0,0 @@ -setName('cc_schedule'); - $this->setPhpName('CcSchedule'); - $this->setClassname('CcSchedule'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('ID', 'Id', 'BIGINT', true, null, null); - $this->addColumn('PLAYLIST_ID', 'PlaylistId', 'INTEGER', true, null, null); - $this->addColumn('STARTS', 'Starts', 'TIMESTAMP', true, null, null); - $this->addColumn('ENDS', 'Ends', 'TIMESTAMP', true, null, null); - $this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', false, null, null); - $this->addColumn('FILE_ID', 'FileId', 'INTEGER', false, null, null); - $this->addColumn('CLIP_LENGTH', 'ClipLength', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADE_IN', 'FadeIn', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADE_OUT', 'FadeOut', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUE_IN', 'CueIn', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUE_OUT', 'CueOut', 'TIME', false, null, '00:00:00'); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - } // buildRelations() - -} // CcScheduleTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcSessTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcSessTableMap.php deleted file mode 100644 index 8e928ab1c..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcSessTableMap.php +++ /dev/null @@ -1,55 +0,0 @@ -setName('cc_sess'); - $this->setPhpName('CcSess'); - $this->setClassname('CcSess'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('SESSID', 'Sessid', 'CHAR', true, 32, null); - $this->addForeignKey('USERID', 'Userid', 'INTEGER', 'cc_subjs', 'ID', false, null, null); - $this->addColumn('LOGIN', 'Login', 'VARCHAR', false, 255, null); - $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('userid' => 'id', ), 'CASCADE', null); - } // buildRelations() - -} // CcSessTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcSmembTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcSmembTableMap.php deleted file mode 100644 index 5cdb44df5..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcSmembTableMap.php +++ /dev/null @@ -1,55 +0,0 @@ -setName('cc_smemb'); - $this->setPhpName('CcSmemb'); - $this->setClassname('CcSmemb'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('UID', 'Uid', 'INTEGER', true, null, 0); - $this->addColumn('GID', 'Gid', 'INTEGER', true, null, 0); - $this->addColumn('LEVEL', 'Level', 'INTEGER', true, null, 0); - $this->addColumn('MID', 'Mid', 'INTEGER', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - } // buildRelations() - -} // CcSmembTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcSubjsTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcSubjsTableMap.php deleted file mode 100644 index a32bb2710..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcSubjsTableMap.php +++ /dev/null @@ -1,63 +0,0 @@ -setName('cc_subjs'); - $this->setPhpName('CcSubjs'); - $this->setClassname('CcSubjs'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(false); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('LOGIN', 'Login', 'VARCHAR', true, 255, ''); - $this->addColumn('PASS', 'Pass', 'VARCHAR', true, 255, ''); - $this->addColumn('TYPE', 'Type', 'CHAR', true, 1, 'U'); - $this->addColumn('REALNAME', 'Realname', 'VARCHAR', true, 255, ''); - $this->addColumn('LASTLOGIN', 'Lastlogin', 'TIMESTAMP', false, null, null); - $this->addColumn('LASTFAIL', 'Lastfail', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - $this->addRelation('CcAccess', 'CcAccess', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), null, null); - $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); - $this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null); - $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); - $this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null); - $this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null); - } // buildRelations() - -} // CcSubjsTableMap diff --git a/backend/propel-db/build/classes/campcaster/map/CcTransTableMap.php b/backend/propel-db/build/classes/campcaster/map/CcTransTableMap.php deleted file mode 100644 index 9ccb711db..000000000 --- a/backend/propel-db/build/classes/campcaster/map/CcTransTableMap.php +++ /dev/null @@ -1,75 +0,0 @@ -setName('cc_trans'); - $this->setPhpName('CcTrans'); - $this->setClassname('CcTrans'); - $this->setPackage('campcaster'); - $this->setUseIdGenerator(true); - $this->setPrimaryKeyMethodInfo('cc_trans_id_seq'); - // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('TRTOK', 'Trtok', 'CHAR', true, 16, null); - $this->addColumn('DIRECTION', 'Direction', 'VARCHAR', true, 128, null); - $this->addColumn('STATE', 'State', 'VARCHAR', true, 128, null); - $this->addColumn('TRTYPE', 'Trtype', 'VARCHAR', true, 128, null); - $this->addColumn('LOCK', 'Lock', 'CHAR', true, 1, 'N'); - $this->addColumn('TARGET', 'Target', 'VARCHAR', false, 255, null); - $this->addColumn('RTRTOK', 'Rtrtok', 'CHAR', false, 16, null); - $this->addColumn('MDTRTOK', 'Mdtrtok', 'CHAR', false, 16, null); - $this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null); - $this->addColumn('PDTOKEN', 'Pdtoken', 'BIGINT', false, null, null); - $this->addColumn('URL', 'Url', 'VARCHAR', false, 255, null); - $this->addColumn('LOCALFILE', 'Localfile', 'VARCHAR', false, 255, null); - $this->addColumn('FNAME', 'Fname', 'VARCHAR', false, 255, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('EXPECTEDSUM', 'Expectedsum', 'CHAR', false, 32, null); - $this->addColumn('REALSUM', 'Realsum', 'CHAR', false, 32, null); - $this->addColumn('EXPECTEDSIZE', 'Expectedsize', 'INTEGER', false, null, null); - $this->addColumn('REALSIZE', 'Realsize', 'INTEGER', false, null, null); - $this->addColumn('UID', 'Uid', 'INTEGER', false, null, null); - $this->addColumn('ERRMSG', 'Errmsg', 'VARCHAR', false, 255, null); - $this->addColumn('JOBPID', 'Jobpid', 'INTEGER', false, null, null); - $this->addColumn('START', 'Start', 'TIMESTAMP', false, null, null); - $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); - // validators - } // initialize() - - /** - * Build the RelationMap objects for this table relationships - */ - public function buildRelations() - { - } // buildRelations() - -} // CcTransTableMap diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcAccess.php b/backend/propel-db/build/classes/campcaster/om/BaseCcAccess.php deleted file mode 100644 index 974682fed..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcAccess.php +++ /dev/null @@ -1,1236 +0,0 @@ -chsum = ''; - $this->ext = ''; - $this->type = ''; - } - - /** - * Initializes internal state of BaseCcAccess object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Get the [gunid] column value. - * - * @return string - */ - public function getGunid() - { - return $this->gunid; - } - - /** - * Get the [token] column value. - * - * @return string - */ - public function getToken() - { - return $this->token; - } - - /** - * Get the [chsum] column value. - * - * @return string - */ - public function getChsum() - { - return $this->chsum; - } - - /** - * Get the [ext] column value. - * - * @return string - */ - public function getExt() - { - return $this->ext; - } - - /** - * Get the [type] column value. - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Get the [parent] column value. - * - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Get the [owner] column value. - * - * @return int - */ - public function getOwner() - { - return $this->owner; - } - - /** - * Get the [optionally formatted] temporal [ts] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getTs($format = 'Y-m-d H:i:s') - { - if ($this->ts === null) { - return null; - } - - - - try { - $dt = new DateTime($this->ts); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcAccessPeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [gunid] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setGunid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->gunid !== $v) { - $this->gunid = $v; - $this->modifiedColumns[] = CcAccessPeer::GUNID; - } - - return $this; - } // setGunid() - - /** - * Set the value of [token] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setToken($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->token !== $v) { - $this->token = $v; - $this->modifiedColumns[] = CcAccessPeer::TOKEN; - } - - return $this; - } // setToken() - - /** - * Set the value of [chsum] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setChsum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->chsum !== $v || $this->isNew()) { - $this->chsum = $v; - $this->modifiedColumns[] = CcAccessPeer::CHSUM; - } - - return $this; - } // setChsum() - - /** - * Set the value of [ext] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setExt($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ext !== $v || $this->isNew()) { - $this->ext = $v; - $this->modifiedColumns[] = CcAccessPeer::EXT; - } - - return $this; - } // setExt() - - /** - * Set the value of [type] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setType($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->type !== $v || $this->isNew()) { - $this->type = $v; - $this->modifiedColumns[] = CcAccessPeer::TYPE; - } - - return $this; - } // setType() - - /** - * Set the value of [parent] column. - * - * @param string $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setParent($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->parent !== $v) { - $this->parent = $v; - $this->modifiedColumns[] = CcAccessPeer::PARENT; - } - - return $this; - } // setParent() - - /** - * Set the value of [owner] column. - * - * @param int $v new value - * @return CcAccess The current object (for fluent API support) - */ - public function setOwner($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->owner !== $v) { - $this->owner = $v; - $this->modifiedColumns[] = CcAccessPeer::OWNER; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setOwner() - - /** - * Sets the value of [ts] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcAccess The current object (for fluent API support) - */ - public function setTs($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->ts !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcAccessPeer::TS; - } - } // if either are not null - - return $this; - } // setTs() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->chsum !== '') { - return false; - } - - if ($this->ext !== '') { - return false; - } - - if ($this->type !== '') { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->gunid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->token = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->chsum = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->ext = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->type = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->parent = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->owner = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; - $this->ts = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcAccess object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcAccessPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcAccessQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcAccessPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcAccessPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcAccessPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcAccessPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows += CcAccessPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcAccessPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcAccessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getGunid(); - break; - case 2: - return $this->getToken(); - break; - case 3: - return $this->getChsum(); - break; - case 4: - return $this->getExt(); - break; - case 5: - return $this->getType(); - break; - case 6: - return $this->getParent(); - break; - case 7: - return $this->getOwner(); - break; - case 8: - return $this->getTs(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcAccessPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getGunid(), - $keys[2] => $this->getToken(), - $keys[3] => $this->getChsum(), - $keys[4] => $this->getExt(), - $keys[5] => $this->getType(), - $keys[6] => $this->getParent(), - $keys[7] => $this->getOwner(), - $keys[8] => $this->getTs(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcAccessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setGunid($value); - break; - case 2: - $this->setToken($value); - break; - case 3: - $this->setChsum($value); - break; - case 4: - $this->setExt($value); - break; - case 5: - $this->setType($value); - break; - case 6: - $this->setParent($value); - break; - case 7: - $this->setOwner($value); - break; - case 8: - $this->setTs($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcAccessPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setGunid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setToken($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setChsum($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setExt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setType($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setParent($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setOwner($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setTs($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcAccessPeer::ID)) $criteria->add(CcAccessPeer::ID, $this->id); - if ($this->isColumnModified(CcAccessPeer::GUNID)) $criteria->add(CcAccessPeer::GUNID, $this->gunid); - if ($this->isColumnModified(CcAccessPeer::TOKEN)) $criteria->add(CcAccessPeer::TOKEN, $this->token); - if ($this->isColumnModified(CcAccessPeer::CHSUM)) $criteria->add(CcAccessPeer::CHSUM, $this->chsum); - if ($this->isColumnModified(CcAccessPeer::EXT)) $criteria->add(CcAccessPeer::EXT, $this->ext); - if ($this->isColumnModified(CcAccessPeer::TYPE)) $criteria->add(CcAccessPeer::TYPE, $this->type); - if ($this->isColumnModified(CcAccessPeer::PARENT)) $criteria->add(CcAccessPeer::PARENT, $this->parent); - if ($this->isColumnModified(CcAccessPeer::OWNER)) $criteria->add(CcAccessPeer::OWNER, $this->owner); - if ($this->isColumnModified(CcAccessPeer::TS)) $criteria->add(CcAccessPeer::TS, $this->ts); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); - $criteria->add(CcAccessPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcAccess (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setGunid($this->gunid); - $copyObj->setToken($this->token); - $copyObj->setChsum($this->chsum); - $copyObj->setExt($this->ext); - $copyObj->setType($this->type); - $copyObj->setParent($this->parent); - $copyObj->setOwner($this->owner); - $copyObj->setTs($this->ts); - - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcAccess Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcAccessPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcAccessPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcAccess The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setOwner(NULL); - } else { - $this->setOwner($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcAccess($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->owner !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->owner, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcAccesss($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->gunid = null; - $this->token = null; - $this->chsum = null; - $this->ext = null; - $this->type = null; - $this->parent = null; - $this->owner = null; - $this->ts = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcAccess diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcAccessPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcAccessPeer.php deleted file mode 100644 index f6614d330..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcAccessPeer.php +++ /dev/null @@ -1,1008 +0,0 @@ - array ('Id', 'Gunid', 'Token', 'Chsum', 'Ext', 'Type', 'Parent', 'Owner', 'Ts', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'gunid', 'token', 'chsum', 'ext', 'type', 'parent', 'owner', 'ts', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::TOKEN, self::CHSUM, self::EXT, self::TYPE, self::PARENT, self::OWNER, self::TS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'TOKEN', 'CHSUM', 'EXT', 'TYPE', 'PARENT', 'OWNER', 'TS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'token', 'chsum', 'ext', 'type', 'parent', 'owner', 'ts', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Gunid' => 1, 'Token' => 2, 'Chsum' => 3, 'Ext' => 4, 'Type' => 5, 'Parent' => 6, 'Owner' => 7, 'Ts' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'gunid' => 1, 'token' => 2, 'chsum' => 3, 'ext' => 4, 'type' => 5, 'parent' => 6, 'owner' => 7, 'ts' => 8, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::TOKEN => 2, self::CHSUM => 3, self::EXT => 4, self::TYPE => 5, self::PARENT => 6, self::OWNER => 7, self::TS => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'TOKEN' => 2, 'CHSUM' => 3, 'EXT' => 4, 'TYPE' => 5, 'PARENT' => 6, 'OWNER' => 7, 'TS' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'token' => 2, 'chsum' => 3, 'ext' => 4, 'type' => 5, 'parent' => 6, 'owner' => 7, 'ts' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcAccessPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcAccessPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcAccessPeer::ID); - $criteria->addSelectColumn(CcAccessPeer::GUNID); - $criteria->addSelectColumn(CcAccessPeer::TOKEN); - $criteria->addSelectColumn(CcAccessPeer::CHSUM); - $criteria->addSelectColumn(CcAccessPeer::EXT); - $criteria->addSelectColumn(CcAccessPeer::TYPE); - $criteria->addSelectColumn(CcAccessPeer::PARENT); - $criteria->addSelectColumn(CcAccessPeer::OWNER); - $criteria->addSelectColumn(CcAccessPeer::TS); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.GUNID'); - $criteria->addSelectColumn($alias . '.TOKEN'); - $criteria->addSelectColumn($alias . '.CHSUM'); - $criteria->addSelectColumn($alias . '.EXT'); - $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.PARENT'); - $criteria->addSelectColumn($alias . '.OWNER'); - $criteria->addSelectColumn($alias . '.TS'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcAccessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcAccess - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcAccessPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcAccessPeer::populateObjects(CcAccessPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcAccessPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcAccess $value A CcAccess object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcAccess $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcAccess object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcAccess) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcAccess object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcAccess Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_access - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcAccessPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcAccessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcAccessPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcAccess object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcAccessPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcAccessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcAccessPeer::NUM_COLUMNS; - } else { - $cls = CcAccessPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcAccessPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcAccessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcAccess objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcAccess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcAccessPeer::addSelectColumns($criteria); - $startcol = (CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcAccessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcAccessPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcAccessPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcAccess) to $obj2 (CcSubjs) - $obj2->addCcAccess($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcAccessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcAccess objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcAccess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcAccessPeer::addSelectColumns($criteria); - $startcol2 = (CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcAccessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcAccessPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcAccessPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcAccess) to the collection in $obj2 (CcSubjs) - $obj2->addCcAccess($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcAccessPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcAccessPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcAccessTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcAccessPeer::CLASS_DEFAULT : CcAccessPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcAccess or Criteria object. - * - * @param mixed $values Criteria or CcAccess object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcAccess object - } - - if ($criteria->containsKey(CcAccessPeer::ID) && $criteria->keyContainsValue(CcAccessPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcAccessPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcAccess or Criteria object. - * - * @param mixed $values Criteria or CcAccess object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcAccessPeer::ID); - $value = $criteria->remove(CcAccessPeer::ID); - if ($value) { - $selectCriteria->add(CcAccessPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); - } - - } else { // $values is CcAccess object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_access table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcAccessPeer::TABLE_NAME, $con, CcAccessPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcAccessPeer::clearInstancePool(); - CcAccessPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcAccess or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcAccess object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcAccessPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcAccess) { // it's a model object - // invalidate the cache for this single object - CcAccessPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcAccessPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcAccessPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcAccessPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcAccess object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcAccess $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcAccess $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcAccessPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcAccessPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcAccessPeer::DATABASE_NAME, CcAccessPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcAccess - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcAccessPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); - $criteria->add(CcAccessPeer::ID, $pk); - - $v = CcAccessPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); - $criteria->add(CcAccessPeer::ID, $pks, Criteria::IN); - $objs = CcAccessPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcAccessPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcAccessPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcAccessQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcAccessQuery.php deleted file mode 100644 index d1e6b14c9..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcAccessQuery.php +++ /dev/null @@ -1,477 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcAccess|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcAccessPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcAccessPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcAccessPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcAccessPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the gunid column - * - * @param string $gunid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByGunid($gunid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($gunid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $gunid)) { - $gunid = str_replace('*', '%', $gunid); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcAccessPeer::GUNID, $gunid, $comparison); - } - - /** - * Filter the query on the token column - * - * @param string|array $token The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByToken($token = null, $comparison = null) - { - if (is_array($token)) { - $useMinMax = false; - if (isset($token['min'])) { - $this->addUsingAlias(CcAccessPeer::TOKEN, $token['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($token['max'])) { - $this->addUsingAlias(CcAccessPeer::TOKEN, $token['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcAccessPeer::TOKEN, $token, $comparison); - } - - /** - * Filter the query on the chsum column - * - * @param string $chsum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByChsum($chsum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($chsum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $chsum)) { - $chsum = str_replace('*', '%', $chsum); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcAccessPeer::CHSUM, $chsum, $comparison); - } - - /** - * Filter the query on the ext column - * - * @param string $ext The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByExt($ext = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ext)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ext)) { - $ext = str_replace('*', '%', $ext); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcAccessPeer::EXT, $ext, $comparison); - } - - /** - * Filter the query on the type column - * - * @param string $type The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByType($type = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($type)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $type)) { - $type = str_replace('*', '%', $type); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcAccessPeer::TYPE, $type, $comparison); - } - - /** - * Filter the query on the parent column - * - * @param string|array $parent The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByParent($parent = null, $comparison = null) - { - if (is_array($parent)) { - $useMinMax = false; - if (isset($parent['min'])) { - $this->addUsingAlias(CcAccessPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($parent['max'])) { - $this->addUsingAlias(CcAccessPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcAccessPeer::PARENT, $parent, $comparison); - } - - /** - * Filter the query on the owner column - * - * @param int|array $owner The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByOwner($owner = null, $comparison = null) - { - if (is_array($owner)) { - $useMinMax = false; - if (isset($owner['min'])) { - $this->addUsingAlias(CcAccessPeer::OWNER, $owner['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($owner['max'])) { - $this->addUsingAlias(CcAccessPeer::OWNER, $owner['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcAccessPeer::OWNER, $owner, $comparison); - } - - /** - * Filter the query on the ts column - * - * @param string|array $ts The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByTs($ts = null, $comparison = null) - { - if (is_array($ts)) { - $useMinMax = false; - if (isset($ts['min'])) { - $this->addUsingAlias(CcAccessPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($ts['max'])) { - $this->addUsingAlias(CcAccessPeer::TS, $ts['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcAccessPeer::TS, $ts, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcAccessPeer::OWNER, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Exclude object from result - * - * @param CcAccess $ccAccess Object to remove from the list of results - * - * @return CcAccessQuery The current query, for fluid interface - */ - public function prune($ccAccess = null) - { - if ($ccAccess) { - $this->addUsingAlias(CcAccessPeer::ID, $ccAccess->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcAccessQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcBackup.php b/backend/propel-db/build/classes/campcaster/om/BaseCcBackup.php deleted file mode 100644 index 37d8fb83b..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcBackup.php +++ /dev/null @@ -1,956 +0,0 @@ -token; - } - - /** - * Get the [sessionid] column value. - * - * @return string - */ - public function getSessionid() - { - return $this->sessionid; - } - - /** - * Get the [status] column value. - * - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * Get the [optionally formatted] temporal [fromtime] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getFromtime($format = 'Y-m-d H:i:s') - { - if ($this->fromtime === null) { - return null; - } - - - - try { - $dt = new DateTime($this->fromtime); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fromtime, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [totime] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getTotime($format = 'Y-m-d H:i:s') - { - if ($this->totime === null) { - return null; - } - - - - try { - $dt = new DateTime($this->totime); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->totime, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [token] column. - * - * @param string $v new value - * @return CcBackup The current object (for fluent API support) - */ - public function setToken($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->token !== $v) { - $this->token = $v; - $this->modifiedColumns[] = CcBackupPeer::TOKEN; - } - - return $this; - } // setToken() - - /** - * Set the value of [sessionid] column. - * - * @param string $v new value - * @return CcBackup The current object (for fluent API support) - */ - public function setSessionid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sessionid !== $v) { - $this->sessionid = $v; - $this->modifiedColumns[] = CcBackupPeer::SESSIONID; - } - - return $this; - } // setSessionid() - - /** - * Set the value of [status] column. - * - * @param string $v new value - * @return CcBackup The current object (for fluent API support) - */ - public function setStatus($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->status !== $v) { - $this->status = $v; - $this->modifiedColumns[] = CcBackupPeer::STATUS; - } - - return $this; - } // setStatus() - - /** - * Sets the value of [fromtime] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcBackup The current object (for fluent API support) - */ - public function setFromtime($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->fromtime !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->fromtime !== null && $tmpDt = new DateTime($this->fromtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->fromtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcBackupPeer::FROMTIME; - } - } // if either are not null - - return $this; - } // setFromtime() - - /** - * Sets the value of [totime] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcBackup The current object (for fluent API support) - */ - public function setTotime($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->totime !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->totime !== null && $tmpDt = new DateTime($this->totime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->totime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcBackupPeer::TOTIME; - } - } // if either are not null - - return $this; - } // setTotime() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->token = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; - $this->sessionid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->status = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->fromtime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->totime = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 5; // 5 = CcBackupPeer::NUM_COLUMNS - CcBackupPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcBackup object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcBackupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcBackupQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcBackupPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setNew(false); - } else { - $affectedRows = CcBackupPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = CcBackupPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcBackupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getToken(); - break; - case 1: - return $this->getSessionid(); - break; - case 2: - return $this->getStatus(); - break; - case 3: - return $this->getFromtime(); - break; - case 4: - return $this->getTotime(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) - { - $keys = CcBackupPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getToken(), - $keys[1] => $this->getSessionid(), - $keys[2] => $this->getStatus(), - $keys[3] => $this->getFromtime(), - $keys[4] => $this->getTotime(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcBackupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setToken($value); - break; - case 1: - $this->setSessionid($value); - break; - case 2: - $this->setStatus($value); - break; - case 3: - $this->setFromtime($value); - break; - case 4: - $this->setTotime($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcBackupPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setToken($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setSessionid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setStatus($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setFromtime($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setTotime($arr[$keys[4]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcBackupPeer::TOKEN)) $criteria->add(CcBackupPeer::TOKEN, $this->token); - if ($this->isColumnModified(CcBackupPeer::SESSIONID)) $criteria->add(CcBackupPeer::SESSIONID, $this->sessionid); - if ($this->isColumnModified(CcBackupPeer::STATUS)) $criteria->add(CcBackupPeer::STATUS, $this->status); - if ($this->isColumnModified(CcBackupPeer::FROMTIME)) $criteria->add(CcBackupPeer::FROMTIME, $this->fromtime); - if ($this->isColumnModified(CcBackupPeer::TOTIME)) $criteria->add(CcBackupPeer::TOTIME, $this->totime); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); - $criteria->add(CcBackupPeer::TOKEN, $this->token); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return string - */ - public function getPrimaryKey() - { - return $this->getToken(); - } - - /** - * Generic method to set the primary key (token column). - * - * @param string $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setToken($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getToken(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcBackup (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setToken($this->token); - $copyObj->setSessionid($this->sessionid); - $copyObj->setStatus($this->status); - $copyObj->setFromtime($this->fromtime); - $copyObj->setTotime($this->totime); - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcBackup Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcBackupPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcBackupPeer(); - } - return self::$peer; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->token = null; - $this->sessionid = null; - $this->status = null; - $this->fromtime = null; - $this->totime = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcBackup diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcBackupPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcBackupPeer.php deleted file mode 100644 index b8c6a3066..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcBackupPeer.php +++ /dev/null @@ -1,750 +0,0 @@ - array ('Token', 'Sessionid', 'Status', 'Fromtime', 'Totime', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('token', 'sessionid', 'status', 'fromtime', 'totime', ), - BasePeer::TYPE_COLNAME => array (self::TOKEN, self::SESSIONID, self::STATUS, self::FROMTIME, self::TOTIME, ), - BasePeer::TYPE_RAW_COLNAME => array ('TOKEN', 'SESSIONID', 'STATUS', 'FROMTIME', 'TOTIME', ), - BasePeer::TYPE_FIELDNAME => array ('token', 'sessionid', 'status', 'fromtime', 'totime', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Token' => 0, 'Sessionid' => 1, 'Status' => 2, 'Fromtime' => 3, 'Totime' => 4, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('token' => 0, 'sessionid' => 1, 'status' => 2, 'fromtime' => 3, 'totime' => 4, ), - BasePeer::TYPE_COLNAME => array (self::TOKEN => 0, self::SESSIONID => 1, self::STATUS => 2, self::FROMTIME => 3, self::TOTIME => 4, ), - BasePeer::TYPE_RAW_COLNAME => array ('TOKEN' => 0, 'SESSIONID' => 1, 'STATUS' => 2, 'FROMTIME' => 3, 'TOTIME' => 4, ), - BasePeer::TYPE_FIELDNAME => array ('token' => 0, 'sessionid' => 1, 'status' => 2, 'fromtime' => 3, 'totime' => 4, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcBackupPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcBackupPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcBackupPeer::TOKEN); - $criteria->addSelectColumn(CcBackupPeer::SESSIONID); - $criteria->addSelectColumn(CcBackupPeer::STATUS); - $criteria->addSelectColumn(CcBackupPeer::FROMTIME); - $criteria->addSelectColumn(CcBackupPeer::TOTIME); - } else { - $criteria->addSelectColumn($alias . '.TOKEN'); - $criteria->addSelectColumn($alias . '.SESSIONID'); - $criteria->addSelectColumn($alias . '.STATUS'); - $criteria->addSelectColumn($alias . '.FROMTIME'); - $criteria->addSelectColumn($alias . '.TOTIME'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcBackupPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcBackupPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcBackup - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcBackupPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcBackupPeer::populateObjects(CcBackupPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcBackupPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcBackup $value A CcBackup object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcBackup $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getToken(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcBackup object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcBackup) { - $key = (string) $value->getToken(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcBackup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcBackup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_backup - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (string) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcBackupPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcBackupPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcBackupPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcBackupPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcBackup object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcBackupPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcBackupPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcBackupPeer::NUM_COLUMNS; - } else { - $cls = CcBackupPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcBackupPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcBackupPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcBackupPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcBackupTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcBackupPeer::CLASS_DEFAULT : CcBackupPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcBackup or Criteria object. - * - * @param mixed $values Criteria or CcBackup object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcBackup object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcBackup or Criteria object. - * - * @param mixed $values Criteria or CcBackup object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcBackupPeer::TOKEN); - $value = $criteria->remove(CcBackupPeer::TOKEN); - if ($value) { - $selectCriteria->add(CcBackupPeer::TOKEN, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcBackupPeer::TABLE_NAME); - } - - } else { // $values is CcBackup object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_backup table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcBackupPeer::TABLE_NAME, $con, CcBackupPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcBackupPeer::clearInstancePool(); - CcBackupPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcBackup or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcBackup object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcBackupPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcBackup) { // it's a model object - // invalidate the cache for this single object - CcBackupPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcBackupPeer::TOKEN, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcBackupPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcBackupPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcBackup object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcBackup $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcBackup $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcBackupPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcBackupPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcBackupPeer::DATABASE_NAME, CcBackupPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param string $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcBackup - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcBackupPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); - $criteria->add(CcBackupPeer::TOKEN, $pk); - - $v = CcBackupPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); - $criteria->add(CcBackupPeer::TOKEN, $pks, Criteria::IN); - $objs = CcBackupPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcBackupPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcBackupPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcBackupQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcBackupQuery.php deleted file mode 100644 index f74f068bf..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcBackupQuery.php +++ /dev/null @@ -1,292 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcBackup|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcBackupPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcBackupPeer::TOKEN, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcBackupPeer::TOKEN, $keys, Criteria::IN); - } - - /** - * Filter the query on the token column - * - * @param string $token The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByToken($token = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($token)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $token)) { - $token = str_replace('*', '%', $token); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcBackupPeer::TOKEN, $token, $comparison); - } - - /** - * Filter the query on the sessionid column - * - * @param string $sessionid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterBySessionid($sessionid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($sessionid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $sessionid)) { - $sessionid = str_replace('*', '%', $sessionid); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcBackupPeer::SESSIONID, $sessionid, $comparison); - } - - /** - * Filter the query on the status column - * - * @param string $status The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByStatus($status = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($status)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $status)) { - $status = str_replace('*', '%', $status); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcBackupPeer::STATUS, $status, $comparison); - } - - /** - * Filter the query on the fromtime column - * - * @param string|array $fromtime The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByFromtime($fromtime = null, $comparison = null) - { - if (is_array($fromtime)) { - $useMinMax = false; - if (isset($fromtime['min'])) { - $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($fromtime['max'])) { - $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime, $comparison); - } - - /** - * Filter the query on the totime column - * - * @param string|array $totime The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function filterByTotime($totime = null, $comparison = null) - { - if (is_array($totime)) { - $useMinMax = false; - if (isset($totime['min'])) { - $this->addUsingAlias(CcBackupPeer::TOTIME, $totime['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($totime['max'])) { - $this->addUsingAlias(CcBackupPeer::TOTIME, $totime['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcBackupPeer::TOTIME, $totime, $comparison); - } - - /** - * Exclude object from result - * - * @param CcBackup $ccBackup Object to remove from the list of results - * - * @return CcBackupQuery The current query, for fluid interface - */ - public function prune($ccBackup = null) - { - if ($ccBackup) { - $this->addUsingAlias(CcBackupPeer::TOKEN, $ccBackup->getToken(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcBackupQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcFiles.php b/backend/propel-db/build/classes/campcaster/om/BaseCcFiles.php deleted file mode 100644 index 94d732f04..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcFiles.php +++ /dev/null @@ -1,3643 +0,0 @@ -name = ''; - $this->mime = ''; - $this->ftype = ''; - $this->filepath = ''; - $this->state = 'empty'; - $this->currentlyaccessing = 0; - } - - /** - * Initializes internal state of BaseCcFiles object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getDbId() - { - return $this->id; - } - - /** - * Get the [gunid] column value. - * - * @return string - */ - public function getGunid() - { - return $this->gunid; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get the [mime] column value. - * - * @return string - */ - public function getMime() - { - return $this->mime; - } - - /** - * Get the [ftype] column value. - * - * @return string - */ - public function getFtype() - { - return $this->ftype; - } - - /** - * Get the [filepath] column value. - * - * @return string - */ - public function getfilepath() - { - return $this->filepath; - } - - /** - * Get the [state] column value. - * - * @return string - */ - public function getState() - { - return $this->state; - } - - /** - * Get the [currentlyaccessing] column value. - * - * @return int - */ - public function getCurrentlyaccessing() - { - return $this->currentlyaccessing; - } - - /** - * Get the [editedby] column value. - * - * @return int - */ - public function getEditedby() - { - return $this->editedby; - } - - /** - * Get the [optionally formatted] temporal [mtime] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getMtime($format = 'Y-m-d H:i:s') - { - if ($this->mtime === null) { - return null; - } - - - - try { - $dt = new DateTime($this->mtime); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [md5] column value. - * - * @return string - */ - public function getMd5() - { - return $this->md5; - } - - /** - * Get the [track_title] column value. - * - * @return string - */ - public function getTrackTitle() - { - return $this->track_title; - } - - /** - * Get the [artist_name] column value. - * - * @return string - */ - public function getArtistName() - { - return $this->artist_name; - } - - /** - * Get the [bit_rate] column value. - * - * @return string - */ - public function getBitRate() - { - return $this->bit_rate; - } - - /** - * Get the [sample_rate] column value. - * - * @return string - */ - public function getSampleRate() - { - return $this->sample_rate; - } - - /** - * Get the [format] column value. - * - * @return string - */ - public function getFormat() - { - return $this->format; - } - - /** - * Get the [optionally formatted] temporal [length] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbLength($format = '%X') - { - if ($this->length === null) { - return null; - } - - - - try { - $dt = new DateTime($this->length); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->length, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [album_title] column value. - * - * @return string - */ - public function getAlbumTitle() - { - return $this->album_title; - } - - /** - * Get the [genre] column value. - * - * @return string - */ - public function getGenre() - { - return $this->genre; - } - - /** - * Get the [comments] column value. - * - * @return string - */ - public function getComments() - { - return $this->comments; - } - - /** - * Get the [year] column value. - * - * @return string - */ - public function getYear() - { - return $this->year; - } - - /** - * Get the [track_number] column value. - * - * @return int - */ - public function getTrackNumber() - { - return $this->track_number; - } - - /** - * Get the [channels] column value. - * - * @return int - */ - public function getChannels() - { - return $this->channels; - } - - /** - * Get the [url] column value. - * - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Get the [bpm] column value. - * - * @return string - */ - public function getBpm() - { - return $this->bpm; - } - - /** - * Get the [rating] column value. - * - * @return string - */ - public function getRating() - { - return $this->rating; - } - - /** - * Get the [encoded_by] column value. - * - * @return string - */ - public function getEncodedBy() - { - return $this->encoded_by; - } - - /** - * Get the [disc_number] column value. - * - * @return string - */ - public function getDiscNumber() - { - return $this->disc_number; - } - - /** - * Get the [mood] column value. - * - * @return string - */ - public function getMood() - { - return $this->mood; - } - - /** - * Get the [label] column value. - * - * @return string - */ - public function getLabel() - { - return $this->label; - } - - /** - * Get the [composer] column value. - * - * @return string - */ - public function getComposer() - { - return $this->composer; - } - - /** - * Get the [encoder] column value. - * - * @return string - */ - public function getEncoder() - { - return $this->encoder; - } - - /** - * Get the [checksum] column value. - * - * @return string - */ - public function getChecksum() - { - return $this->checksum; - } - - /** - * Get the [lyrics] column value. - * - * @return string - */ - public function getLyrics() - { - return $this->lyrics; - } - - /** - * Get the [orchestra] column value. - * - * @return string - */ - public function getOrchestra() - { - return $this->orchestra; - } - - /** - * Get the [conductor] column value. - * - * @return string - */ - public function getConductor() - { - return $this->conductor; - } - - /** - * Get the [lyricist] column value. - * - * @return string - */ - public function getLyricist() - { - return $this->lyricist; - } - - /** - * Get the [original_lyricist] column value. - * - * @return string - */ - public function getOriginalLyricist() - { - return $this->original_lyricist; - } - - /** - * Get the [radio_station_name] column value. - * - * @return string - */ - public function getRadioStationName() - { - return $this->radio_station_name; - } - - /** - * Get the [info_url] column value. - * - * @return string - */ - public function getInfoUrl() - { - return $this->info_url; - } - - /** - * Get the [artist_url] column value. - * - * @return string - */ - public function getArtistUrl() - { - return $this->artist_url; - } - - /** - * Get the [audio_source_url] column value. - * - * @return string - */ - public function getAudioSourceUrl() - { - return $this->audio_source_url; - } - - /** - * Get the [radio_station_url] column value. - * - * @return string - */ - public function getRadioStationUrl() - { - return $this->radio_station_url; - } - - /** - * Get the [buy_this_url] column value. - * - * @return string - */ - public function getBuyThisUrl() - { - return $this->buy_this_url; - } - - /** - * Get the [isrc_number] column value. - * - * @return string - */ - public function getIsrcNumber() - { - return $this->isrc_number; - } - - /** - * Get the [catalog_number] column value. - * - * @return string - */ - public function getCatalogNumber() - { - return $this->catalog_number; - } - - /** - * Get the [original_artist] column value. - * - * @return string - */ - public function getOriginalArtist() - { - return $this->original_artist; - } - - /** - * Get the [copyright] column value. - * - * @return string - */ - public function getCopyright() - { - return $this->copyright; - } - - /** - * Get the [report_datetime] column value. - * - * @return string - */ - public function getReportDatetime() - { - return $this->report_datetime; - } - - /** - * Get the [report_location] column value. - * - * @return string - */ - public function getReportLocation() - { - return $this->report_location; - } - - /** - * Get the [report_organization] column value. - * - * @return string - */ - public function getReportOrganization() - { - return $this->report_organization; - } - - /** - * Get the [subject] column value. - * - * @return string - */ - public function getSubject() - { - return $this->subject; - } - - /** - * Get the [contributor] column value. - * - * @return string - */ - public function getContributor() - { - return $this->contributor; - } - - /** - * Get the [language] column value. - * - * @return string - */ - public function getLanguage() - { - return $this->language; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setDbId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcFilesPeer::ID; - } - - return $this; - } // setDbId() - - /** - * Set the value of [gunid] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setGunid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->gunid !== $v) { - $this->gunid = $v; - $this->modifiedColumns[] = CcFilesPeer::GUNID; - } - - return $this; - } // setGunid() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v || $this->isNew()) { - $this->name = $v; - $this->modifiedColumns[] = CcFilesPeer::NAME; - } - - return $this; - } // setName() - - /** - * Set the value of [mime] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setMime($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->mime !== $v || $this->isNew()) { - $this->mime = $v; - $this->modifiedColumns[] = CcFilesPeer::MIME; - } - - return $this; - } // setMime() - - /** - * Set the value of [ftype] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setFtype($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ftype !== $v || $this->isNew()) { - $this->ftype = $v; - $this->modifiedColumns[] = CcFilesPeer::FTYPE; - } - - return $this; - } // setFtype() - - /** - * Set the value of [filepath] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setfilepath($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->filepath !== $v || $this->isNew()) { - $this->filepath = $v; - $this->modifiedColumns[] = CcFilesPeer::FILEPATH; - } - - return $this; - } // setfilepath() - - /** - * Set the value of [state] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setState($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->state !== $v || $this->isNew()) { - $this->state = $v; - $this->modifiedColumns[] = CcFilesPeer::STATE; - } - - return $this; - } // setState() - - /** - * Set the value of [currentlyaccessing] column. - * - * @param int $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setCurrentlyaccessing($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->currentlyaccessing !== $v || $this->isNew()) { - $this->currentlyaccessing = $v; - $this->modifiedColumns[] = CcFilesPeer::CURRENTLYACCESSING; - } - - return $this; - } // setCurrentlyaccessing() - - /** - * Set the value of [editedby] column. - * - * @param int $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setEditedby($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->editedby !== $v) { - $this->editedby = $v; - $this->modifiedColumns[] = CcFilesPeer::EDITEDBY; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setEditedby() - - /** - * Sets the value of [mtime] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcFiles The current object (for fluent API support) - */ - public function setMtime($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->mtime !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcFilesPeer::MTIME; - } - } // if either are not null - - return $this; - } // setMtime() - - /** - * Set the value of [md5] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setMd5($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->md5 !== $v) { - $this->md5 = $v; - $this->modifiedColumns[] = CcFilesPeer::MD5; - } - - return $this; - } // setMd5() - - /** - * Set the value of [track_title] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setTrackTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->track_title !== $v) { - $this->track_title = $v; - $this->modifiedColumns[] = CcFilesPeer::TRACK_TITLE; - } - - return $this; - } // setTrackTitle() - - /** - * Set the value of [artist_name] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setArtistName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->artist_name !== $v) { - $this->artist_name = $v; - $this->modifiedColumns[] = CcFilesPeer::ARTIST_NAME; - } - - return $this; - } // setArtistName() - - /** - * Set the value of [bit_rate] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setBitRate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->bit_rate !== $v) { - $this->bit_rate = $v; - $this->modifiedColumns[] = CcFilesPeer::BIT_RATE; - } - - return $this; - } // setBitRate() - - /** - * Set the value of [sample_rate] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setSampleRate($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sample_rate !== $v) { - $this->sample_rate = $v; - $this->modifiedColumns[] = CcFilesPeer::SAMPLE_RATE; - } - - return $this; - } // setSampleRate() - - /** - * Set the value of [format] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setFormat($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->format !== $v) { - $this->format = $v; - $this->modifiedColumns[] = CcFilesPeer::FORMAT; - } - - return $this; - } // setFormat() - - /** - * Sets the value of [length] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcFiles The current object (for fluent API support) - */ - public function setDbLength($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->length !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->length !== null && $tmpDt = new DateTime($this->length)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->length = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcFilesPeer::LENGTH; - } - } // if either are not null - - return $this; - } // setDbLength() - - /** - * Set the value of [album_title] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setAlbumTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->album_title !== $v) { - $this->album_title = $v; - $this->modifiedColumns[] = CcFilesPeer::ALBUM_TITLE; - } - - return $this; - } // setAlbumTitle() - - /** - * Set the value of [genre] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setGenre($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->genre !== $v) { - $this->genre = $v; - $this->modifiedColumns[] = CcFilesPeer::GENRE; - } - - return $this; - } // setGenre() - - /** - * Set the value of [comments] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setComments($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->comments !== $v) { - $this->comments = $v; - $this->modifiedColumns[] = CcFilesPeer::COMMENTS; - } - - return $this; - } // setComments() - - /** - * Set the value of [year] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setYear($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->year !== $v) { - $this->year = $v; - $this->modifiedColumns[] = CcFilesPeer::YEAR; - } - - return $this; - } // setYear() - - /** - * Set the value of [track_number] column. - * - * @param int $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setTrackNumber($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->track_number !== $v) { - $this->track_number = $v; - $this->modifiedColumns[] = CcFilesPeer::TRACK_NUMBER; - } - - return $this; - } // setTrackNumber() - - /** - * Set the value of [channels] column. - * - * @param int $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setChannels($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->channels !== $v) { - $this->channels = $v; - $this->modifiedColumns[] = CcFilesPeer::CHANNELS; - } - - return $this; - } // setChannels() - - /** - * Set the value of [url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->url !== $v) { - $this->url = $v; - $this->modifiedColumns[] = CcFilesPeer::URL; - } - - return $this; - } // setUrl() - - /** - * Set the value of [bpm] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setBpm($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->bpm !== $v) { - $this->bpm = $v; - $this->modifiedColumns[] = CcFilesPeer::BPM; - } - - return $this; - } // setBpm() - - /** - * Set the value of [rating] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setRating($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->rating !== $v) { - $this->rating = $v; - $this->modifiedColumns[] = CcFilesPeer::RATING; - } - - return $this; - } // setRating() - - /** - * Set the value of [encoded_by] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setEncodedBy($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->encoded_by !== $v) { - $this->encoded_by = $v; - $this->modifiedColumns[] = CcFilesPeer::ENCODED_BY; - } - - return $this; - } // setEncodedBy() - - /** - * Set the value of [disc_number] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setDiscNumber($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->disc_number !== $v) { - $this->disc_number = $v; - $this->modifiedColumns[] = CcFilesPeer::DISC_NUMBER; - } - - return $this; - } // setDiscNumber() - - /** - * Set the value of [mood] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setMood($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->mood !== $v) { - $this->mood = $v; - $this->modifiedColumns[] = CcFilesPeer::MOOD; - } - - return $this; - } // setMood() - - /** - * Set the value of [label] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setLabel($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->label !== $v) { - $this->label = $v; - $this->modifiedColumns[] = CcFilesPeer::LABEL; - } - - return $this; - } // setLabel() - - /** - * Set the value of [composer] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setComposer($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->composer !== $v) { - $this->composer = $v; - $this->modifiedColumns[] = CcFilesPeer::COMPOSER; - } - - return $this; - } // setComposer() - - /** - * Set the value of [encoder] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setEncoder($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->encoder !== $v) { - $this->encoder = $v; - $this->modifiedColumns[] = CcFilesPeer::ENCODER; - } - - return $this; - } // setEncoder() - - /** - * Set the value of [checksum] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setChecksum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->checksum !== $v) { - $this->checksum = $v; - $this->modifiedColumns[] = CcFilesPeer::CHECKSUM; - } - - return $this; - } // setChecksum() - - /** - * Set the value of [lyrics] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setLyrics($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lyrics !== $v) { - $this->lyrics = $v; - $this->modifiedColumns[] = CcFilesPeer::LYRICS; - } - - return $this; - } // setLyrics() - - /** - * Set the value of [orchestra] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setOrchestra($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->orchestra !== $v) { - $this->orchestra = $v; - $this->modifiedColumns[] = CcFilesPeer::ORCHESTRA; - } - - return $this; - } // setOrchestra() - - /** - * Set the value of [conductor] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setConductor($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->conductor !== $v) { - $this->conductor = $v; - $this->modifiedColumns[] = CcFilesPeer::CONDUCTOR; - } - - return $this; - } // setConductor() - - /** - * Set the value of [lyricist] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setLyricist($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lyricist !== $v) { - $this->lyricist = $v; - $this->modifiedColumns[] = CcFilesPeer::LYRICIST; - } - - return $this; - } // setLyricist() - - /** - * Set the value of [original_lyricist] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setOriginalLyricist($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->original_lyricist !== $v) { - $this->original_lyricist = $v; - $this->modifiedColumns[] = CcFilesPeer::ORIGINAL_LYRICIST; - } - - return $this; - } // setOriginalLyricist() - - /** - * Set the value of [radio_station_name] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setRadioStationName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->radio_station_name !== $v) { - $this->radio_station_name = $v; - $this->modifiedColumns[] = CcFilesPeer::RADIO_STATION_NAME; - } - - return $this; - } // setRadioStationName() - - /** - * Set the value of [info_url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setInfoUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->info_url !== $v) { - $this->info_url = $v; - $this->modifiedColumns[] = CcFilesPeer::INFO_URL; - } - - return $this; - } // setInfoUrl() - - /** - * Set the value of [artist_url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setArtistUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->artist_url !== $v) { - $this->artist_url = $v; - $this->modifiedColumns[] = CcFilesPeer::ARTIST_URL; - } - - return $this; - } // setArtistUrl() - - /** - * Set the value of [audio_source_url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setAudioSourceUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->audio_source_url !== $v) { - $this->audio_source_url = $v; - $this->modifiedColumns[] = CcFilesPeer::AUDIO_SOURCE_URL; - } - - return $this; - } // setAudioSourceUrl() - - /** - * Set the value of [radio_station_url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setRadioStationUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->radio_station_url !== $v) { - $this->radio_station_url = $v; - $this->modifiedColumns[] = CcFilesPeer::RADIO_STATION_URL; - } - - return $this; - } // setRadioStationUrl() - - /** - * Set the value of [buy_this_url] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setBuyThisUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->buy_this_url !== $v) { - $this->buy_this_url = $v; - $this->modifiedColumns[] = CcFilesPeer::BUY_THIS_URL; - } - - return $this; - } // setBuyThisUrl() - - /** - * Set the value of [isrc_number] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setIsrcNumber($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->isrc_number !== $v) { - $this->isrc_number = $v; - $this->modifiedColumns[] = CcFilesPeer::ISRC_NUMBER; - } - - return $this; - } // setIsrcNumber() - - /** - * Set the value of [catalog_number] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setCatalogNumber($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->catalog_number !== $v) { - $this->catalog_number = $v; - $this->modifiedColumns[] = CcFilesPeer::CATALOG_NUMBER; - } - - return $this; - } // setCatalogNumber() - - /** - * Set the value of [original_artist] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setOriginalArtist($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->original_artist !== $v) { - $this->original_artist = $v; - $this->modifiedColumns[] = CcFilesPeer::ORIGINAL_ARTIST; - } - - return $this; - } // setOriginalArtist() - - /** - * Set the value of [copyright] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setCopyright($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->copyright !== $v) { - $this->copyright = $v; - $this->modifiedColumns[] = CcFilesPeer::COPYRIGHT; - } - - return $this; - } // setCopyright() - - /** - * Set the value of [report_datetime] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setReportDatetime($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->report_datetime !== $v) { - $this->report_datetime = $v; - $this->modifiedColumns[] = CcFilesPeer::REPORT_DATETIME; - } - - return $this; - } // setReportDatetime() - - /** - * Set the value of [report_location] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setReportLocation($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->report_location !== $v) { - $this->report_location = $v; - $this->modifiedColumns[] = CcFilesPeer::REPORT_LOCATION; - } - - return $this; - } // setReportLocation() - - /** - * Set the value of [report_organization] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setReportOrganization($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->report_organization !== $v) { - $this->report_organization = $v; - $this->modifiedColumns[] = CcFilesPeer::REPORT_ORGANIZATION; - } - - return $this; - } // setReportOrganization() - - /** - * Set the value of [subject] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setSubject($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->subject !== $v) { - $this->subject = $v; - $this->modifiedColumns[] = CcFilesPeer::SUBJECT; - } - - return $this; - } // setSubject() - - /** - * Set the value of [contributor] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setContributor($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->contributor !== $v) { - $this->contributor = $v; - $this->modifiedColumns[] = CcFilesPeer::CONTRIBUTOR; - } - - return $this; - } // setContributor() - - /** - * Set the value of [language] column. - * - * @param string $v new value - * @return CcFiles The current object (for fluent API support) - */ - public function setLanguage($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->language !== $v) { - $this->language = $v; - $this->modifiedColumns[] = CcFilesPeer::LANGUAGE; - } - - return $this; - } // setLanguage() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->name !== '') { - return false; - } - - if ($this->mime !== '') { - return false; - } - - if ($this->ftype !== '') { - return false; - } - - if ($this->filepath !== '') { - return false; - } - - if ($this->state !== 'empty') { - return false; - } - - if ($this->currentlyaccessing !== 0) { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->gunid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->mime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->ftype = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->filepath = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->state = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->currentlyaccessing = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; - $this->editedby = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; - $this->mtime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->md5 = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->track_title = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; - $this->artist_name = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; - $this->bit_rate = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; - $this->sample_rate = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; - $this->format = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; - $this->length = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; - $this->album_title = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; - $this->genre = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null; - $this->comments = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; - $this->year = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; - $this->track_number = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null; - $this->channels = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null; - $this->url = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null; - $this->bpm = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null; - $this->rating = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null; - $this->encoded_by = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null; - $this->disc_number = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null; - $this->mood = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null; - $this->label = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null; - $this->composer = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null; - $this->encoder = ($row[$startcol + 31] !== null) ? (string) $row[$startcol + 31] : null; - $this->checksum = ($row[$startcol + 32] !== null) ? (string) $row[$startcol + 32] : null; - $this->lyrics = ($row[$startcol + 33] !== null) ? (string) $row[$startcol + 33] : null; - $this->orchestra = ($row[$startcol + 34] !== null) ? (string) $row[$startcol + 34] : null; - $this->conductor = ($row[$startcol + 35] !== null) ? (string) $row[$startcol + 35] : null; - $this->lyricist = ($row[$startcol + 36] !== null) ? (string) $row[$startcol + 36] : null; - $this->original_lyricist = ($row[$startcol + 37] !== null) ? (string) $row[$startcol + 37] : null; - $this->radio_station_name = ($row[$startcol + 38] !== null) ? (string) $row[$startcol + 38] : null; - $this->info_url = ($row[$startcol + 39] !== null) ? (string) $row[$startcol + 39] : null; - $this->artist_url = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null; - $this->audio_source_url = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null; - $this->radio_station_url = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null; - $this->buy_this_url = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null; - $this->isrc_number = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null; - $this->catalog_number = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null; - $this->original_artist = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; - $this->copyright = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; - $this->report_datetime = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null; - $this->report_location = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null; - $this->report_organization = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null; - $this->subject = ($row[$startcol + 51] !== null) ? (string) $row[$startcol + 51] : null; - $this->contributor = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null; - $this->language = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 54; // 54 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcFiles object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcFilesPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - $this->collCcPlaylistcontentss = null; - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcFilesQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcFilesPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcFilesPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcFilesPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFilesPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setDbId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows += CcFilesPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - if ($this->collCcPlaylistcontentss !== null) { - foreach ($this->collCcPlaylistcontentss as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcFilesPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collCcPlaylistcontentss !== null) { - foreach ($this->collCcPlaylistcontentss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcFilesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getDbId(); - break; - case 1: - return $this->getGunid(); - break; - case 2: - return $this->getName(); - break; - case 3: - return $this->getMime(); - break; - case 4: - return $this->getFtype(); - break; - case 5: - return $this->getfilepath(); - break; - case 6: - return $this->getState(); - break; - case 7: - return $this->getCurrentlyaccessing(); - break; - case 8: - return $this->getEditedby(); - break; - case 9: - return $this->getMtime(); - break; - case 10: - return $this->getMd5(); - break; - case 11: - return $this->getTrackTitle(); - break; - case 12: - return $this->getArtistName(); - break; - case 13: - return $this->getBitRate(); - break; - case 14: - return $this->getSampleRate(); - break; - case 15: - return $this->getFormat(); - break; - case 16: - return $this->getDbLength(); - break; - case 17: - return $this->getAlbumTitle(); - break; - case 18: - return $this->getGenre(); - break; - case 19: - return $this->getComments(); - break; - case 20: - return $this->getYear(); - break; - case 21: - return $this->getTrackNumber(); - break; - case 22: - return $this->getChannels(); - break; - case 23: - return $this->getUrl(); - break; - case 24: - return $this->getBpm(); - break; - case 25: - return $this->getRating(); - break; - case 26: - return $this->getEncodedBy(); - break; - case 27: - return $this->getDiscNumber(); - break; - case 28: - return $this->getMood(); - break; - case 29: - return $this->getLabel(); - break; - case 30: - return $this->getComposer(); - break; - case 31: - return $this->getEncoder(); - break; - case 32: - return $this->getChecksum(); - break; - case 33: - return $this->getLyrics(); - break; - case 34: - return $this->getOrchestra(); - break; - case 35: - return $this->getConductor(); - break; - case 36: - return $this->getLyricist(); - break; - case 37: - return $this->getOriginalLyricist(); - break; - case 38: - return $this->getRadioStationName(); - break; - case 39: - return $this->getInfoUrl(); - break; - case 40: - return $this->getArtistUrl(); - break; - case 41: - return $this->getAudioSourceUrl(); - break; - case 42: - return $this->getRadioStationUrl(); - break; - case 43: - return $this->getBuyThisUrl(); - break; - case 44: - return $this->getIsrcNumber(); - break; - case 45: - return $this->getCatalogNumber(); - break; - case 46: - return $this->getOriginalArtist(); - break; - case 47: - return $this->getCopyright(); - break; - case 48: - return $this->getReportDatetime(); - break; - case 49: - return $this->getReportLocation(); - break; - case 50: - return $this->getReportOrganization(); - break; - case 51: - return $this->getSubject(); - break; - case 52: - return $this->getContributor(); - break; - case 53: - return $this->getLanguage(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcFilesPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getDbId(), - $keys[1] => $this->getGunid(), - $keys[2] => $this->getName(), - $keys[3] => $this->getMime(), - $keys[4] => $this->getFtype(), - $keys[5] => $this->getfilepath(), - $keys[6] => $this->getState(), - $keys[7] => $this->getCurrentlyaccessing(), - $keys[8] => $this->getEditedby(), - $keys[9] => $this->getMtime(), - $keys[10] => $this->getMd5(), - $keys[11] => $this->getTrackTitle(), - $keys[12] => $this->getArtistName(), - $keys[13] => $this->getBitRate(), - $keys[14] => $this->getSampleRate(), - $keys[15] => $this->getFormat(), - $keys[16] => $this->getDbLength(), - $keys[17] => $this->getAlbumTitle(), - $keys[18] => $this->getGenre(), - $keys[19] => $this->getComments(), - $keys[20] => $this->getYear(), - $keys[21] => $this->getTrackNumber(), - $keys[22] => $this->getChannels(), - $keys[23] => $this->getUrl(), - $keys[24] => $this->getBpm(), - $keys[25] => $this->getRating(), - $keys[26] => $this->getEncodedBy(), - $keys[27] => $this->getDiscNumber(), - $keys[28] => $this->getMood(), - $keys[29] => $this->getLabel(), - $keys[30] => $this->getComposer(), - $keys[31] => $this->getEncoder(), - $keys[32] => $this->getChecksum(), - $keys[33] => $this->getLyrics(), - $keys[34] => $this->getOrchestra(), - $keys[35] => $this->getConductor(), - $keys[36] => $this->getLyricist(), - $keys[37] => $this->getOriginalLyricist(), - $keys[38] => $this->getRadioStationName(), - $keys[39] => $this->getInfoUrl(), - $keys[40] => $this->getArtistUrl(), - $keys[41] => $this->getAudioSourceUrl(), - $keys[42] => $this->getRadioStationUrl(), - $keys[43] => $this->getBuyThisUrl(), - $keys[44] => $this->getIsrcNumber(), - $keys[45] => $this->getCatalogNumber(), - $keys[46] => $this->getOriginalArtist(), - $keys[47] => $this->getCopyright(), - $keys[48] => $this->getReportDatetime(), - $keys[49] => $this->getReportLocation(), - $keys[50] => $this->getReportOrganization(), - $keys[51] => $this->getSubject(), - $keys[52] => $this->getContributor(), - $keys[53] => $this->getLanguage(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcFilesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setDbId($value); - break; - case 1: - $this->setGunid($value); - break; - case 2: - $this->setName($value); - break; - case 3: - $this->setMime($value); - break; - case 4: - $this->setFtype($value); - break; - case 5: - $this->setfilepath($value); - break; - case 6: - $this->setState($value); - break; - case 7: - $this->setCurrentlyaccessing($value); - break; - case 8: - $this->setEditedby($value); - break; - case 9: - $this->setMtime($value); - break; - case 10: - $this->setMd5($value); - break; - case 11: - $this->setTrackTitle($value); - break; - case 12: - $this->setArtistName($value); - break; - case 13: - $this->setBitRate($value); - break; - case 14: - $this->setSampleRate($value); - break; - case 15: - $this->setFormat($value); - break; - case 16: - $this->setDbLength($value); - break; - case 17: - $this->setAlbumTitle($value); - break; - case 18: - $this->setGenre($value); - break; - case 19: - $this->setComments($value); - break; - case 20: - $this->setYear($value); - break; - case 21: - $this->setTrackNumber($value); - break; - case 22: - $this->setChannels($value); - break; - case 23: - $this->setUrl($value); - break; - case 24: - $this->setBpm($value); - break; - case 25: - $this->setRating($value); - break; - case 26: - $this->setEncodedBy($value); - break; - case 27: - $this->setDiscNumber($value); - break; - case 28: - $this->setMood($value); - break; - case 29: - $this->setLabel($value); - break; - case 30: - $this->setComposer($value); - break; - case 31: - $this->setEncoder($value); - break; - case 32: - $this->setChecksum($value); - break; - case 33: - $this->setLyrics($value); - break; - case 34: - $this->setOrchestra($value); - break; - case 35: - $this->setConductor($value); - break; - case 36: - $this->setLyricist($value); - break; - case 37: - $this->setOriginalLyricist($value); - break; - case 38: - $this->setRadioStationName($value); - break; - case 39: - $this->setInfoUrl($value); - break; - case 40: - $this->setArtistUrl($value); - break; - case 41: - $this->setAudioSourceUrl($value); - break; - case 42: - $this->setRadioStationUrl($value); - break; - case 43: - $this->setBuyThisUrl($value); - break; - case 44: - $this->setIsrcNumber($value); - break; - case 45: - $this->setCatalogNumber($value); - break; - case 46: - $this->setOriginalArtist($value); - break; - case 47: - $this->setCopyright($value); - break; - case 48: - $this->setReportDatetime($value); - break; - case 49: - $this->setReportLocation($value); - break; - case 50: - $this->setReportOrganization($value); - break; - case 51: - $this->setSubject($value); - break; - case 52: - $this->setContributor($value); - break; - case 53: - $this->setLanguage($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcFilesPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setGunid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setMime($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setFtype($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setfilepath($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setState($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCurrentlyaccessing($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setEditedby($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setMtime($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setMd5($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setTrackTitle($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setArtistName($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setBitRate($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setSampleRate($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setFormat($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setDbLength($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setAlbumTitle($arr[$keys[17]]); - if (array_key_exists($keys[18], $arr)) $this->setGenre($arr[$keys[18]]); - if (array_key_exists($keys[19], $arr)) $this->setComments($arr[$keys[19]]); - if (array_key_exists($keys[20], $arr)) $this->setYear($arr[$keys[20]]); - if (array_key_exists($keys[21], $arr)) $this->setTrackNumber($arr[$keys[21]]); - if (array_key_exists($keys[22], $arr)) $this->setChannels($arr[$keys[22]]); - if (array_key_exists($keys[23], $arr)) $this->setUrl($arr[$keys[23]]); - if (array_key_exists($keys[24], $arr)) $this->setBpm($arr[$keys[24]]); - if (array_key_exists($keys[25], $arr)) $this->setRating($arr[$keys[25]]); - if (array_key_exists($keys[26], $arr)) $this->setEncodedBy($arr[$keys[26]]); - if (array_key_exists($keys[27], $arr)) $this->setDiscNumber($arr[$keys[27]]); - if (array_key_exists($keys[28], $arr)) $this->setMood($arr[$keys[28]]); - if (array_key_exists($keys[29], $arr)) $this->setLabel($arr[$keys[29]]); - if (array_key_exists($keys[30], $arr)) $this->setComposer($arr[$keys[30]]); - if (array_key_exists($keys[31], $arr)) $this->setEncoder($arr[$keys[31]]); - if (array_key_exists($keys[32], $arr)) $this->setChecksum($arr[$keys[32]]); - if (array_key_exists($keys[33], $arr)) $this->setLyrics($arr[$keys[33]]); - if (array_key_exists($keys[34], $arr)) $this->setOrchestra($arr[$keys[34]]); - if (array_key_exists($keys[35], $arr)) $this->setConductor($arr[$keys[35]]); - if (array_key_exists($keys[36], $arr)) $this->setLyricist($arr[$keys[36]]); - if (array_key_exists($keys[37], $arr)) $this->setOriginalLyricist($arr[$keys[37]]); - if (array_key_exists($keys[38], $arr)) $this->setRadioStationName($arr[$keys[38]]); - if (array_key_exists($keys[39], $arr)) $this->setInfoUrl($arr[$keys[39]]); - if (array_key_exists($keys[40], $arr)) $this->setArtistUrl($arr[$keys[40]]); - if (array_key_exists($keys[41], $arr)) $this->setAudioSourceUrl($arr[$keys[41]]); - if (array_key_exists($keys[42], $arr)) $this->setRadioStationUrl($arr[$keys[42]]); - if (array_key_exists($keys[43], $arr)) $this->setBuyThisUrl($arr[$keys[43]]); - if (array_key_exists($keys[44], $arr)) $this->setIsrcNumber($arr[$keys[44]]); - if (array_key_exists($keys[45], $arr)) $this->setCatalogNumber($arr[$keys[45]]); - if (array_key_exists($keys[46], $arr)) $this->setOriginalArtist($arr[$keys[46]]); - if (array_key_exists($keys[47], $arr)) $this->setCopyright($arr[$keys[47]]); - if (array_key_exists($keys[48], $arr)) $this->setReportDatetime($arr[$keys[48]]); - if (array_key_exists($keys[49], $arr)) $this->setReportLocation($arr[$keys[49]]); - if (array_key_exists($keys[50], $arr)) $this->setReportOrganization($arr[$keys[50]]); - if (array_key_exists($keys[51], $arr)) $this->setSubject($arr[$keys[51]]); - if (array_key_exists($keys[52], $arr)) $this->setContributor($arr[$keys[52]]); - if (array_key_exists($keys[53], $arr)) $this->setLanguage($arr[$keys[53]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcFilesPeer::ID)) $criteria->add(CcFilesPeer::ID, $this->id); - if ($this->isColumnModified(CcFilesPeer::GUNID)) $criteria->add(CcFilesPeer::GUNID, $this->gunid); - if ($this->isColumnModified(CcFilesPeer::NAME)) $criteria->add(CcFilesPeer::NAME, $this->name); - if ($this->isColumnModified(CcFilesPeer::MIME)) $criteria->add(CcFilesPeer::MIME, $this->mime); - if ($this->isColumnModified(CcFilesPeer::FTYPE)) $criteria->add(CcFilesPeer::FTYPE, $this->ftype); - if ($this->isColumnModified(CcFilesPeer::FILEPATH)) $criteria->add(CcFilesPeer::FILEPATH, $this->filepath); - if ($this->isColumnModified(CcFilesPeer::STATE)) $criteria->add(CcFilesPeer::STATE, $this->state); - if ($this->isColumnModified(CcFilesPeer::CURRENTLYACCESSING)) $criteria->add(CcFilesPeer::CURRENTLYACCESSING, $this->currentlyaccessing); - if ($this->isColumnModified(CcFilesPeer::EDITEDBY)) $criteria->add(CcFilesPeer::EDITEDBY, $this->editedby); - if ($this->isColumnModified(CcFilesPeer::MTIME)) $criteria->add(CcFilesPeer::MTIME, $this->mtime); - if ($this->isColumnModified(CcFilesPeer::MD5)) $criteria->add(CcFilesPeer::MD5, $this->md5); - if ($this->isColumnModified(CcFilesPeer::TRACK_TITLE)) $criteria->add(CcFilesPeer::TRACK_TITLE, $this->track_title); - if ($this->isColumnModified(CcFilesPeer::ARTIST_NAME)) $criteria->add(CcFilesPeer::ARTIST_NAME, $this->artist_name); - if ($this->isColumnModified(CcFilesPeer::BIT_RATE)) $criteria->add(CcFilesPeer::BIT_RATE, $this->bit_rate); - if ($this->isColumnModified(CcFilesPeer::SAMPLE_RATE)) $criteria->add(CcFilesPeer::SAMPLE_RATE, $this->sample_rate); - if ($this->isColumnModified(CcFilesPeer::FORMAT)) $criteria->add(CcFilesPeer::FORMAT, $this->format); - if ($this->isColumnModified(CcFilesPeer::LENGTH)) $criteria->add(CcFilesPeer::LENGTH, $this->length); - if ($this->isColumnModified(CcFilesPeer::ALBUM_TITLE)) $criteria->add(CcFilesPeer::ALBUM_TITLE, $this->album_title); - if ($this->isColumnModified(CcFilesPeer::GENRE)) $criteria->add(CcFilesPeer::GENRE, $this->genre); - if ($this->isColumnModified(CcFilesPeer::COMMENTS)) $criteria->add(CcFilesPeer::COMMENTS, $this->comments); - if ($this->isColumnModified(CcFilesPeer::YEAR)) $criteria->add(CcFilesPeer::YEAR, $this->year); - if ($this->isColumnModified(CcFilesPeer::TRACK_NUMBER)) $criteria->add(CcFilesPeer::TRACK_NUMBER, $this->track_number); - if ($this->isColumnModified(CcFilesPeer::CHANNELS)) $criteria->add(CcFilesPeer::CHANNELS, $this->channels); - if ($this->isColumnModified(CcFilesPeer::URL)) $criteria->add(CcFilesPeer::URL, $this->url); - if ($this->isColumnModified(CcFilesPeer::BPM)) $criteria->add(CcFilesPeer::BPM, $this->bpm); - if ($this->isColumnModified(CcFilesPeer::RATING)) $criteria->add(CcFilesPeer::RATING, $this->rating); - if ($this->isColumnModified(CcFilesPeer::ENCODED_BY)) $criteria->add(CcFilesPeer::ENCODED_BY, $this->encoded_by); - if ($this->isColumnModified(CcFilesPeer::DISC_NUMBER)) $criteria->add(CcFilesPeer::DISC_NUMBER, $this->disc_number); - if ($this->isColumnModified(CcFilesPeer::MOOD)) $criteria->add(CcFilesPeer::MOOD, $this->mood); - if ($this->isColumnModified(CcFilesPeer::LABEL)) $criteria->add(CcFilesPeer::LABEL, $this->label); - if ($this->isColumnModified(CcFilesPeer::COMPOSER)) $criteria->add(CcFilesPeer::COMPOSER, $this->composer); - if ($this->isColumnModified(CcFilesPeer::ENCODER)) $criteria->add(CcFilesPeer::ENCODER, $this->encoder); - if ($this->isColumnModified(CcFilesPeer::CHECKSUM)) $criteria->add(CcFilesPeer::CHECKSUM, $this->checksum); - if ($this->isColumnModified(CcFilesPeer::LYRICS)) $criteria->add(CcFilesPeer::LYRICS, $this->lyrics); - if ($this->isColumnModified(CcFilesPeer::ORCHESTRA)) $criteria->add(CcFilesPeer::ORCHESTRA, $this->orchestra); - if ($this->isColumnModified(CcFilesPeer::CONDUCTOR)) $criteria->add(CcFilesPeer::CONDUCTOR, $this->conductor); - if ($this->isColumnModified(CcFilesPeer::LYRICIST)) $criteria->add(CcFilesPeer::LYRICIST, $this->lyricist); - if ($this->isColumnModified(CcFilesPeer::ORIGINAL_LYRICIST)) $criteria->add(CcFilesPeer::ORIGINAL_LYRICIST, $this->original_lyricist); - if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_NAME)) $criteria->add(CcFilesPeer::RADIO_STATION_NAME, $this->radio_station_name); - if ($this->isColumnModified(CcFilesPeer::INFO_URL)) $criteria->add(CcFilesPeer::INFO_URL, $this->info_url); - if ($this->isColumnModified(CcFilesPeer::ARTIST_URL)) $criteria->add(CcFilesPeer::ARTIST_URL, $this->artist_url); - if ($this->isColumnModified(CcFilesPeer::AUDIO_SOURCE_URL)) $criteria->add(CcFilesPeer::AUDIO_SOURCE_URL, $this->audio_source_url); - if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_URL)) $criteria->add(CcFilesPeer::RADIO_STATION_URL, $this->radio_station_url); - if ($this->isColumnModified(CcFilesPeer::BUY_THIS_URL)) $criteria->add(CcFilesPeer::BUY_THIS_URL, $this->buy_this_url); - if ($this->isColumnModified(CcFilesPeer::ISRC_NUMBER)) $criteria->add(CcFilesPeer::ISRC_NUMBER, $this->isrc_number); - if ($this->isColumnModified(CcFilesPeer::CATALOG_NUMBER)) $criteria->add(CcFilesPeer::CATALOG_NUMBER, $this->catalog_number); - if ($this->isColumnModified(CcFilesPeer::ORIGINAL_ARTIST)) $criteria->add(CcFilesPeer::ORIGINAL_ARTIST, $this->original_artist); - if ($this->isColumnModified(CcFilesPeer::COPYRIGHT)) $criteria->add(CcFilesPeer::COPYRIGHT, $this->copyright); - if ($this->isColumnModified(CcFilesPeer::REPORT_DATETIME)) $criteria->add(CcFilesPeer::REPORT_DATETIME, $this->report_datetime); - if ($this->isColumnModified(CcFilesPeer::REPORT_LOCATION)) $criteria->add(CcFilesPeer::REPORT_LOCATION, $this->report_location); - if ($this->isColumnModified(CcFilesPeer::REPORT_ORGANIZATION)) $criteria->add(CcFilesPeer::REPORT_ORGANIZATION, $this->report_organization); - if ($this->isColumnModified(CcFilesPeer::SUBJECT)) $criteria->add(CcFilesPeer::SUBJECT, $this->subject); - if ($this->isColumnModified(CcFilesPeer::CONTRIBUTOR)) $criteria->add(CcFilesPeer::CONTRIBUTOR, $this->contributor); - if ($this->isColumnModified(CcFilesPeer::LANGUAGE)) $criteria->add(CcFilesPeer::LANGUAGE, $this->language); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); - $criteria->add(CcFilesPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getDbId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setDbId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getDbId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcFiles (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setGunid($this->gunid); - $copyObj->setName($this->name); - $copyObj->setMime($this->mime); - $copyObj->setFtype($this->ftype); - $copyObj->setfilepath($this->filepath); - $copyObj->setState($this->state); - $copyObj->setCurrentlyaccessing($this->currentlyaccessing); - $copyObj->setEditedby($this->editedby); - $copyObj->setMtime($this->mtime); - $copyObj->setMd5($this->md5); - $copyObj->setTrackTitle($this->track_title); - $copyObj->setArtistName($this->artist_name); - $copyObj->setBitRate($this->bit_rate); - $copyObj->setSampleRate($this->sample_rate); - $copyObj->setFormat($this->format); - $copyObj->setDbLength($this->length); - $copyObj->setAlbumTitle($this->album_title); - $copyObj->setGenre($this->genre); - $copyObj->setComments($this->comments); - $copyObj->setYear($this->year); - $copyObj->setTrackNumber($this->track_number); - $copyObj->setChannels($this->channels); - $copyObj->setUrl($this->url); - $copyObj->setBpm($this->bpm); - $copyObj->setRating($this->rating); - $copyObj->setEncodedBy($this->encoded_by); - $copyObj->setDiscNumber($this->disc_number); - $copyObj->setMood($this->mood); - $copyObj->setLabel($this->label); - $copyObj->setComposer($this->composer); - $copyObj->setEncoder($this->encoder); - $copyObj->setChecksum($this->checksum); - $copyObj->setLyrics($this->lyrics); - $copyObj->setOrchestra($this->orchestra); - $copyObj->setConductor($this->conductor); - $copyObj->setLyricist($this->lyricist); - $copyObj->setOriginalLyricist($this->original_lyricist); - $copyObj->setRadioStationName($this->radio_station_name); - $copyObj->setInfoUrl($this->info_url); - $copyObj->setArtistUrl($this->artist_url); - $copyObj->setAudioSourceUrl($this->audio_source_url); - $copyObj->setRadioStationUrl($this->radio_station_url); - $copyObj->setBuyThisUrl($this->buy_this_url); - $copyObj->setIsrcNumber($this->isrc_number); - $copyObj->setCatalogNumber($this->catalog_number); - $copyObj->setOriginalArtist($this->original_artist); - $copyObj->setCopyright($this->copyright); - $copyObj->setReportDatetime($this->report_datetime); - $copyObj->setReportLocation($this->report_location); - $copyObj->setReportOrganization($this->report_organization); - $copyObj->setSubject($this->subject); - $copyObj->setContributor($this->contributor); - $copyObj->setLanguage($this->language); - - if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - - foreach ($this->getCcPlaylistcontentss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy)); - } - } - - } // if ($deepCopy) - - - $copyObj->setNew(true); - $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcFiles Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcFilesPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcFilesPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcFiles The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setEditedby(NULL); - } else { - $this->setEditedby($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcFiles($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->editedby !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcFiless($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears out the collCcPlaylistcontentss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcPlaylistcontentss() - */ - public function clearCcPlaylistcontentss() - { - $this->collCcPlaylistcontentss = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcPlaylistcontentss collection. - * - * By default this just sets the collCcPlaylistcontentss collection to an empty array (like clearcollCcPlaylistcontentss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcPlaylistcontentss() - { - $this->collCcPlaylistcontentss = new PropelObjectCollection(); - $this->collCcPlaylistcontentss->setModel('CcPlaylistcontents'); - } - - /** - * Gets an array of CcPlaylistcontents objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcFiles is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects - * @throws PropelException - */ - public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcPlaylistcontentss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylistcontentss) { - // return empty collection - $this->initCcPlaylistcontentss(); - } else { - $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria) - ->filterByCcFiles($this) - ->find($con); - if (null !== $criteria) { - return $collCcPlaylistcontentss; - } - $this->collCcPlaylistcontentss = $collCcPlaylistcontentss; - } - } - return $this->collCcPlaylistcontentss; - } - - /** - * Returns the number of related CcPlaylistcontents objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcPlaylistcontents objects. - * @throws PropelException - */ - public function countCcPlaylistcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcPlaylistcontentss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylistcontentss) { - return 0; - } else { - $query = CcPlaylistcontentsQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcFiles($this) - ->count($con); - } - } else { - return count($this->collCcPlaylistcontentss); - } - } - - /** - * Method called to associate a CcPlaylistcontents object to this object - * through the CcPlaylistcontents foreign key attribute. - * - * @param CcPlaylistcontents $l CcPlaylistcontents - * @return void - * @throws PropelException - */ - public function addCcPlaylistcontents(CcPlaylistcontents $l) - { - if ($this->collCcPlaylistcontentss === null) { - $this->initCcPlaylistcontentss(); - } - if (!$this->collCcPlaylistcontentss->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcPlaylistcontentss[]= $l; - $l->setCcFiles($this); - } - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcFiles is new, it will return - * an empty collection; or if this CcFiles has previously - * been saved, it will retrieve related CcPlaylistcontentss from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in CcFiles. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects - */ - public function getCcPlaylistcontentssJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = CcPlaylistcontentsQuery::create(null, $criteria); - $query->joinWith('CcPlaylist', $join_behavior); - - return $this->getCcPlaylistcontentss($query, $con); - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->gunid = null; - $this->name = null; - $this->mime = null; - $this->ftype = null; - $this->filepath = null; - $this->state = null; - $this->currentlyaccessing = null; - $this->editedby = null; - $this->mtime = null; - $this->md5 = null; - $this->track_title = null; - $this->artist_name = null; - $this->bit_rate = null; - $this->sample_rate = null; - $this->format = null; - $this->length = null; - $this->album_title = null; - $this->genre = null; - $this->comments = null; - $this->year = null; - $this->track_number = null; - $this->channels = null; - $this->url = null; - $this->bpm = null; - $this->rating = null; - $this->encoded_by = null; - $this->disc_number = null; - $this->mood = null; - $this->label = null; - $this->composer = null; - $this->encoder = null; - $this->checksum = null; - $this->lyrics = null; - $this->orchestra = null; - $this->conductor = null; - $this->lyricist = null; - $this->original_lyricist = null; - $this->radio_station_name = null; - $this->info_url = null; - $this->artist_url = null; - $this->audio_source_url = null; - $this->radio_station_url = null; - $this->buy_this_url = null; - $this->isrc_number = null; - $this->catalog_number = null; - $this->original_artist = null; - $this->copyright = null; - $this->report_datetime = null; - $this->report_location = null; - $this->report_organization = null; - $this->subject = null; - $this->contributor = null; - $this->language = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - if ($this->collCcPlaylistcontentss) { - foreach ((array) $this->collCcPlaylistcontentss as $o) { - $o->clearAllReferences($deep); - } - } - } // if ($deep) - - $this->collCcPlaylistcontentss = null; - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcFiles diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcFilesPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcFilesPeer.php deleted file mode 100644 index 8f48b5fc9..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcFilesPeer.php +++ /dev/null @@ -1,1236 +0,0 @@ - array ('DbId', 'Gunid', 'Name', 'Mime', 'Ftype', 'filepath', 'State', 'Currentlyaccessing', 'Editedby', 'Mtime', 'Md5', 'TrackTitle', 'ArtistName', 'BitRate', 'SampleRate', 'Format', 'DbLength', 'AlbumTitle', 'Genre', 'Comments', 'Year', 'TrackNumber', 'Channels', 'Url', 'Bpm', 'Rating', 'EncodedBy', 'DiscNumber', 'Mood', 'Label', 'Composer', 'Encoder', 'Checksum', 'Lyrics', 'Orchestra', 'Conductor', 'Lyricist', 'OriginalLyricist', 'RadioStationName', 'InfoUrl', 'ArtistUrl', 'AudioSourceUrl', 'RadioStationUrl', 'BuyThisUrl', 'IsrcNumber', 'CatalogNumber', 'OriginalArtist', 'Copyright', 'ReportDatetime', 'ReportLocation', 'ReportOrganization', 'Subject', 'Contributor', 'Language', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'gunid', 'name', 'mime', 'ftype', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'trackTitle', 'artistName', 'bitRate', 'sampleRate', 'format', 'dbLength', 'albumTitle', 'genre', 'comments', 'year', 'trackNumber', 'channels', 'url', 'bpm', 'rating', 'encodedBy', 'discNumber', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'originalLyricist', 'radioStationName', 'infoUrl', 'artistUrl', 'audioSourceUrl', 'radioStationUrl', 'buyThisUrl', 'isrcNumber', 'catalogNumber', 'originalArtist', 'copyright', 'reportDatetime', 'reportLocation', 'reportOrganization', 'subject', 'contributor', 'language', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'Gunid' => 1, 'Name' => 2, 'Mime' => 3, 'Ftype' => 4, 'filepath' => 5, 'State' => 6, 'Currentlyaccessing' => 7, 'Editedby' => 8, 'Mtime' => 9, 'Md5' => 10, 'TrackTitle' => 11, 'ArtistName' => 12, 'BitRate' => 13, 'SampleRate' => 14, 'Format' => 15, 'DbLength' => 16, 'AlbumTitle' => 17, 'Genre' => 18, 'Comments' => 19, 'Year' => 20, 'TrackNumber' => 21, 'Channels' => 22, 'Url' => 23, 'Bpm' => 24, 'Rating' => 25, 'EncodedBy' => 26, 'DiscNumber' => 27, 'Mood' => 28, 'Label' => 29, 'Composer' => 30, 'Encoder' => 31, 'Checksum' => 32, 'Lyrics' => 33, 'Orchestra' => 34, 'Conductor' => 35, 'Lyricist' => 36, 'OriginalLyricist' => 37, 'RadioStationName' => 38, 'InfoUrl' => 39, 'ArtistUrl' => 40, 'AudioSourceUrl' => 41, 'RadioStationUrl' => 42, 'BuyThisUrl' => 43, 'IsrcNumber' => 44, 'CatalogNumber' => 45, 'OriginalArtist' => 46, 'Copyright' => 47, 'ReportDatetime' => 48, 'ReportLocation' => 49, 'ReportOrganization' => 50, 'Subject' => 51, 'Contributor' => 52, 'Language' => 53, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'md5' => 10, 'trackTitle' => 11, 'artistName' => 12, 'bitRate' => 13, 'sampleRate' => 14, 'format' => 15, 'dbLength' => 16, 'albumTitle' => 17, 'genre' => 18, 'comments' => 19, 'year' => 20, 'trackNumber' => 21, 'channels' => 22, 'url' => 23, 'bpm' => 24, 'rating' => 25, 'encodedBy' => 26, 'discNumber' => 27, 'mood' => 28, 'label' => 29, 'composer' => 30, 'encoder' => 31, 'checksum' => 32, 'lyrics' => 33, 'orchestra' => 34, 'conductor' => 35, 'lyricist' => 36, 'originalLyricist' => 37, 'radioStationName' => 38, 'infoUrl' => 39, 'artistUrl' => 40, 'audioSourceUrl' => 41, 'radioStationUrl' => 42, 'buyThisUrl' => 43, 'isrcNumber' => 44, 'catalogNumber' => 45, 'originalArtist' => 46, 'copyright' => 47, 'reportDatetime' => 48, 'reportLocation' => 49, 'reportOrganization' => 50, 'subject' => 51, 'contributor' => 52, 'language' => 53, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::MD5 => 10, self::TRACK_TITLE => 11, self::ARTIST_NAME => 12, self::BIT_RATE => 13, self::SAMPLE_RATE => 14, self::FORMAT => 15, self::LENGTH => 16, self::ALBUM_TITLE => 17, self::GENRE => 18, self::COMMENTS => 19, self::YEAR => 20, self::TRACK_NUMBER => 21, self::CHANNELS => 22, self::URL => 23, self::BPM => 24, self::RATING => 25, self::ENCODED_BY => 26, self::DISC_NUMBER => 27, self::MOOD => 28, self::LABEL => 29, self::COMPOSER => 30, self::ENCODER => 31, self::CHECKSUM => 32, self::LYRICS => 33, self::ORCHESTRA => 34, self::CONDUCTOR => 35, self::LYRICIST => 36, self::ORIGINAL_LYRICIST => 37, self::RADIO_STATION_NAME => 38, self::INFO_URL => 39, self::ARTIST_URL => 40, self::AUDIO_SOURCE_URL => 41, self::RADIO_STATION_URL => 42, self::BUY_THIS_URL => 43, self::ISRC_NUMBER => 44, self::CATALOG_NUMBER => 45, self::ORIGINAL_ARTIST => 46, self::COPYRIGHT => 47, self::REPORT_DATETIME => 48, self::REPORT_LOCATION => 49, self::REPORT_ORGANIZATION => 50, self::SUBJECT => 51, self::CONTRIBUTOR => 52, self::LANGUAGE => 53, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'MD5' => 10, 'TRACK_TITLE' => 11, 'ARTIST_NAME' => 12, 'BIT_RATE' => 13, 'SAMPLE_RATE' => 14, 'FORMAT' => 15, 'LENGTH' => 16, 'ALBUM_TITLE' => 17, 'GENRE' => 18, 'COMMENTS' => 19, 'YEAR' => 20, 'TRACK_NUMBER' => 21, 'CHANNELS' => 22, 'URL' => 23, 'BPM' => 24, 'RATING' => 25, 'ENCODED_BY' => 26, 'DISC_NUMBER' => 27, 'MOOD' => 28, 'LABEL' => 29, 'COMPOSER' => 30, 'ENCODER' => 31, 'CHECKSUM' => 32, 'LYRICS' => 33, 'ORCHESTRA' => 34, 'CONDUCTOR' => 35, 'LYRICIST' => 36, 'ORIGINAL_LYRICIST' => 37, 'RADIO_STATION_NAME' => 38, 'INFO_URL' => 39, 'ARTIST_URL' => 40, 'AUDIO_SOURCE_URL' => 41, 'RADIO_STATION_URL' => 42, 'BUY_THIS_URL' => 43, 'ISRC_NUMBER' => 44, 'CATALOG_NUMBER' => 45, 'ORIGINAL_ARTIST' => 46, 'COPYRIGHT' => 47, 'REPORT_DATETIME' => 48, 'REPORT_LOCATION' => 49, 'REPORT_ORGANIZATION' => 50, 'SUBJECT' => 51, 'CONTRIBUTOR' => 52, 'LANGUAGE' => 53, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'md5' => 10, 'track_title' => 11, 'artist_name' => 12, 'bit_rate' => 13, 'sample_rate' => 14, 'format' => 15, 'length' => 16, 'album_title' => 17, 'genre' => 18, 'comments' => 19, 'year' => 20, 'track_number' => 21, 'channels' => 22, 'url' => 23, 'bpm' => 24, 'rating' => 25, 'encoded_by' => 26, 'disc_number' => 27, 'mood' => 28, 'label' => 29, 'composer' => 30, 'encoder' => 31, 'checksum' => 32, 'lyrics' => 33, 'orchestra' => 34, 'conductor' => 35, 'lyricist' => 36, 'original_lyricist' => 37, 'radio_station_name' => 38, 'info_url' => 39, 'artist_url' => 40, 'audio_source_url' => 41, 'radio_station_url' => 42, 'buy_this_url' => 43, 'isrc_number' => 44, 'catalog_number' => 45, 'original_artist' => 46, 'copyright' => 47, 'report_datetime' => 48, 'report_location' => 49, 'report_organization' => 50, 'subject' => 51, 'contributor' => 52, 'language' => 53, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcFilesPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcFilesPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcFilesPeer::ID); - $criteria->addSelectColumn(CcFilesPeer::GUNID); - $criteria->addSelectColumn(CcFilesPeer::NAME); - $criteria->addSelectColumn(CcFilesPeer::MIME); - $criteria->addSelectColumn(CcFilesPeer::FTYPE); - $criteria->addSelectColumn(CcFilesPeer::FILEPATH); - $criteria->addSelectColumn(CcFilesPeer::STATE); - $criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING); - $criteria->addSelectColumn(CcFilesPeer::EDITEDBY); - $criteria->addSelectColumn(CcFilesPeer::MTIME); - $criteria->addSelectColumn(CcFilesPeer::MD5); - $criteria->addSelectColumn(CcFilesPeer::TRACK_TITLE); - $criteria->addSelectColumn(CcFilesPeer::ARTIST_NAME); - $criteria->addSelectColumn(CcFilesPeer::BIT_RATE); - $criteria->addSelectColumn(CcFilesPeer::SAMPLE_RATE); - $criteria->addSelectColumn(CcFilesPeer::FORMAT); - $criteria->addSelectColumn(CcFilesPeer::LENGTH); - $criteria->addSelectColumn(CcFilesPeer::ALBUM_TITLE); - $criteria->addSelectColumn(CcFilesPeer::GENRE); - $criteria->addSelectColumn(CcFilesPeer::COMMENTS); - $criteria->addSelectColumn(CcFilesPeer::YEAR); - $criteria->addSelectColumn(CcFilesPeer::TRACK_NUMBER); - $criteria->addSelectColumn(CcFilesPeer::CHANNELS); - $criteria->addSelectColumn(CcFilesPeer::URL); - $criteria->addSelectColumn(CcFilesPeer::BPM); - $criteria->addSelectColumn(CcFilesPeer::RATING); - $criteria->addSelectColumn(CcFilesPeer::ENCODED_BY); - $criteria->addSelectColumn(CcFilesPeer::DISC_NUMBER); - $criteria->addSelectColumn(CcFilesPeer::MOOD); - $criteria->addSelectColumn(CcFilesPeer::LABEL); - $criteria->addSelectColumn(CcFilesPeer::COMPOSER); - $criteria->addSelectColumn(CcFilesPeer::ENCODER); - $criteria->addSelectColumn(CcFilesPeer::CHECKSUM); - $criteria->addSelectColumn(CcFilesPeer::LYRICS); - $criteria->addSelectColumn(CcFilesPeer::ORCHESTRA); - $criteria->addSelectColumn(CcFilesPeer::CONDUCTOR); - $criteria->addSelectColumn(CcFilesPeer::LYRICIST); - $criteria->addSelectColumn(CcFilesPeer::ORIGINAL_LYRICIST); - $criteria->addSelectColumn(CcFilesPeer::RADIO_STATION_NAME); - $criteria->addSelectColumn(CcFilesPeer::INFO_URL); - $criteria->addSelectColumn(CcFilesPeer::ARTIST_URL); - $criteria->addSelectColumn(CcFilesPeer::AUDIO_SOURCE_URL); - $criteria->addSelectColumn(CcFilesPeer::RADIO_STATION_URL); - $criteria->addSelectColumn(CcFilesPeer::BUY_THIS_URL); - $criteria->addSelectColumn(CcFilesPeer::ISRC_NUMBER); - $criteria->addSelectColumn(CcFilesPeer::CATALOG_NUMBER); - $criteria->addSelectColumn(CcFilesPeer::ORIGINAL_ARTIST); - $criteria->addSelectColumn(CcFilesPeer::COPYRIGHT); - $criteria->addSelectColumn(CcFilesPeer::REPORT_DATETIME); - $criteria->addSelectColumn(CcFilesPeer::REPORT_LOCATION); - $criteria->addSelectColumn(CcFilesPeer::REPORT_ORGANIZATION); - $criteria->addSelectColumn(CcFilesPeer::SUBJECT); - $criteria->addSelectColumn(CcFilesPeer::CONTRIBUTOR); - $criteria->addSelectColumn(CcFilesPeer::LANGUAGE); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.GUNID'); - $criteria->addSelectColumn($alias . '.NAME'); - $criteria->addSelectColumn($alias . '.MIME'); - $criteria->addSelectColumn($alias . '.FTYPE'); - $criteria->addSelectColumn($alias . '.FILEPATH'); - $criteria->addSelectColumn($alias . '.STATE'); - $criteria->addSelectColumn($alias . '.CURRENTLYACCESSING'); - $criteria->addSelectColumn($alias . '.EDITEDBY'); - $criteria->addSelectColumn($alias . '.MTIME'); - $criteria->addSelectColumn($alias . '.MD5'); - $criteria->addSelectColumn($alias . '.TRACK_TITLE'); - $criteria->addSelectColumn($alias . '.ARTIST_NAME'); - $criteria->addSelectColumn($alias . '.BIT_RATE'); - $criteria->addSelectColumn($alias . '.SAMPLE_RATE'); - $criteria->addSelectColumn($alias . '.FORMAT'); - $criteria->addSelectColumn($alias . '.LENGTH'); - $criteria->addSelectColumn($alias . '.ALBUM_TITLE'); - $criteria->addSelectColumn($alias . '.GENRE'); - $criteria->addSelectColumn($alias . '.COMMENTS'); - $criteria->addSelectColumn($alias . '.YEAR'); - $criteria->addSelectColumn($alias . '.TRACK_NUMBER'); - $criteria->addSelectColumn($alias . '.CHANNELS'); - $criteria->addSelectColumn($alias . '.URL'); - $criteria->addSelectColumn($alias . '.BPM'); - $criteria->addSelectColumn($alias . '.RATING'); - $criteria->addSelectColumn($alias . '.ENCODED_BY'); - $criteria->addSelectColumn($alias . '.DISC_NUMBER'); - $criteria->addSelectColumn($alias . '.MOOD'); - $criteria->addSelectColumn($alias . '.LABEL'); - $criteria->addSelectColumn($alias . '.COMPOSER'); - $criteria->addSelectColumn($alias . '.ENCODER'); - $criteria->addSelectColumn($alias . '.CHECKSUM'); - $criteria->addSelectColumn($alias . '.LYRICS'); - $criteria->addSelectColumn($alias . '.ORCHESTRA'); - $criteria->addSelectColumn($alias . '.CONDUCTOR'); - $criteria->addSelectColumn($alias . '.LYRICIST'); - $criteria->addSelectColumn($alias . '.ORIGINAL_LYRICIST'); - $criteria->addSelectColumn($alias . '.RADIO_STATION_NAME'); - $criteria->addSelectColumn($alias . '.INFO_URL'); - $criteria->addSelectColumn($alias . '.ARTIST_URL'); - $criteria->addSelectColumn($alias . '.AUDIO_SOURCE_URL'); - $criteria->addSelectColumn($alias . '.RADIO_STATION_URL'); - $criteria->addSelectColumn($alias . '.BUY_THIS_URL'); - $criteria->addSelectColumn($alias . '.ISRC_NUMBER'); - $criteria->addSelectColumn($alias . '.CATALOG_NUMBER'); - $criteria->addSelectColumn($alias . '.ORIGINAL_ARTIST'); - $criteria->addSelectColumn($alias . '.COPYRIGHT'); - $criteria->addSelectColumn($alias . '.REPORT_DATETIME'); - $criteria->addSelectColumn($alias . '.REPORT_LOCATION'); - $criteria->addSelectColumn($alias . '.REPORT_ORGANIZATION'); - $criteria->addSelectColumn($alias . '.SUBJECT'); - $criteria->addSelectColumn($alias . '.CONTRIBUTOR'); - $criteria->addSelectColumn($alias . '.LANGUAGE'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcFilesPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcFiles - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcFilesPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcFilesPeer::populateObjects(CcFilesPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcFilesPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcFiles $value A CcFiles object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcFiles $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getDbId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcFiles object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcFiles) { - $key = (string) $value->getDbId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcFiles object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcFiles Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_files - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in CcPlaylistcontentsPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcPlaylistcontentsPeer::clearInstancePool(); - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcFilesPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcFilesPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcFilesPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcFiles object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcFilesPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcFilesPeer::NUM_COLUMNS; - } else { - $cls = CcFilesPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcFilesPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcFilesPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcFiles objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcFiles objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcFilesPeer::addSelectColumns($criteria); - $startcol = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcFilesPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcFilesPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcFiles) to $obj2 (CcSubjs) - $obj2->addCcFiles($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcFilesPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcFiles objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcFiles objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcFilesPeer::addSelectColumns($criteria); - $startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcFilesPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcFilesPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) - $obj2->addCcFiles($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcFilesPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcFilesPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcFilesTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcFilesPeer::CLASS_DEFAULT : CcFilesPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcFiles or Criteria object. - * - * @param mixed $values Criteria or CcFiles object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcFiles object - } - - if ($criteria->containsKey(CcFilesPeer::ID) && $criteria->keyContainsValue(CcFilesPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFilesPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcFiles or Criteria object. - * - * @param mixed $values Criteria or CcFiles object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcFilesPeer::ID); - $value = $criteria->remove(CcFilesPeer::ID); - if ($value) { - $selectCriteria->add(CcFilesPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); - } - - } else { // $values is CcFiles object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_files table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcFilesPeer::TABLE_NAME, $con, CcFilesPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcFilesPeer::clearInstancePool(); - CcFilesPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcFiles or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcFiles object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcFilesPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcFiles) { // it's a model object - // invalidate the cache for this single object - CcFilesPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcFilesPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcFilesPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcFilesPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcFiles object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcFiles $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcFiles $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcFilesPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcFilesPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcFilesPeer::DATABASE_NAME, CcFilesPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcFiles - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcFilesPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); - $criteria->add(CcFilesPeer::ID, $pk); - - $v = CcFilesPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); - $criteria->add(CcFilesPeer::ID, $pks, Criteria::IN); - $objs = CcFilesPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcFilesPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcFilesPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcFilesQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcFilesQuery.php deleted file mode 100644 index 03136febe..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcFilesQuery.php +++ /dev/null @@ -1,1733 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcFiles|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcFilesPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcFilesPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcFilesPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $dbId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByDbId($dbId = null, $comparison = null) - { - if (is_array($dbId) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcFilesPeer::ID, $dbId, $comparison); - } - - /** - * Filter the query on the gunid column - * - * @param string $gunid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByGunid($gunid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($gunid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $gunid)) { - $gunid = str_replace('*', '%', $gunid); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::GUNID, $gunid, $comparison); - } - - /** - * Filter the query on the name column - * - * @param string $name The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByName($name = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($name)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::NAME, $name, $comparison); - } - - /** - * Filter the query on the mime column - * - * @param string $mime The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByMime($mime = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($mime)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $mime)) { - $mime = str_replace('*', '%', $mime); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::MIME, $mime, $comparison); - } - - /** - * Filter the query on the ftype column - * - * @param string $ftype The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByFtype($ftype = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ftype)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ftype)) { - $ftype = str_replace('*', '%', $ftype); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::FTYPE, $ftype, $comparison); - } - - /** - * Filter the query on the filepath column - * - * @param string $filepath The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByfilepath($filepath = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($filepath)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $filepath)) { - $filepath = str_replace('*', '%', $filepath); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::FILEPATH, $filepath, $comparison); - } - - /** - * Filter the query on the state column - * - * @param string $state The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByState($state = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($state)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $state)) { - $state = str_replace('*', '%', $state); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::STATE, $state, $comparison); - } - - /** - * Filter the query on the currentlyaccessing column - * - * @param int|array $currentlyaccessing The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByCurrentlyaccessing($currentlyaccessing = null, $comparison = null) - { - if (is_array($currentlyaccessing)) { - $useMinMax = false; - if (isset($currentlyaccessing['min'])) { - $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $currentlyaccessing['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($currentlyaccessing['max'])) { - $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $currentlyaccessing['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $currentlyaccessing, $comparison); - } - - /** - * Filter the query on the editedby column - * - * @param int|array $editedby The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByEditedby($editedby = null, $comparison = null) - { - if (is_array($editedby)) { - $useMinMax = false; - if (isset($editedby['min'])) { - $this->addUsingAlias(CcFilesPeer::EDITEDBY, $editedby['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($editedby['max'])) { - $this->addUsingAlias(CcFilesPeer::EDITEDBY, $editedby['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::EDITEDBY, $editedby, $comparison); - } - - /** - * Filter the query on the mtime column - * - * @param string|array $mtime The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByMtime($mtime = null, $comparison = null) - { - if (is_array($mtime)) { - $useMinMax = false; - if (isset($mtime['min'])) { - $this->addUsingAlias(CcFilesPeer::MTIME, $mtime['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($mtime['max'])) { - $this->addUsingAlias(CcFilesPeer::MTIME, $mtime['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::MTIME, $mtime, $comparison); - } - - /** - * Filter the query on the md5 column - * - * @param string $md5 The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByMd5($md5 = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($md5)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $md5)) { - $md5 = str_replace('*', '%', $md5); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::MD5, $md5, $comparison); - } - - /** - * Filter the query on the track_title column - * - * @param string $trackTitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByTrackTitle($trackTitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($trackTitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $trackTitle)) { - $trackTitle = str_replace('*', '%', $trackTitle); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::TRACK_TITLE, $trackTitle, $comparison); - } - - /** - * Filter the query on the artist_name column - * - * @param string $artistName The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByArtistName($artistName = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($artistName)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $artistName)) { - $artistName = str_replace('*', '%', $artistName); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ARTIST_NAME, $artistName, $comparison); - } - - /** - * Filter the query on the bit_rate column - * - * @param string $bitRate The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByBitRate($bitRate = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($bitRate)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $bitRate)) { - $bitRate = str_replace('*', '%', $bitRate); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $bitRate, $comparison); - } - - /** - * Filter the query on the sample_rate column - * - * @param string $sampleRate The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterBySampleRate($sampleRate = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($sampleRate)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $sampleRate)) { - $sampleRate = str_replace('*', '%', $sampleRate); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $sampleRate, $comparison); - } - - /** - * Filter the query on the format column - * - * @param string $format The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByFormat($format = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($format)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $format)) { - $format = str_replace('*', '%', $format); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::FORMAT, $format, $comparison); - } - - /** - * Filter the query on the length column - * - * @param string|array $dbLength The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByDbLength($dbLength = null, $comparison = null) - { - if (is_array($dbLength)) { - $useMinMax = false; - if (isset($dbLength['min'])) { - $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbLength['max'])) { - $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison); - } - - /** - * Filter the query on the album_title column - * - * @param string $albumTitle The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByAlbumTitle($albumTitle = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($albumTitle)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $albumTitle)) { - $albumTitle = str_replace('*', '%', $albumTitle); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ALBUM_TITLE, $albumTitle, $comparison); - } - - /** - * Filter the query on the genre column - * - * @param string $genre The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByGenre($genre = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($genre)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $genre)) { - $genre = str_replace('*', '%', $genre); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::GENRE, $genre, $comparison); - } - - /** - * Filter the query on the comments column - * - * @param string $comments The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByComments($comments = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($comments)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $comments)) { - $comments = str_replace('*', '%', $comments); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::COMMENTS, $comments, $comparison); - } - - /** - * Filter the query on the year column - * - * @param string $year The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByYear($year = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($year)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $year)) { - $year = str_replace('*', '%', $year); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::YEAR, $year, $comparison); - } - - /** - * Filter the query on the track_number column - * - * @param int|array $trackNumber The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByTrackNumber($trackNumber = null, $comparison = null) - { - if (is_array($trackNumber)) { - $useMinMax = false; - if (isset($trackNumber['min'])) { - $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $trackNumber['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($trackNumber['max'])) { - $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $trackNumber['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $trackNumber, $comparison); - } - - /** - * Filter the query on the channels column - * - * @param int|array $channels The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByChannels($channels = null, $comparison = null) - { - if (is_array($channels)) { - $useMinMax = false; - if (isset($channels['min'])) { - $this->addUsingAlias(CcFilesPeer::CHANNELS, $channels['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($channels['max'])) { - $this->addUsingAlias(CcFilesPeer::CHANNELS, $channels['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcFilesPeer::CHANNELS, $channels, $comparison); - } - - /** - * Filter the query on the url column - * - * @param string $url The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByUrl($url = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($url)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $url)) { - $url = str_replace('*', '%', $url); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::URL, $url, $comparison); - } - - /** - * Filter the query on the bpm column - * - * @param string $bpm The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByBpm($bpm = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($bpm)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $bpm)) { - $bpm = str_replace('*', '%', $bpm); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::BPM, $bpm, $comparison); - } - - /** - * Filter the query on the rating column - * - * @param string $rating The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByRating($rating = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($rating)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $rating)) { - $rating = str_replace('*', '%', $rating); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::RATING, $rating, $comparison); - } - - /** - * Filter the query on the encoded_by column - * - * @param string $encodedBy The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByEncodedBy($encodedBy = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($encodedBy)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $encodedBy)) { - $encodedBy = str_replace('*', '%', $encodedBy); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ENCODED_BY, $encodedBy, $comparison); - } - - /** - * Filter the query on the disc_number column - * - * @param string $discNumber The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByDiscNumber($discNumber = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($discNumber)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $discNumber)) { - $discNumber = str_replace('*', '%', $discNumber); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::DISC_NUMBER, $discNumber, $comparison); - } - - /** - * Filter the query on the mood column - * - * @param string $mood The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByMood($mood = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($mood)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $mood)) { - $mood = str_replace('*', '%', $mood); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::MOOD, $mood, $comparison); - } - - /** - * Filter the query on the label column - * - * @param string $label The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByLabel($label = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($label)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $label)) { - $label = str_replace('*', '%', $label); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::LABEL, $label, $comparison); - } - - /** - * Filter the query on the composer column - * - * @param string $composer The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByComposer($composer = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($composer)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $composer)) { - $composer = str_replace('*', '%', $composer); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::COMPOSER, $composer, $comparison); - } - - /** - * Filter the query on the encoder column - * - * @param string $encoder The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByEncoder($encoder = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($encoder)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $encoder)) { - $encoder = str_replace('*', '%', $encoder); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ENCODER, $encoder, $comparison); - } - - /** - * Filter the query on the checksum column - * - * @param string $checksum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByChecksum($checksum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($checksum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $checksum)) { - $checksum = str_replace('*', '%', $checksum); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::CHECKSUM, $checksum, $comparison); - } - - /** - * Filter the query on the lyrics column - * - * @param string $lyrics The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByLyrics($lyrics = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lyrics)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lyrics)) { - $lyrics = str_replace('*', '%', $lyrics); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::LYRICS, $lyrics, $comparison); - } - - /** - * Filter the query on the orchestra column - * - * @param string $orchestra The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByOrchestra($orchestra = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($orchestra)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $orchestra)) { - $orchestra = str_replace('*', '%', $orchestra); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ORCHESTRA, $orchestra, $comparison); - } - - /** - * Filter the query on the conductor column - * - * @param string $conductor The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByConductor($conductor = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($conductor)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $conductor)) { - $conductor = str_replace('*', '%', $conductor); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::CONDUCTOR, $conductor, $comparison); - } - - /** - * Filter the query on the lyricist column - * - * @param string $lyricist The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByLyricist($lyricist = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lyricist)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lyricist)) { - $lyricist = str_replace('*', '%', $lyricist); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::LYRICIST, $lyricist, $comparison); - } - - /** - * Filter the query on the original_lyricist column - * - * @param string $originalLyricist The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByOriginalLyricist($originalLyricist = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($originalLyricist)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $originalLyricist)) { - $originalLyricist = str_replace('*', '%', $originalLyricist); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ORIGINAL_LYRICIST, $originalLyricist, $comparison); - } - - /** - * Filter the query on the radio_station_name column - * - * @param string $radioStationName The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByRadioStationName($radioStationName = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($radioStationName)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $radioStationName)) { - $radioStationName = str_replace('*', '%', $radioStationName); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::RADIO_STATION_NAME, $radioStationName, $comparison); - } - - /** - * Filter the query on the info_url column - * - * @param string $infoUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByInfoUrl($infoUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($infoUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $infoUrl)) { - $infoUrl = str_replace('*', '%', $infoUrl); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::INFO_URL, $infoUrl, $comparison); - } - - /** - * Filter the query on the artist_url column - * - * @param string $artistUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByArtistUrl($artistUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($artistUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $artistUrl)) { - $artistUrl = str_replace('*', '%', $artistUrl); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ARTIST_URL, $artistUrl, $comparison); - } - - /** - * Filter the query on the audio_source_url column - * - * @param string $audioSourceUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByAudioSourceUrl($audioSourceUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($audioSourceUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $audioSourceUrl)) { - $audioSourceUrl = str_replace('*', '%', $audioSourceUrl); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::AUDIO_SOURCE_URL, $audioSourceUrl, $comparison); - } - - /** - * Filter the query on the radio_station_url column - * - * @param string $radioStationUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByRadioStationUrl($radioStationUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($radioStationUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $radioStationUrl)) { - $radioStationUrl = str_replace('*', '%', $radioStationUrl); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::RADIO_STATION_URL, $radioStationUrl, $comparison); - } - - /** - * Filter the query on the buy_this_url column - * - * @param string $buyThisUrl The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByBuyThisUrl($buyThisUrl = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($buyThisUrl)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $buyThisUrl)) { - $buyThisUrl = str_replace('*', '%', $buyThisUrl); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::BUY_THIS_URL, $buyThisUrl, $comparison); - } - - /** - * Filter the query on the isrc_number column - * - * @param string $isrcNumber The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByIsrcNumber($isrcNumber = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($isrcNumber)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $isrcNumber)) { - $isrcNumber = str_replace('*', '%', $isrcNumber); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ISRC_NUMBER, $isrcNumber, $comparison); - } - - /** - * Filter the query on the catalog_number column - * - * @param string $catalogNumber The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByCatalogNumber($catalogNumber = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($catalogNumber)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $catalogNumber)) { - $catalogNumber = str_replace('*', '%', $catalogNumber); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::CATALOG_NUMBER, $catalogNumber, $comparison); - } - - /** - * Filter the query on the original_artist column - * - * @param string $originalArtist The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByOriginalArtist($originalArtist = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($originalArtist)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $originalArtist)) { - $originalArtist = str_replace('*', '%', $originalArtist); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::ORIGINAL_ARTIST, $originalArtist, $comparison); - } - - /** - * Filter the query on the copyright column - * - * @param string $copyright The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByCopyright($copyright = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($copyright)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $copyright)) { - $copyright = str_replace('*', '%', $copyright); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::COPYRIGHT, $copyright, $comparison); - } - - /** - * Filter the query on the report_datetime column - * - * @param string $reportDatetime The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByReportDatetime($reportDatetime = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($reportDatetime)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $reportDatetime)) { - $reportDatetime = str_replace('*', '%', $reportDatetime); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::REPORT_DATETIME, $reportDatetime, $comparison); - } - - /** - * Filter the query on the report_location column - * - * @param string $reportLocation The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByReportLocation($reportLocation = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($reportLocation)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $reportLocation)) { - $reportLocation = str_replace('*', '%', $reportLocation); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::REPORT_LOCATION, $reportLocation, $comparison); - } - - /** - * Filter the query on the report_organization column - * - * @param string $reportOrganization The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByReportOrganization($reportOrganization = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($reportOrganization)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $reportOrganization)) { - $reportOrganization = str_replace('*', '%', $reportOrganization); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::REPORT_ORGANIZATION, $reportOrganization, $comparison); - } - - /** - * Filter the query on the subject column - * - * @param string $subject The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterBySubject($subject = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($subject)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $subject)) { - $subject = str_replace('*', '%', $subject); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::SUBJECT, $subject, $comparison); - } - - /** - * Filter the query on the contributor column - * - * @param string $contributor The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByContributor($contributor = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($contributor)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $contributor)) { - $contributor = str_replace('*', '%', $contributor); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::CONTRIBUTOR, $contributor, $comparison); - } - - /** - * Filter the query on the language column - * - * @param string $language The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByLanguage($language = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($language)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $language)) { - $language = str_replace('*', '%', $language); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcFilesPeer::LANGUAGE, $language, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Filter the query by a related CcPlaylistcontents object - * - * @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null) - { - return $this - ->addUsingAlias(CcFilesPeer::ID, $ccPlaylistcontents->getDbFileId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPlaylistcontents relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPlaylistcontents'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPlaylistcontents'); - } - - return $this; - } - - /** - * Use the CcPlaylistcontents relation CcPlaylistcontents object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistcontentsQuery A secondary query class using the current class as primary query - */ - public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPlaylistcontents($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery'); - } - - /** - * Exclude object from result - * - * @param CcFiles $ccFiles Object to remove from the list of results - * - * @return CcFilesQuery The current query, for fluid interface - */ - public function prune($ccFiles = null) - { - if ($ccFiles) { - $this->addUsingAlias(CcFilesPeer::ID, $ccFiles->getDbId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcFilesQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPerms.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPerms.php deleted file mode 100644 index a7398920f..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPerms.php +++ /dev/null @@ -1,945 +0,0 @@ -permid; - } - - /** - * Get the [subj] column value. - * - * @return int - */ - public function getSubj() - { - return $this->subj; - } - - /** - * Get the [action] column value. - * - * @return string - */ - public function getAction() - { - return $this->action; - } - - /** - * Get the [obj] column value. - * - * @return int - */ - public function getObj() - { - return $this->obj; - } - - /** - * Get the [type] column value. - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Set the value of [permid] column. - * - * @param int $v new value - * @return CcPerms The current object (for fluent API support) - */ - public function setPermid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->permid !== $v) { - $this->permid = $v; - $this->modifiedColumns[] = CcPermsPeer::PERMID; - } - - return $this; - } // setPermid() - - /** - * Set the value of [subj] column. - * - * @param int $v new value - * @return CcPerms The current object (for fluent API support) - */ - public function setSubj($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->subj !== $v) { - $this->subj = $v; - $this->modifiedColumns[] = CcPermsPeer::SUBJ; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setSubj() - - /** - * Set the value of [action] column. - * - * @param string $v new value - * @return CcPerms The current object (for fluent API support) - */ - public function setAction($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->action !== $v) { - $this->action = $v; - $this->modifiedColumns[] = CcPermsPeer::ACTION; - } - - return $this; - } // setAction() - - /** - * Set the value of [obj] column. - * - * @param int $v new value - * @return CcPerms The current object (for fluent API support) - */ - public function setObj($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->obj !== $v) { - $this->obj = $v; - $this->modifiedColumns[] = CcPermsPeer::OBJ; - } - - return $this; - } // setObj() - - /** - * Set the value of [type] column. - * - * @param string $v new value - * @return CcPerms The current object (for fluent API support) - */ - public function setType($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->type !== $v) { - $this->type = $v; - $this->modifiedColumns[] = CcPermsPeer::TYPE; - } - - return $this; - } // setType() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->permid = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->subj = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->action = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->obj = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; - $this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 5; // 5 = CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcPerms object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->subj !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcPermsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcPermsQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcPermsPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setNew(false); - } else { - $affectedRows += CcPermsPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcPermsPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getPermid(); - break; - case 1: - return $this->getSubj(); - break; - case 2: - return $this->getAction(); - break; - case 3: - return $this->getObj(); - break; - case 4: - return $this->getType(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcPermsPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getPermid(), - $keys[1] => $this->getSubj(), - $keys[2] => $this->getAction(), - $keys[3] => $this->getObj(), - $keys[4] => $this->getType(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setPermid($value); - break; - case 1: - $this->setSubj($value); - break; - case 2: - $this->setAction($value); - break; - case 3: - $this->setObj($value); - break; - case 4: - $this->setType($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcPermsPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setPermid($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setSubj($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setAction($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setObj($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setType($arr[$keys[4]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcPermsPeer::PERMID)) $criteria->add(CcPermsPeer::PERMID, $this->permid); - if ($this->isColumnModified(CcPermsPeer::SUBJ)) $criteria->add(CcPermsPeer::SUBJ, $this->subj); - if ($this->isColumnModified(CcPermsPeer::ACTION)) $criteria->add(CcPermsPeer::ACTION, $this->action); - if ($this->isColumnModified(CcPermsPeer::OBJ)) $criteria->add(CcPermsPeer::OBJ, $this->obj); - if ($this->isColumnModified(CcPermsPeer::TYPE)) $criteria->add(CcPermsPeer::TYPE, $this->type); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); - $criteria->add(CcPermsPeer::PERMID, $this->permid); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getPermid(); - } - - /** - * Generic method to set the primary key (permid column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setPermid($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getPermid(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcPerms (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setPermid($this->permid); - $copyObj->setSubj($this->subj); - $copyObj->setAction($this->action); - $copyObj->setObj($this->obj); - $copyObj->setType($this->type); - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcPerms Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcPermsPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcPermsPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcPerms The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setSubj(NULL); - } else { - $this->setSubj($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcPerms($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->subj !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subj, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcPermss($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->permid = null; - $this->subj = null; - $this->action = null; - $this->obj = null; - $this->type = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcPerms diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPermsPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPermsPeer.php deleted file mode 100644 index 2bfdaeb0e..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPermsPeer.php +++ /dev/null @@ -1,984 +0,0 @@ - array ('Permid', 'Subj', 'Action', 'Obj', 'Type', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('permid', 'subj', 'action', 'obj', 'type', ), - BasePeer::TYPE_COLNAME => array (self::PERMID, self::SUBJ, self::ACTION, self::OBJ, self::TYPE, ), - BasePeer::TYPE_RAW_COLNAME => array ('PERMID', 'SUBJ', 'ACTION', 'OBJ', 'TYPE', ), - BasePeer::TYPE_FIELDNAME => array ('permid', 'subj', 'action', 'obj', 'type', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Permid' => 0, 'Subj' => 1, 'Action' => 2, 'Obj' => 3, 'Type' => 4, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ), - BasePeer::TYPE_COLNAME => array (self::PERMID => 0, self::SUBJ => 1, self::ACTION => 2, self::OBJ => 3, self::TYPE => 4, ), - BasePeer::TYPE_RAW_COLNAME => array ('PERMID' => 0, 'SUBJ' => 1, 'ACTION' => 2, 'OBJ' => 3, 'TYPE' => 4, ), - BasePeer::TYPE_FIELDNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcPermsPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcPermsPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcPermsPeer::PERMID); - $criteria->addSelectColumn(CcPermsPeer::SUBJ); - $criteria->addSelectColumn(CcPermsPeer::ACTION); - $criteria->addSelectColumn(CcPermsPeer::OBJ); - $criteria->addSelectColumn(CcPermsPeer::TYPE); - } else { - $criteria->addSelectColumn($alias . '.PERMID'); - $criteria->addSelectColumn($alias . '.SUBJ'); - $criteria->addSelectColumn($alias . '.ACTION'); - $criteria->addSelectColumn($alias . '.OBJ'); - $criteria->addSelectColumn($alias . '.TYPE'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPermsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcPerms - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcPermsPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcPermsPeer::populateObjects(CcPermsPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcPermsPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcPerms $value A CcPerms object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcPerms $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getPermid(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcPerms object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcPerms) { - $key = (string) $value->getPermid(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPerms object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcPerms Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_perms - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcPermsPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcPermsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcPermsPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcPerms object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcPermsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcPermsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcPermsPeer::NUM_COLUMNS; - } else { - $cls = CcPermsPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcPermsPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPermsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcPerms objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPerms objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPermsPeer::addSelectColumns($criteria); - $startcol = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPermsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcPermsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPermsPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcPerms) to $obj2 (CcSubjs) - $obj2->addCcPerms($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPermsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcPerms objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPerms objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPermsPeer::addSelectColumns($criteria); - $startcol2 = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPermsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPermsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPermsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcPerms) to the collection in $obj2 (CcSubjs) - $obj2->addCcPerms($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcPermsPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcPermsPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcPermsTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcPermsPeer::CLASS_DEFAULT : CcPermsPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcPerms or Criteria object. - * - * @param mixed $values Criteria or CcPerms object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcPerms object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcPerms or Criteria object. - * - * @param mixed $values Criteria or CcPerms object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcPermsPeer::PERMID); - $value = $criteria->remove(CcPermsPeer::PERMID); - if ($value) { - $selectCriteria->add(CcPermsPeer::PERMID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); - } - - } else { // $values is CcPerms object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_perms table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcPermsPeer::TABLE_NAME, $con, CcPermsPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcPermsPeer::clearInstancePool(); - CcPermsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcPerms or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcPerms object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcPermsPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcPerms) { // it's a model object - // invalidate the cache for this single object - CcPermsPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcPermsPeer::PERMID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcPermsPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcPermsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcPerms object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcPerms $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcPerms $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcPermsPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcPermsPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcPermsPeer::DATABASE_NAME, CcPermsPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcPerms - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); - $criteria->add(CcPermsPeer::PERMID, $pk); - - $v = CcPermsPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); - $criteria->add(CcPermsPeer::PERMID, $pks, Criteria::IN); - $objs = CcPermsPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcPermsPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcPermsPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPermsQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPermsQuery.php deleted file mode 100644 index f78dfb99e..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPermsQuery.php +++ /dev/null @@ -1,355 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcPerms|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcPermsPeer::PERMID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcPermsPeer::PERMID, $keys, Criteria::IN); - } - - /** - * Filter the query on the permid column - * - * @param int|array $permid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByPermid($permid = null, $comparison = null) - { - if (is_array($permid) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcPermsPeer::PERMID, $permid, $comparison); - } - - /** - * Filter the query on the subj column - * - * @param int|array $subj The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterBySubj($subj = null, $comparison = null) - { - if (is_array($subj)) { - $useMinMax = false; - if (isset($subj['min'])) { - $this->addUsingAlias(CcPermsPeer::SUBJ, $subj['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($subj['max'])) { - $this->addUsingAlias(CcPermsPeer::SUBJ, $subj['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPermsPeer::SUBJ, $subj, $comparison); - } - - /** - * Filter the query on the action column - * - * @param string $action The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByAction($action = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($action)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $action)) { - $action = str_replace('*', '%', $action); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPermsPeer::ACTION, $action, $comparison); - } - - /** - * Filter the query on the obj column - * - * @param int|array $obj The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByObj($obj = null, $comparison = null) - { - if (is_array($obj)) { - $useMinMax = false; - if (isset($obj['min'])) { - $this->addUsingAlias(CcPermsPeer::OBJ, $obj['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($obj['max'])) { - $this->addUsingAlias(CcPermsPeer::OBJ, $obj['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPermsPeer::OBJ, $obj, $comparison); - } - - /** - * Filter the query on the type column - * - * @param string $type The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByType($type = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($type)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $type)) { - $type = str_replace('*', '%', $type); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPermsPeer::TYPE, $type, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Exclude object from result - * - * @param CcPerms $ccPerms Object to remove from the list of results - * - * @return CcPermsQuery The current query, for fluid interface - */ - public function prune($ccPerms = null) - { - if ($ccPerms) { - $this->addUsingAlias(CcPermsPeer::PERMID, $ccPerms->getPermid(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcPermsQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylist.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylist.php deleted file mode 100644 index 295060730..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylist.php +++ /dev/null @@ -1,1365 +0,0 @@ -name = ''; - $this->state = 'empty'; - $this->currentlyaccessing = 0; - } - - /** - * Initializes internal state of BaseCcPlaylist object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getDbId() - { - return $this->id; - } - - /** - * Get the [name] column value. - * - * @return string - */ - public function getDbName() - { - return $this->name; - } - - /** - * Get the [state] column value. - * - * @return string - */ - public function getDbState() - { - return $this->state; - } - - /** - * Get the [currentlyaccessing] column value. - * - * @return int - */ - public function getDbCurrentlyaccessing() - { - return $this->currentlyaccessing; - } - - /** - * Get the [editedby] column value. - * - * @return int - */ - public function getDbEditedby() - { - return $this->editedby; - } - - /** - * Get the [optionally formatted] temporal [mtime] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbMtime($format = 'Y-m-d H:i:s') - { - if ($this->mtime === null) { - return null; - } - - - - try { - $dt = new DateTime($this->mtime); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [creator] column value. - * - * @return string - */ - public function getDbCreator() - { - return $this->creator; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDbDescription() - { - return $this->description; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcPlaylistPeer::ID; - } - - return $this; - } // setDbId() - - /** - * Set the value of [name] column. - * - * @param string $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbName($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->name !== $v || $this->isNew()) { - $this->name = $v; - $this->modifiedColumns[] = CcPlaylistPeer::NAME; - } - - return $this; - } // setDbName() - - /** - * Set the value of [state] column. - * - * @param string $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbState($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->state !== $v || $this->isNew()) { - $this->state = $v; - $this->modifiedColumns[] = CcPlaylistPeer::STATE; - } - - return $this; - } // setDbState() - - /** - * Set the value of [currentlyaccessing] column. - * - * @param int $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbCurrentlyaccessing($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->currentlyaccessing !== $v || $this->isNew()) { - $this->currentlyaccessing = $v; - $this->modifiedColumns[] = CcPlaylistPeer::CURRENTLYACCESSING; - } - - return $this; - } // setDbCurrentlyaccessing() - - /** - * Set the value of [editedby] column. - * - * @param int $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbEditedby($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->editedby !== $v) { - $this->editedby = $v; - $this->modifiedColumns[] = CcPlaylistPeer::EDITEDBY; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setDbEditedby() - - /** - * Sets the value of [mtime] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbMtime($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->mtime !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcPlaylistPeer::MTIME; - } - } // if either are not null - - return $this; - } // setDbMtime() - - /** - * Set the value of [creator] column. - * - * @param string $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbCreator($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->creator !== $v) { - $this->creator = $v; - $this->modifiedColumns[] = CcPlaylistPeer::CREATOR; - } - - return $this; - } // setDbCreator() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return CcPlaylist The current object (for fluent API support) - */ - public function setDbDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = CcPlaylistPeer::DESCRIPTION; - } - - return $this; - } // setDbDescription() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->name !== '') { - return false; - } - - if ($this->state !== 'empty') { - return false; - } - - if ($this->currentlyaccessing !== 0) { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->state = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->currentlyaccessing = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; - $this->editedby = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; - $this->mtime = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->creator = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->description = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 8; // 8 = CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcPlaylist object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcPlaylistPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - $this->collCcPlaylistcontentss = null; - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcPlaylistQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcPlaylistPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcPlaylistPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcPlaylistPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setDbId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows += CcPlaylistPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - if ($this->collCcPlaylistcontentss !== null) { - foreach ($this->collCcPlaylistcontentss as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcPlaylistPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collCcPlaylistcontentss !== null) { - foreach ($this->collCcPlaylistcontentss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPlaylistPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getDbId(); - break; - case 1: - return $this->getDbName(); - break; - case 2: - return $this->getDbState(); - break; - case 3: - return $this->getDbCurrentlyaccessing(); - break; - case 4: - return $this->getDbEditedby(); - break; - case 5: - return $this->getDbMtime(); - break; - case 6: - return $this->getDbCreator(); - break; - case 7: - return $this->getDbDescription(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcPlaylistPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbName(), - $keys[2] => $this->getDbState(), - $keys[3] => $this->getDbCurrentlyaccessing(), - $keys[4] => $this->getDbEditedby(), - $keys[5] => $this->getDbMtime(), - $keys[6] => $this->getDbCreator(), - $keys[7] => $this->getDbDescription(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPlaylistPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setDbId($value); - break; - case 1: - $this->setDbName($value); - break; - case 2: - $this->setDbState($value); - break; - case 3: - $this->setDbCurrentlyaccessing($value); - break; - case 4: - $this->setDbEditedby($value); - break; - case 5: - $this->setDbMtime($value); - break; - case 6: - $this->setDbCreator($value); - break; - case 7: - $this->setDbDescription($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcPlaylistPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbState($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbEditedby($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbMtime($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbCreator($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbDescription($arr[$keys[7]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcPlaylistPeer::ID)) $criteria->add(CcPlaylistPeer::ID, $this->id); - if ($this->isColumnModified(CcPlaylistPeer::NAME)) $criteria->add(CcPlaylistPeer::NAME, $this->name); - if ($this->isColumnModified(CcPlaylistPeer::STATE)) $criteria->add(CcPlaylistPeer::STATE, $this->state); - if ($this->isColumnModified(CcPlaylistPeer::CURRENTLYACCESSING)) $criteria->add(CcPlaylistPeer::CURRENTLYACCESSING, $this->currentlyaccessing); - if ($this->isColumnModified(CcPlaylistPeer::EDITEDBY)) $criteria->add(CcPlaylistPeer::EDITEDBY, $this->editedby); - if ($this->isColumnModified(CcPlaylistPeer::MTIME)) $criteria->add(CcPlaylistPeer::MTIME, $this->mtime); - if ($this->isColumnModified(CcPlaylistPeer::CREATOR)) $criteria->add(CcPlaylistPeer::CREATOR, $this->creator); - if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) $criteria->add(CcPlaylistPeer::DESCRIPTION, $this->description); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); - $criteria->add(CcPlaylistPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getDbId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setDbId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getDbId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcPlaylist (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setDbName($this->name); - $copyObj->setDbState($this->state); - $copyObj->setDbCurrentlyaccessing($this->currentlyaccessing); - $copyObj->setDbEditedby($this->editedby); - $copyObj->setDbMtime($this->mtime); - $copyObj->setDbCreator($this->creator); - $copyObj->setDbDescription($this->description); - - if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - - foreach ($this->getCcPlaylistcontentss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy)); - } - } - - } // if ($deepCopy) - - - $copyObj->setNew(true); - $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcPlaylist Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcPlaylistPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcPlaylistPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcPlaylist The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setDbEditedby(NULL); - } else { - $this->setDbEditedby($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcPlaylist($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->editedby !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcPlaylists($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears out the collCcPlaylistcontentss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcPlaylistcontentss() - */ - public function clearCcPlaylistcontentss() - { - $this->collCcPlaylistcontentss = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcPlaylistcontentss collection. - * - * By default this just sets the collCcPlaylistcontentss collection to an empty array (like clearcollCcPlaylistcontentss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcPlaylistcontentss() - { - $this->collCcPlaylistcontentss = new PropelObjectCollection(); - $this->collCcPlaylistcontentss->setModel('CcPlaylistcontents'); - } - - /** - * Gets an array of CcPlaylistcontents objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcPlaylist is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects - * @throws PropelException - */ - public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcPlaylistcontentss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylistcontentss) { - // return empty collection - $this->initCcPlaylistcontentss(); - } else { - $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria) - ->filterByCcPlaylist($this) - ->find($con); - if (null !== $criteria) { - return $collCcPlaylistcontentss; - } - $this->collCcPlaylistcontentss = $collCcPlaylistcontentss; - } - } - return $this->collCcPlaylistcontentss; - } - - /** - * Returns the number of related CcPlaylistcontents objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcPlaylistcontents objects. - * @throws PropelException - */ - public function countCcPlaylistcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcPlaylistcontentss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylistcontentss) { - return 0; - } else { - $query = CcPlaylistcontentsQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcPlaylist($this) - ->count($con); - } - } else { - return count($this->collCcPlaylistcontentss); - } - } - - /** - * Method called to associate a CcPlaylistcontents object to this object - * through the CcPlaylistcontents foreign key attribute. - * - * @param CcPlaylistcontents $l CcPlaylistcontents - * @return void - * @throws PropelException - */ - public function addCcPlaylistcontents(CcPlaylistcontents $l) - { - if ($this->collCcPlaylistcontentss === null) { - $this->initCcPlaylistcontentss(); - } - if (!$this->collCcPlaylistcontentss->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcPlaylistcontentss[]= $l; - $l->setCcPlaylist($this); - } - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this CcPlaylist is new, it will return - * an empty collection; or if this CcPlaylist has previously - * been saved, it will retrieve related CcPlaylistcontentss from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in CcPlaylist. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects - */ - public function getCcPlaylistcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $query = CcPlaylistcontentsQuery::create(null, $criteria); - $query->joinWith('CcFiles', $join_behavior); - - return $this->getCcPlaylistcontentss($query, $con); - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->name = null; - $this->state = null; - $this->currentlyaccessing = null; - $this->editedby = null; - $this->mtime = null; - $this->creator = null; - $this->description = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - if ($this->collCcPlaylistcontentss) { - foreach ((array) $this->collCcPlaylistcontentss as $o) { - $o->clearAllReferences($deep); - } - } - } // if ($deep) - - $this->collCcPlaylistcontentss = null; - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcPlaylist diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistPeer.php deleted file mode 100644 index 04ff4a612..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistPeer.php +++ /dev/null @@ -1,1006 +0,0 @@ - array ('DbId', 'DbName', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbCreator', 'DbDescription', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbCreator', 'dbDescription', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::CREATOR, self::DESCRIPTION, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'CREATOR', 'DESCRIPTION', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'creator', 'description', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbState' => 2, 'DbCurrentlyaccessing' => 3, 'DbEditedby' => 4, 'DbMtime' => 5, 'DbCreator' => 6, 'DbDescription' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbState' => 2, 'dbCurrentlyaccessing' => 3, 'dbEditedby' => 4, 'dbMtime' => 5, 'dbCreator' => 6, 'dbDescription' => 7, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::STATE => 2, self::CURRENTLYACCESSING => 3, self::EDITEDBY => 4, self::MTIME => 5, self::CREATOR => 6, self::DESCRIPTION => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'STATE' => 2, 'CURRENTLYACCESSING' => 3, 'EDITEDBY' => 4, 'MTIME' => 5, 'CREATOR' => 6, 'DESCRIPTION' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'state' => 2, 'currentlyaccessing' => 3, 'editedby' => 4, 'mtime' => 5, 'creator' => 6, 'description' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcPlaylistPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcPlaylistPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcPlaylistPeer::ID); - $criteria->addSelectColumn(CcPlaylistPeer::NAME); - $criteria->addSelectColumn(CcPlaylistPeer::STATE); - $criteria->addSelectColumn(CcPlaylistPeer::CURRENTLYACCESSING); - $criteria->addSelectColumn(CcPlaylistPeer::EDITEDBY); - $criteria->addSelectColumn(CcPlaylistPeer::MTIME); - $criteria->addSelectColumn(CcPlaylistPeer::CREATOR); - $criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.NAME'); - $criteria->addSelectColumn($alias . '.STATE'); - $criteria->addSelectColumn($alias . '.CURRENTLYACCESSING'); - $criteria->addSelectColumn($alias . '.EDITEDBY'); - $criteria->addSelectColumn($alias . '.MTIME'); - $criteria->addSelectColumn($alias . '.CREATOR'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcPlaylist - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcPlaylistPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcPlaylistPeer::populateObjects(CcPlaylistPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcPlaylistPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcPlaylist $value A CcPlaylist object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcPlaylist $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getDbId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcPlaylist object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcPlaylist) { - $key = (string) $value->getDbId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlaylist object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcPlaylist Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_playlist - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in CcPlaylistcontentsPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcPlaylistcontentsPeer::clearInstancePool(); - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcPlaylistPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcPlaylistPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcPlaylist object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcPlaylistPeer::NUM_COLUMNS; - } else { - $cls = CcPlaylistPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcPlaylistPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcPlaylist objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylist objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistPeer::addSelectColumns($criteria); - $startcol = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcPlaylistPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcPlaylist) to $obj2 (CcSubjs) - $obj2->addCcPlaylist($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcPlaylist objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylist objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistPeer::addSelectColumns($criteria); - $startcol2 = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPlaylistPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcPlaylist) to the collection in $obj2 (CcSubjs) - $obj2->addCcPlaylist($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcPlaylistPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcPlaylistPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcPlaylistTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcPlaylistPeer::CLASS_DEFAULT : CcPlaylistPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcPlaylist or Criteria object. - * - * @param mixed $values Criteria or CcPlaylist object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcPlaylist object - } - - if ($criteria->containsKey(CcPlaylistPeer::ID) && $criteria->keyContainsValue(CcPlaylistPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcPlaylist or Criteria object. - * - * @param mixed $values Criteria or CcPlaylist object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcPlaylistPeer::ID); - $value = $criteria->remove(CcPlaylistPeer::ID); - if ($value) { - $selectCriteria->add(CcPlaylistPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); - } - - } else { // $values is CcPlaylist object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_playlist table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcPlaylistPeer::TABLE_NAME, $con, CcPlaylistPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcPlaylistPeer::clearInstancePool(); - CcPlaylistPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcPlaylist or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcPlaylist object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcPlaylistPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcPlaylist) { // it's a model object - // invalidate the cache for this single object - CcPlaylistPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcPlaylistPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcPlaylistPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcPlaylistPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcPlaylist object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcPlaylist $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcPlaylist $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcPlaylistPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcPlaylistPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcPlaylistPeer::DATABASE_NAME, CcPlaylistPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcPlaylist - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); - $criteria->add(CcPlaylistPeer::ID, $pk); - - $v = CcPlaylistPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); - $criteria->add(CcPlaylistPeer::ID, $pks, Criteria::IN); - $objs = CcPlaylistPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcPlaylistPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcPlaylistPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistQuery.php deleted file mode 100644 index 237be4312..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistQuery.php +++ /dev/null @@ -1,510 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcPlaylist|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcPlaylistPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcPlaylistPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $dbId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbId($dbId = null, $comparison = null) - { - if (is_array($dbId) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcPlaylistPeer::ID, $dbId, $comparison); - } - - /** - * Filter the query on the name column - * - * @param string $dbName The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbName($dbName = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbName)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbName)) { - $dbName = str_replace('*', '%', $dbName); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPlaylistPeer::NAME, $dbName, $comparison); - } - - /** - * Filter the query on the state column - * - * @param string $dbState The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbState($dbState = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbState)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbState)) { - $dbState = str_replace('*', '%', $dbState); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPlaylistPeer::STATE, $dbState, $comparison); - } - - /** - * Filter the query on the currentlyaccessing column - * - * @param int|array $dbCurrentlyaccessing The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbCurrentlyaccessing($dbCurrentlyaccessing = null, $comparison = null) - { - if (is_array($dbCurrentlyaccessing)) { - $useMinMax = false; - if (isset($dbCurrentlyaccessing['min'])) { - $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbCurrentlyaccessing['max'])) { - $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing, $comparison); - } - - /** - * Filter the query on the editedby column - * - * @param int|array $dbEditedby The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbEditedby($dbEditedby = null, $comparison = null) - { - if (is_array($dbEditedby)) { - $useMinMax = false; - if (isset($dbEditedby['min'])) { - $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbEditedby['max'])) { - $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby, $comparison); - } - - /** - * Filter the query on the mtime column - * - * @param string|array $dbMtime The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbMtime($dbMtime = null, $comparison = null) - { - if (is_array($dbMtime)) { - $useMinMax = false; - if (isset($dbMtime['min'])) { - $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbMtime['max'])) { - $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime, $comparison); - } - - /** - * Filter the query on the creator column - * - * @param string $dbCreator The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbCreator($dbCreator = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbCreator)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbCreator)) { - $dbCreator = str_replace('*', '%', $dbCreator); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPlaylistPeer::CREATOR, $dbCreator, $comparison); - } - - /** - * Filter the query on the description column - * - * @param string $dbDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByDbDescription($dbDescription = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($dbDescription)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $dbDescription)) { - $dbDescription = str_replace('*', '%', $dbDescription); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPlaylistPeer::DESCRIPTION, $dbDescription, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcPlaylistPeer::EDITEDBY, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Filter the query by a related CcPlaylistcontents object - * - * @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null) - { - return $this - ->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylistcontents->getDbPlaylistId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPlaylistcontents relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPlaylistcontents'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPlaylistcontents'); - } - - return $this; - } - - /** - * Use the CcPlaylistcontents relation CcPlaylistcontents object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistcontentsQuery A secondary query class using the current class as primary query - */ - public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPlaylistcontents($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery'); - } - - /** - * Exclude object from result - * - * @param CcPlaylist $ccPlaylist Object to remove from the list of results - * - * @return CcPlaylistQuery The current query, for fluid interface - */ - public function prune($ccPlaylist = null) - { - if ($ccPlaylist) { - $this->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylist->getDbId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcPlaylistQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontents.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontents.php deleted file mode 100644 index 53ff5fe8d..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontents.php +++ /dev/null @@ -1,1540 +0,0 @@ -cliplength = '00:00:00'; - $this->cuein = '00:00:00'; - $this->cueout = '00:00:00'; - $this->fadein = '00:00:00'; - $this->fadeout = '00:00:00'; - } - - /** - * Initializes internal state of BaseCcPlaylistcontents object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getDbId() - { - return $this->id; - } - - /** - * Get the [playlist_id] column value. - * - * @return int - */ - public function getDbPlaylistId() - { - return $this->playlist_id; - } - - /** - * Get the [file_id] column value. - * - * @return int - */ - public function getDbFileId() - { - return $this->file_id; - } - - /** - * Get the [position] column value. - * - * @return int - */ - public function getDbPosition() - { - return $this->position; - } - - /** - * Get the [optionally formatted] temporal [cliplength] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbCliplength($format = '%X') - { - if ($this->cliplength === null) { - return null; - } - - - - try { - $dt = new DateTime($this->cliplength); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cliplength, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [cuein] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbCuein($format = '%X') - { - if ($this->cuein === null) { - return null; - } - - - - try { - $dt = new DateTime($this->cuein); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cuein, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [cueout] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbCueout($format = '%X') - { - if ($this->cueout === null) { - return null; - } - - - - try { - $dt = new DateTime($this->cueout); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cueout, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [fadein] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbFadein($format = '%X') - { - if ($this->fadein === null) { - return null; - } - - - - try { - $dt = new DateTime($this->fadein); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadein, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [fadeout] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getDbFadeout($format = '%X') - { - if ($this->fadeout === null) { - return null; - } - - - - try { - $dt = new DateTime($this->fadeout); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadeout, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcPlaylistcontentsPeer::ID; - } - - return $this; - } // setDbId() - - /** - * Set the value of [playlist_id] column. - * - * @param int $v new value - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbPlaylistId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->playlist_id !== $v) { - $this->playlist_id = $v; - $this->modifiedColumns[] = CcPlaylistcontentsPeer::PLAYLIST_ID; - } - - if ($this->aCcPlaylist !== null && $this->aCcPlaylist->getDbId() !== $v) { - $this->aCcPlaylist = null; - } - - return $this; - } // setDbPlaylistId() - - /** - * Set the value of [file_id] column. - * - * @param int $v new value - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbFileId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->file_id !== $v) { - $this->file_id = $v; - $this->modifiedColumns[] = CcPlaylistcontentsPeer::FILE_ID; - } - - if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) { - $this->aCcFiles = null; - } - - return $this; - } // setDbFileId() - - /** - * Set the value of [position] column. - * - * @param int $v new value - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbPosition($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->position !== $v) { - $this->position = $v; - $this->modifiedColumns[] = CcPlaylistcontentsPeer::POSITION; - } - - return $this; - } // setDbPosition() - - /** - * Sets the value of [cliplength] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbCliplength($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->cliplength !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->cliplength = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH; - } - } // if either are not null - - return $this; - } // setDbCliplength() - - /** - * Sets the value of [cuein] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbCuein($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->cuein !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->cuein = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN; - } - } // if either are not null - - return $this; - } // setDbCuein() - - /** - * Sets the value of [cueout] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbCueout($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->cueout !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->cueout = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT; - } - } // if either are not null - - return $this; - } // setDbCueout() - - /** - * Sets the value of [fadein] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbFadein($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->fadein !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->fadein = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; - } - } // if either are not null - - return $this; - } // setDbFadein() - - /** - * Sets the value of [fadeout] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcPlaylistcontents The current object (for fluent API support) - */ - public function setDbFadeout($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->fadeout !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->fadeout = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; - } - } // if either are not null - - return $this; - } // setDbFadeout() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->cliplength !== '00:00:00') { - return false; - } - - if ($this->cuein !== '00:00:00') { - return false; - } - - if ($this->cueout !== '00:00:00') { - return false; - } - - if ($this->fadein !== '00:00:00') { - return false; - } - - if ($this->fadeout !== '00:00:00') { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; - $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; - $this->cliplength = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->cuein = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->cueout = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->fadein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->fadeout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 9; // 9 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcPlaylistcontents object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcPlaylist !== null && $this->playlist_id !== $this->aCcPlaylist->getDbId()) { - $this->aCcPlaylist = null; - } - if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) { - $this->aCcFiles = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcPlaylistcontentsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcFiles = null; - $this->aCcPlaylist = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcPlaylistcontentsQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcPlaylistcontentsPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcFiles !== null) { - if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) { - $affectedRows += $this->aCcFiles->save($con); - } - $this->setCcFiles($this->aCcFiles); - } - - if ($this->aCcPlaylist !== null) { - if ($this->aCcPlaylist->isModified() || $this->aCcPlaylist->isNew()) { - $affectedRows += $this->aCcPlaylist->save($con); - } - $this->setCcPlaylist($this->aCcPlaylist); - } - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcPlaylistcontentsPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcPlaylistcontentsPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistcontentsPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setDbId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows += CcPlaylistcontentsPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcFiles !== null) { - if (!$this->aCcFiles->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures()); - } - } - - if ($this->aCcPlaylist !== null) { - if (!$this->aCcPlaylist->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcPlaylist->getValidationFailures()); - } - } - - - if (($retval = CcPlaylistcontentsPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPlaylistcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getDbId(); - break; - case 1: - return $this->getDbPlaylistId(); - break; - case 2: - return $this->getDbFileId(); - break; - case 3: - return $this->getDbPosition(); - break; - case 4: - return $this->getDbCliplength(); - break; - case 5: - return $this->getDbCuein(); - break; - case 6: - return $this->getDbCueout(); - break; - case 7: - return $this->getDbFadein(); - break; - case 8: - return $this->getDbFadeout(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcPlaylistcontentsPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getDbId(), - $keys[1] => $this->getDbPlaylistId(), - $keys[2] => $this->getDbFileId(), - $keys[3] => $this->getDbPosition(), - $keys[4] => $this->getDbCliplength(), - $keys[5] => $this->getDbCuein(), - $keys[6] => $this->getDbCueout(), - $keys[7] => $this->getDbFadein(), - $keys[8] => $this->getDbFadeout(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcFiles) { - $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true); - } - if (null !== $this->aCcPlaylist) { - $result['CcPlaylist'] = $this->aCcPlaylist->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPlaylistcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setDbId($value); - break; - case 1: - $this->setDbPlaylistId($value); - break; - case 2: - $this->setDbFileId($value); - break; - case 3: - $this->setDbPosition($value); - break; - case 4: - $this->setDbCliplength($value); - break; - case 5: - $this->setDbCuein($value); - break; - case 6: - $this->setDbCueout($value); - break; - case 7: - $this->setDbFadein($value); - break; - case 8: - $this->setDbFadeout($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcPlaylistcontentsPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDbCliplength($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbCuein($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDbCueout($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setDbFadein($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDbFadeout($arr[$keys[8]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcPlaylistcontentsPeer::ID)) $criteria->add(CcPlaylistcontentsPeer::ID, $this->id); - if ($this->isColumnModified(CcPlaylistcontentsPeer::PLAYLIST_ID)) $criteria->add(CcPlaylistcontentsPeer::PLAYLIST_ID, $this->playlist_id); - if ($this->isColumnModified(CcPlaylistcontentsPeer::FILE_ID)) $criteria->add(CcPlaylistcontentsPeer::FILE_ID, $this->file_id); - if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position); - if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) $criteria->add(CcPlaylistcontentsPeer::CLIPLENGTH, $this->cliplength); - if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEIN)) $criteria->add(CcPlaylistcontentsPeer::CUEIN, $this->cuein); - if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEOUT)) $criteria->add(CcPlaylistcontentsPeer::CUEOUT, $this->cueout); - if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEIN)) $criteria->add(CcPlaylistcontentsPeer::FADEIN, $this->fadein); - if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEOUT)) $criteria->add(CcPlaylistcontentsPeer::FADEOUT, $this->fadeout); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); - $criteria->add(CcPlaylistcontentsPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getDbId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setDbId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getDbId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcPlaylistcontents (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setDbPlaylistId($this->playlist_id); - $copyObj->setDbFileId($this->file_id); - $copyObj->setDbPosition($this->position); - $copyObj->setDbCliplength($this->cliplength); - $copyObj->setDbCuein($this->cuein); - $copyObj->setDbCueout($this->cueout); - $copyObj->setDbFadein($this->fadein); - $copyObj->setDbFadeout($this->fadeout); - - $copyObj->setNew(true); - $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcPlaylistcontents Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcPlaylistcontentsPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcPlaylistcontentsPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcFiles object. - * - * @param CcFiles $v - * @return CcPlaylistcontents The current object (for fluent API support) - * @throws PropelException - */ - public function setCcFiles(CcFiles $v = null) - { - if ($v === null) { - $this->setDbFileId(NULL); - } else { - $this->setDbFileId($v->getDbId()); - } - - $this->aCcFiles = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcFiles object, it will not be re-added. - if ($v !== null) { - $v->addCcPlaylistcontents($this); - } - - return $this; - } - - - /** - * Get the associated CcFiles object - * - * @param PropelPDO Optional Connection object. - * @return CcFiles The associated CcFiles object. - * @throws PropelException - */ - public function getCcFiles(PropelPDO $con = null) - { - if ($this->aCcFiles === null && ($this->file_id !== null)) { - $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcFiles->addCcPlaylistcontentss($this); - */ - } - return $this->aCcFiles; - } - - /** - * Declares an association between this object and a CcPlaylist object. - * - * @param CcPlaylist $v - * @return CcPlaylistcontents The current object (for fluent API support) - * @throws PropelException - */ - public function setCcPlaylist(CcPlaylist $v = null) - { - if ($v === null) { - $this->setDbPlaylistId(NULL); - } else { - $this->setDbPlaylistId($v->getDbId()); - } - - $this->aCcPlaylist = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcPlaylist object, it will not be re-added. - if ($v !== null) { - $v->addCcPlaylistcontents($this); - } - - return $this; - } - - - /** - * Get the associated CcPlaylist object - * - * @param PropelPDO Optional Connection object. - * @return CcPlaylist The associated CcPlaylist object. - * @throws PropelException - */ - public function getCcPlaylist(PropelPDO $con = null) - { - if ($this->aCcPlaylist === null && ($this->playlist_id !== null)) { - $this->aCcPlaylist = CcPlaylistQuery::create()->findPk($this->playlist_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcPlaylist->addCcPlaylistcontentss($this); - */ - } - return $this->aCcPlaylist; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->playlist_id = null; - $this->file_id = null; - $this->position = null; - $this->cliplength = null; - $this->cuein = null; - $this->cueout = null; - $this->fadein = null; - $this->fadeout = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCcFiles = null; - $this->aCcPlaylist = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcPlaylistcontents diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsPeer.php deleted file mode 100644 index 1d448bd34..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsPeer.php +++ /dev/null @@ -1,1395 +0,0 @@ - array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbCliplength' => 4, 'DbCuein' => 5, 'DbCueout' => 6, 'DbFadein' => 7, 'DbFadeout' => 8, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbCliplength' => 4, 'dbCuein' => 5, 'dbCueout' => 6, 'dbFadein' => 7, 'dbFadeout' => 8, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::CLIPLENGTH => 4, self::CUEIN => 5, self::CUEOUT => 6, self::FADEIN => 7, self::FADEOUT => 8, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'CLIPLENGTH' => 4, 'CUEIN' => 5, 'CUEOUT' => 6, 'FADEIN' => 7, 'FADEOUT' => 8, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'position' => 3, 'cliplength' => 4, 'cuein' => 5, 'cueout' => 6, 'fadein' => 7, 'fadeout' => 8, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcPlaylistcontentsPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcPlaylistcontentsPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcPlaylistcontentsPeer::ID); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::PLAYLIST_ID); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::FILE_ID); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::CLIPLENGTH); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEIN); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEOUT); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEIN); - $criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEOUT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.PLAYLIST_ID'); - $criteria->addSelectColumn($alias . '.FILE_ID'); - $criteria->addSelectColumn($alias . '.POSITION'); - $criteria->addSelectColumn($alias . '.CLIPLENGTH'); - $criteria->addSelectColumn($alias . '.CUEIN'); - $criteria->addSelectColumn($alias . '.CUEOUT'); - $criteria->addSelectColumn($alias . '.FADEIN'); - $criteria->addSelectColumn($alias . '.FADEOUT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcPlaylistcontents - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcPlaylistcontentsPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcPlaylistcontentsPeer::populateObjects(CcPlaylistcontentsPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcPlaylistcontents $value A CcPlaylistcontents object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcPlaylistcontents $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getDbId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcPlaylistcontents object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcPlaylistcontents) { - $key = (string) $value->getDbId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlaylistcontents object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcPlaylistcontents Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_playlistcontents - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcPlaylistcontentsPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcPlaylistcontentsPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcPlaylistcontents object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcPlaylistcontentsPeer::NUM_COLUMNS; - } else { - $cls = CcPlaylistcontentsPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcPlaylistcontentsPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcFiles table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcPlaylist table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcPlaylist(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcPlaylistcontents objects pre-filled with their CcFiles objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylistcontents objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistcontentsPeer::addSelectColumns($criteria); - $startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); - CcFilesPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcPlaylistcontentsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcFilesPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcFilesPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcFilesPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcFiles) - $obj2->addCcPlaylistcontents($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Selects a collection of CcPlaylistcontents objects pre-filled with their CcPlaylist objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylistcontents objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcPlaylist(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistcontentsPeer::addSelectColumns($criteria); - $startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); - CcPlaylistPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcPlaylistcontentsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcPlaylistPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcPlaylistPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcPlaylistPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcPlaylist) - $obj2->addCcPlaylistcontents($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylistcontents objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistcontentsPeer::addSelectColumns($criteria); - $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); - - CcFilesPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); - - CcPlaylistPeer::addSelectColumns($criteria); - $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPlaylistcontentsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcFiles rows - - $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcFilesPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcFilesPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcFilesPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles) - $obj2->addCcPlaylistcontents($obj1); - } // if joined row not null - - // Add objects for joined CcPlaylist rows - - $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3); - if ($key3 !== null) { - $obj3 = CcPlaylistPeer::getInstanceFromPool($key3); - if (!$obj3) { - - $cls = CcPlaylistPeer::getOMClass(false); - - $obj3 = new $cls(); - $obj3->hydrate($row, $startcol3); - CcPlaylistPeer::addInstanceToPool($obj3, $key3); - } // if obj3 loaded - - // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist) - $obj3->addCcPlaylistcontents($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcFiles table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Returns the number of rows matching criteria, joining the related CcPlaylist table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAllExceptCcPlaylist(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPlaylistcontentsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY should not affect count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects except CcFiles. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylistcontents objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistcontentsPeer::addSelectColumns($criteria); - $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); - - CcPlaylistPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPlaylistcontentsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcPlaylist rows - - $key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcPlaylistPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcPlaylistPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcPlaylistPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcPlaylist) - $obj2->addCcPlaylistcontents($obj1); - - } // if joined row is not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects except CcPlaylist. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPlaylistcontents objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAllExceptCcPlaylist(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - // $criteria->getDbName() will return the same object if not set to another value - // so == check is okay and faster - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPlaylistcontentsPeer::addSelectColumns($criteria); - $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); - - CcFilesPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); - - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPlaylistcontentsPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcFiles rows - - $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcFilesPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcFilesPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcFilesPeer::addInstanceToPool($obj2, $key2); - } // if $obj2 already loaded - - // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles) - $obj2->addCcPlaylistcontents($obj1); - - } // if joined row is not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcPlaylistcontentsPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcPlaylistcontentsPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcPlaylistcontentsTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcPlaylistcontentsPeer::CLASS_DEFAULT : CcPlaylistcontentsPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcPlaylistcontents or Criteria object. - * - * @param mixed $values Criteria or CcPlaylistcontents object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcPlaylistcontents object - } - - if ($criteria->containsKey(CcPlaylistcontentsPeer::ID) && $criteria->keyContainsValue(CcPlaylistcontentsPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistcontentsPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcPlaylistcontents or Criteria object. - * - * @param mixed $values Criteria or CcPlaylistcontents object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcPlaylistcontentsPeer::ID); - $value = $criteria->remove(CcPlaylistcontentsPeer::ID); - if ($value) { - $selectCriteria->add(CcPlaylistcontentsPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); - } - - } else { // $values is CcPlaylistcontents object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_playlistcontents table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcPlaylistcontentsPeer::TABLE_NAME, $con, CcPlaylistcontentsPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcPlaylistcontentsPeer::clearInstancePool(); - CcPlaylistcontentsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcPlaylistcontents or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcPlaylistcontents object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcPlaylistcontentsPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcPlaylistcontents) { // it's a model object - // invalidate the cache for this single object - CcPlaylistcontentsPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcPlaylistcontentsPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcPlaylistcontentsPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcPlaylistcontentsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcPlaylistcontents object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcPlaylistcontents $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcPlaylistcontents $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcPlaylistcontentsPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcPlaylistcontentsPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcPlaylistcontentsPeer::DATABASE_NAME, CcPlaylistcontentsPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcPlaylistcontents - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); - $criteria->add(CcPlaylistcontentsPeer::ID, $pk); - - $v = CcPlaylistcontentsPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); - $criteria->add(CcPlaylistcontentsPeer::ID, $pks, Criteria::IN); - $objs = CcPlaylistcontentsPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcPlaylistcontentsPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcPlaylistcontentsPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsQuery.php deleted file mode 100644 index 183fa9a4f..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPlaylistcontentsQuery.php +++ /dev/null @@ -1,581 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcPlaylistcontents|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $dbId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbId($dbId = null, $comparison = null) - { - if (is_array($dbId) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId, $comparison); - } - - /** - * Filter the query on the playlist_id column - * - * @param int|array $dbPlaylistId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null) - { - if (is_array($dbPlaylistId)) { - $useMinMax = false; - if (isset($dbPlaylistId['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbPlaylistId['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId, $comparison); - } - - /** - * Filter the query on the file_id column - * - * @param int|array $dbFileId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbFileId($dbFileId = null, $comparison = null) - { - if (is_array($dbFileId)) { - $useMinMax = false; - if (isset($dbFileId['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbFileId['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId, $comparison); - } - - /** - * Filter the query on the position column - * - * @param int|array $dbPosition The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbPosition($dbPosition = null, $comparison = null) - { - if (is_array($dbPosition)) { - $useMinMax = false; - if (isset($dbPosition['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbPosition['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition, $comparison); - } - - /** - * Filter the query on the cliplength column - * - * @param string|array $dbCliplength The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbCliplength($dbCliplength = null, $comparison = null) - { - if (is_array($dbCliplength)) { - $useMinMax = false; - if (isset($dbCliplength['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbCliplength['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison); - } - - /** - * Filter the query on the cuein column - * - * @param string|array $dbCuein The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbCuein($dbCuein = null, $comparison = null) - { - if (is_array($dbCuein)) { - $useMinMax = false; - if (isset($dbCuein['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbCuein['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison); - } - - /** - * Filter the query on the cueout column - * - * @param string|array $dbCueout The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbCueout($dbCueout = null, $comparison = null) - { - if (is_array($dbCueout)) { - $useMinMax = false; - if (isset($dbCueout['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbCueout['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison); - } - - /** - * Filter the query on the fadein column - * - * @param string|array $dbFadein The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbFadein($dbFadein = null, $comparison = null) - { - if (is_array($dbFadein)) { - $useMinMax = false; - if (isset($dbFadein['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbFadein['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein, $comparison); - } - - /** - * Filter the query on the fadeout column - * - * @param string|array $dbFadeout The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByDbFadeout($dbFadeout = null, $comparison = null) - { - if (is_array($dbFadeout)) { - $useMinMax = false; - if (isset($dbFadeout['min'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($dbFadeout['max'])) { - $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout, $comparison); - } - - /** - * Filter the query by a related CcFiles object - * - * @param CcFiles $ccFiles the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByCcFiles($ccFiles, $comparison = null) - { - return $this - ->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcFiles relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcFiles'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcFiles'); - } - - return $this; - } - - /** - * Use the CcFiles relation CcFiles object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcFilesQuery A secondary query class using the current class as primary query - */ - public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcFiles($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); - } - - /** - * Filter the query by a related CcPlaylist object - * - * @param CcPlaylist $ccPlaylist the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function filterByCcPlaylist($ccPlaylist, $comparison = null) - { - return $this - ->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->getDbId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPlaylist relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function joinCcPlaylist($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPlaylist'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPlaylist'); - } - - return $this; - } - - /** - * Use the CcPlaylist relation CcPlaylist object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistQuery A secondary query class using the current class as primary query - */ - public function useCcPlaylistQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPlaylist($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery'); - } - - /** - * Exclude object from result - * - * @param CcPlaylistcontents $ccPlaylistcontents Object to remove from the list of results - * - * @return CcPlaylistcontentsQuery The current query, for fluid interface - */ - public function prune($ccPlaylistcontents = null) - { - if ($ccPlaylistcontents) { - $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $ccPlaylistcontents->getDbId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcPlaylistcontentsQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPref.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPref.php deleted file mode 100644 index d1f07c596..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPref.php +++ /dev/null @@ -1,905 +0,0 @@ -id; - } - - /** - * Get the [subjid] column value. - * - * @return int - */ - public function getSubjid() - { - return $this->subjid; - } - - /** - * Get the [keystr] column value. - * - * @return string - */ - public function getKeystr() - { - return $this->keystr; - } - - /** - * Get the [valstr] column value. - * - * @return string - */ - public function getValstr() - { - return $this->valstr; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcPref The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcPrefPeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [subjid] column. - * - * @param int $v new value - * @return CcPref The current object (for fluent API support) - */ - public function setSubjid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->subjid !== $v) { - $this->subjid = $v; - $this->modifiedColumns[] = CcPrefPeer::SUBJID; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setSubjid() - - /** - * Set the value of [keystr] column. - * - * @param string $v new value - * @return CcPref The current object (for fluent API support) - */ - public function setKeystr($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->keystr !== $v) { - $this->keystr = $v; - $this->modifiedColumns[] = CcPrefPeer::KEYSTR; - } - - return $this; - } // setKeystr() - - /** - * Set the value of [valstr] column. - * - * @param string $v new value - * @return CcPref The current object (for fluent API support) - */ - public function setValstr($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->valstr !== $v) { - $this->valstr = $v; - $this->modifiedColumns[] = CcPrefPeer::VALSTR; - } - - return $this; - } // setValstr() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->subjid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->keystr = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->valstr = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 4; // 4 = CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcPref object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->subjid !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcPrefPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcPrefQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcPrefPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcPrefPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcPrefPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPrefPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows += CcPrefPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcPrefPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPrefPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getSubjid(); - break; - case 2: - return $this->getKeystr(); - break; - case 3: - return $this->getValstr(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcPrefPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getSubjid(), - $keys[2] => $this->getKeystr(), - $keys[3] => $this->getValstr(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcPrefPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setSubjid($value); - break; - case 2: - $this->setKeystr($value); - break; - case 3: - $this->setValstr($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcPrefPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setSubjid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setKeystr($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setValstr($arr[$keys[3]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcPrefPeer::ID)) $criteria->add(CcPrefPeer::ID, $this->id); - if ($this->isColumnModified(CcPrefPeer::SUBJID)) $criteria->add(CcPrefPeer::SUBJID, $this->subjid); - if ($this->isColumnModified(CcPrefPeer::KEYSTR)) $criteria->add(CcPrefPeer::KEYSTR, $this->keystr); - if ($this->isColumnModified(CcPrefPeer::VALSTR)) $criteria->add(CcPrefPeer::VALSTR, $this->valstr); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); - $criteria->add(CcPrefPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcPref (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setSubjid($this->subjid); - $copyObj->setKeystr($this->keystr); - $copyObj->setValstr($this->valstr); - - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcPref Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcPrefPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcPrefPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcPref The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setSubjid(NULL); - } else { - $this->setSubjid($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcPref($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->subjid !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subjid, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcPrefs($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->subjid = null; - $this->keystr = null; - $this->valstr = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcPref diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPrefPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPrefPeer.php deleted file mode 100644 index 8356fed9a..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPrefPeer.php +++ /dev/null @@ -1,983 +0,0 @@ - array ('Id', 'Subjid', 'Keystr', 'Valstr', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'subjid', 'keystr', 'valstr', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::SUBJID, self::KEYSTR, self::VALSTR, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SUBJID', 'KEYSTR', 'VALSTR', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'subjid', 'keystr', 'valstr', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Subjid' => 1, 'Keystr' => 2, 'Valstr' => 3, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'subjid' => 1, 'keystr' => 2, 'valstr' => 3, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SUBJID => 1, self::KEYSTR => 2, self::VALSTR => 3, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SUBJID' => 1, 'KEYSTR' => 2, 'VALSTR' => 3, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'subjid' => 1, 'keystr' => 2, 'valstr' => 3, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcPrefPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcPrefPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcPrefPeer::ID); - $criteria->addSelectColumn(CcPrefPeer::SUBJID); - $criteria->addSelectColumn(CcPrefPeer::KEYSTR); - $criteria->addSelectColumn(CcPrefPeer::VALSTR); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.SUBJID'); - $criteria->addSelectColumn($alias . '.KEYSTR'); - $criteria->addSelectColumn($alias . '.VALSTR'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPrefPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcPref - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcPrefPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcPrefPeer::populateObjects(CcPrefPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcPrefPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcPref $value A CcPref object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcPref $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcPref object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcPref) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPref object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcPref Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_pref - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcPrefPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcPrefPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcPrefPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcPref object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcPrefPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcPrefPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcPrefPeer::NUM_COLUMNS; - } else { - $cls = CcPrefPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcPrefPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPrefPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcPref objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPref objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPrefPeer::addSelectColumns($criteria); - $startcol = (CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPrefPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcPrefPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPrefPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcPref) to $obj2 (CcSubjs) - $obj2->addCcPref($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcPrefPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcPref objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcPref objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcPrefPeer::addSelectColumns($criteria); - $startcol2 = (CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcPrefPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcPrefPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcPrefPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcPref) to the collection in $obj2 (CcSubjs) - $obj2->addCcPref($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcPrefPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcPrefPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcPrefTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcPrefPeer::CLASS_DEFAULT : CcPrefPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcPref or Criteria object. - * - * @param mixed $values Criteria or CcPref object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcPref object - } - - if ($criteria->containsKey(CcPrefPeer::ID) && $criteria->keyContainsValue(CcPrefPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPrefPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcPref or Criteria object. - * - * @param mixed $values Criteria or CcPref object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcPrefPeer::ID); - $value = $criteria->remove(CcPrefPeer::ID); - if ($value) { - $selectCriteria->add(CcPrefPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); - } - - } else { // $values is CcPref object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_pref table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcPrefPeer::TABLE_NAME, $con, CcPrefPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcPrefPeer::clearInstancePool(); - CcPrefPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcPref or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcPref object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcPrefPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcPref) { // it's a model object - // invalidate the cache for this single object - CcPrefPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcPrefPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcPrefPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcPrefPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcPref object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcPref $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcPref $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcPrefPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcPrefPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcPrefPeer::DATABASE_NAME, CcPrefPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcPref - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); - $criteria->add(CcPrefPeer::ID, $pk); - - $v = CcPrefPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); - $criteria->add(CcPrefPeer::ID, $pks, Criteria::IN); - $objs = CcPrefPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcPrefPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcPrefPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcPrefQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcPrefQuery.php deleted file mode 100644 index e85c52a36..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcPrefQuery.php +++ /dev/null @@ -1,320 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcPref|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcPrefPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcPrefPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcPrefPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the subjid column - * - * @param int|array $subjid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterBySubjid($subjid = null, $comparison = null) - { - if (is_array($subjid)) { - $useMinMax = false; - if (isset($subjid['min'])) { - $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($subjid['max'])) { - $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid, $comparison); - } - - /** - * Filter the query on the keystr column - * - * @param string $keystr The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterByKeystr($keystr = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($keystr)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $keystr)) { - $keystr = str_replace('*', '%', $keystr); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPrefPeer::KEYSTR, $keystr, $comparison); - } - - /** - * Filter the query on the valstr column - * - * @param string $valstr The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterByValstr($valstr = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($valstr)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $valstr)) { - $valstr = str_replace('*', '%', $valstr); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcPrefPeer::VALSTR, $valstr, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcPrefPeer::SUBJID, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Exclude object from result - * - * @param CcPref $ccPref Object to remove from the list of results - * - * @return CcPrefQuery The current query, for fluid interface - */ - public function prune($ccPref = null) - { - if ($ccPref) { - $this->addUsingAlias(CcPrefPeer::ID, $ccPref->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcPrefQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSchedule.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSchedule.php deleted file mode 100644 index 39bad3761..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSchedule.php +++ /dev/null @@ -1,1560 +0,0 @@ -clip_length = '00:00:00'; - $this->fade_in = '00:00:00'; - $this->fade_out = '00:00:00'; - $this->cue_in = '00:00:00'; - $this->cue_out = '00:00:00'; - } - - /** - * Initializes internal state of BaseCcSchedule object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * Get the [playlist_id] column value. - * - * @return int - */ - public function getPlaylistId() - { - return $this->playlist_id; - } - - /** - * Get the [optionally formatted] temporal [starts] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getStarts($format = 'Y-m-d H:i:s') - { - if ($this->starts === null) { - return null; - } - - - - try { - $dt = new DateTime($this->starts); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [ends] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getEnds($format = 'Y-m-d H:i:s') - { - if ($this->ends === null) { - return null; - } - - - - try { - $dt = new DateTime($this->ends); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [group_id] column value. - * - * @return int - */ - public function getGroupId() - { - return $this->group_id; - } - - /** - * Get the [file_id] column value. - * - * @return int - */ - public function getFileId() - { - return $this->file_id; - } - - /** - * Get the [optionally formatted] temporal [clip_length] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getClipLength($format = '%X') - { - if ($this->clip_length === null) { - return null; - } - - - - try { - $dt = new DateTime($this->clip_length); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->clip_length, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [fade_in] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getFadeIn($format = '%X') - { - if ($this->fade_in === null) { - return null; - } - - - - try { - $dt = new DateTime($this->fade_in); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_in, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [fade_out] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getFadeOut($format = '%X') - { - if ($this->fade_out === null) { - return null; - } - - - - try { - $dt = new DateTime($this->fade_out); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_out, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [cue_in] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCueIn($format = '%X') - { - if ($this->cue_in === null) { - return null; - } - - - - try { - $dt = new DateTime($this->cue_in); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_in, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [cue_out] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getCueOut($format = '%X') - { - if ($this->cue_out === null) { - return null; - } - - - - try { - $dt = new DateTime($this->cue_out); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_out, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param string $v new value - * @return CcSchedule The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcSchedulePeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [playlist_id] column. - * - * @param int $v new value - * @return CcSchedule The current object (for fluent API support) - */ - public function setPlaylistId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->playlist_id !== $v) { - $this->playlist_id = $v; - $this->modifiedColumns[] = CcSchedulePeer::PLAYLIST_ID; - } - - return $this; - } // setPlaylistId() - - /** - * Sets the value of [starts] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setStarts($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->starts !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->starts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcSchedulePeer::STARTS; - } - } // if either are not null - - return $this; - } // setStarts() - - /** - * Sets the value of [ends] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setEnds($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->ends !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->ends = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcSchedulePeer::ENDS; - } - } // if either are not null - - return $this; - } // setEnds() - - /** - * Set the value of [group_id] column. - * - * @param int $v new value - * @return CcSchedule The current object (for fluent API support) - */ - public function setGroupId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->group_id !== $v) { - $this->group_id = $v; - $this->modifiedColumns[] = CcSchedulePeer::GROUP_ID; - } - - return $this; - } // setGroupId() - - /** - * Set the value of [file_id] column. - * - * @param int $v new value - * @return CcSchedule The current object (for fluent API support) - */ - public function setFileId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->file_id !== $v) { - $this->file_id = $v; - $this->modifiedColumns[] = CcSchedulePeer::FILE_ID; - } - - return $this; - } // setFileId() - - /** - * Sets the value of [clip_length] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setClipLength($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->clip_length !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->clip_length !== null && $tmpDt = new DateTime($this->clip_length)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->clip_length = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH; - } - } // if either are not null - - return $this; - } // setClipLength() - - /** - * Sets the value of [fade_in] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setFadeIn($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->fade_in !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->fade_in !== null && $tmpDt = new DateTime($this->fade_in)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->fade_in = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcSchedulePeer::FADE_IN; - } - } // if either are not null - - return $this; - } // setFadeIn() - - /** - * Sets the value of [fade_out] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setFadeOut($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->fade_out !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->fade_out !== null && $tmpDt = new DateTime($this->fade_out)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->fade_out = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT; - } - } // if either are not null - - return $this; - } // setFadeOut() - - /** - * Sets the value of [cue_in] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setCueIn($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->cue_in !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->cue_in !== null && $tmpDt = new DateTime($this->cue_in)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->cue_in = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcSchedulePeer::CUE_IN; - } - } // if either are not null - - return $this; - } // setCueIn() - - /** - * Sets the value of [cue_out] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSchedule The current object (for fluent API support) - */ - public function setCueOut($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->cue_out !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->cue_out !== null && $tmpDt = new DateTime($this->cue_out)) ? $tmpDt->format('H:i:s') : null; - $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default - ) - { - $this->cue_out = ($dt ? $dt->format('H:i:s') : null); - $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT; - } - } // if either are not null - - return $this; - } // setCueOut() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->clip_length !== '00:00:00') { - return false; - } - - if ($this->fade_in !== '00:00:00') { - return false; - } - - if ($this->fade_out !== '00:00:00') { - return false; - } - - if ($this->cue_in !== '00:00:00') { - return false; - } - - if ($this->cue_out !== '00:00:00') { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; - $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; - $this->file_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; - $this->clip_length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->fade_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->fade_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->cue_in = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcSchedule object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcSchedulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcScheduleQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcSchedulePeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setNew(false); - } else { - $affectedRows = CcSchedulePeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getPlaylistId(); - break; - case 2: - return $this->getStarts(); - break; - case 3: - return $this->getEnds(); - break; - case 4: - return $this->getGroupId(); - break; - case 5: - return $this->getFileId(); - break; - case 6: - return $this->getClipLength(); - break; - case 7: - return $this->getFadeIn(); - break; - case 8: - return $this->getFadeOut(); - break; - case 9: - return $this->getCueIn(); - break; - case 10: - return $this->getCueOut(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) - { - $keys = CcSchedulePeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getPlaylistId(), - $keys[2] => $this->getStarts(), - $keys[3] => $this->getEnds(), - $keys[4] => $this->getGroupId(), - $keys[5] => $this->getFileId(), - $keys[6] => $this->getClipLength(), - $keys[7] => $this->getFadeIn(), - $keys[8] => $this->getFadeOut(), - $keys[9] => $this->getCueIn(), - $keys[10] => $this->getCueOut(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setPlaylistId($value); - break; - case 2: - $this->setStarts($value); - break; - case 3: - $this->setEnds($value); - break; - case 4: - $this->setGroupId($value); - break; - case 5: - $this->setFileId($value); - break; - case 6: - $this->setClipLength($value); - break; - case 7: - $this->setFadeIn($value); - break; - case 8: - $this->setFadeOut($value); - break; - case 9: - $this->setCueIn($value); - break; - case 10: - $this->setCueOut($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcSchedulePeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setPlaylistId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setStarts($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setEnds($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setGroupId($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setFileId($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setClipLength($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setFadeIn($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setFadeOut($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setCueIn($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setCueOut($arr[$keys[10]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); - - if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id); - if ($this->isColumnModified(CcSchedulePeer::PLAYLIST_ID)) $criteria->add(CcSchedulePeer::PLAYLIST_ID, $this->playlist_id); - if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts); - if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends); - if ($this->isColumnModified(CcSchedulePeer::GROUP_ID)) $criteria->add(CcSchedulePeer::GROUP_ID, $this->group_id); - if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id); - if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length); - if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in); - if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out); - if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in); - if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); - $criteria->add(CcSchedulePeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return string - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param string $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcSchedule (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setId($this->id); - $copyObj->setPlaylistId($this->playlist_id); - $copyObj->setStarts($this->starts); - $copyObj->setEnds($this->ends); - $copyObj->setGroupId($this->group_id); - $copyObj->setFileId($this->file_id); - $copyObj->setClipLength($this->clip_length); - $copyObj->setFadeIn($this->fade_in); - $copyObj->setFadeOut($this->fade_out); - $copyObj->setCueIn($this->cue_in); - $copyObj->setCueOut($this->cue_out); - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcSchedule Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcSchedulePeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcSchedulePeer(); - } - return self::$peer; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->playlist_id = null; - $this->starts = null; - $this->ends = null; - $this->group_id = null; - $this->file_id = null; - $this->clip_length = null; - $this->fade_in = null; - $this->fade_out = null; - $this->cue_in = null; - $this->cue_out = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcSchedule diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSchedulePeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSchedulePeer.php deleted file mode 100644 index c62a304c7..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSchedulePeer.php +++ /dev/null @@ -1,780 +0,0 @@ - array ('Id', 'PlaylistId', 'Starts', 'Ends', 'GroupId', 'FileId', 'ClipLength', 'FadeIn', 'FadeOut', 'CueIn', 'CueOut', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'playlistId', 'starts', 'ends', 'groupId', 'fileId', 'clipLength', 'fadeIn', 'fadeOut', 'cueIn', 'cueOut', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'PlaylistId' => 1, 'Starts' => 2, 'Ends' => 3, 'GroupId' => 4, 'FileId' => 5, 'ClipLength' => 6, 'FadeIn' => 7, 'FadeOut' => 8, 'CueIn' => 9, 'CueOut' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'playlistId' => 1, 'starts' => 2, 'ends' => 3, 'groupId' => 4, 'fileId' => 5, 'clipLength' => 6, 'fadeIn' => 7, 'fadeOut' => 8, 'cueIn' => 9, 'cueOut' => 10, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcSchedulePeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcSchedulePeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcSchedulePeer::ID); - $criteria->addSelectColumn(CcSchedulePeer::PLAYLIST_ID); - $criteria->addSelectColumn(CcSchedulePeer::STARTS); - $criteria->addSelectColumn(CcSchedulePeer::ENDS); - $criteria->addSelectColumn(CcSchedulePeer::GROUP_ID); - $criteria->addSelectColumn(CcSchedulePeer::FILE_ID); - $criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH); - $criteria->addSelectColumn(CcSchedulePeer::FADE_IN); - $criteria->addSelectColumn(CcSchedulePeer::FADE_OUT); - $criteria->addSelectColumn(CcSchedulePeer::CUE_IN); - $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.PLAYLIST_ID'); - $criteria->addSelectColumn($alias . '.STARTS'); - $criteria->addSelectColumn($alias . '.ENDS'); - $criteria->addSelectColumn($alias . '.GROUP_ID'); - $criteria->addSelectColumn($alias . '.FILE_ID'); - $criteria->addSelectColumn($alias . '.CLIP_LENGTH'); - $criteria->addSelectColumn($alias . '.FADE_IN'); - $criteria->addSelectColumn($alias . '.FADE_OUT'); - $criteria->addSelectColumn($alias . '.CUE_IN'); - $criteria->addSelectColumn($alias . '.CUE_OUT'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSchedulePeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcSchedule - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcSchedulePeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcSchedulePeer::populateObjects(CcSchedulePeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcSchedulePeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcSchedule $value A CcSchedule object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcSchedule $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcSchedule object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcSchedule) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSchedule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcSchedule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_schedule - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (string) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcSchedulePeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcSchedulePeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcSchedule object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcSchedulePeer::NUM_COLUMNS; - } else { - $cls = CcSchedulePeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcSchedulePeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcSchedulePeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcSchedulePeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcScheduleTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcSchedulePeer::CLASS_DEFAULT : CcSchedulePeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcSchedule or Criteria object. - * - * @param mixed $values Criteria or CcSchedule object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcSchedule object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcSchedule or Criteria object. - * - * @param mixed $values Criteria or CcSchedule object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcSchedulePeer::ID); - $value = $criteria->remove(CcSchedulePeer::ID); - if ($value) { - $selectCriteria->add(CcSchedulePeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); - } - - } else { // $values is CcSchedule object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_schedule table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcSchedulePeer::TABLE_NAME, $con, CcSchedulePeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcSchedulePeer::clearInstancePool(); - CcSchedulePeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcSchedule or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcSchedule object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcSchedulePeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcSchedule) { // it's a model object - // invalidate the cache for this single object - CcSchedulePeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcSchedulePeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcSchedulePeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcSchedulePeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcSchedule object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcSchedule $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcSchedule $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcSchedulePeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcSchedulePeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcSchedulePeer::DATABASE_NAME, CcSchedulePeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param string $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcSchedule - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); - $criteria->add(CcSchedulePeer::ID, $pk); - - $v = CcSchedulePeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); - $criteria->add(CcSchedulePeer::ID, $pks, Criteria::IN); - $objs = CcSchedulePeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcSchedulePeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcSchedulePeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcScheduleQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcScheduleQuery.php deleted file mode 100644 index 22435bf77..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcScheduleQuery.php +++ /dev/null @@ -1,515 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcSchedule|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcSchedulePeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcSchedulePeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param string|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcSchedulePeer::ID, $id, $comparison); - } - - /** - * Filter the query on the playlist_id column - * - * @param int|array $playlistId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByPlaylistId($playlistId = null, $comparison = null) - { - if (is_array($playlistId)) { - $useMinMax = false; - if (isset($playlistId['min'])) { - $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($playlistId['max'])) { - $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId, $comparison); - } - - /** - * Filter the query on the starts column - * - * @param string|array $starts The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByStarts($starts = null, $comparison = null) - { - if (is_array($starts)) { - $useMinMax = false; - if (isset($starts['min'])) { - $this->addUsingAlias(CcSchedulePeer::STARTS, $starts['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($starts['max'])) { - $this->addUsingAlias(CcSchedulePeer::STARTS, $starts['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::STARTS, $starts, $comparison); - } - - /** - * Filter the query on the ends column - * - * @param string|array $ends The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByEnds($ends = null, $comparison = null) - { - if (is_array($ends)) { - $useMinMax = false; - if (isset($ends['min'])) { - $this->addUsingAlias(CcSchedulePeer::ENDS, $ends['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($ends['max'])) { - $this->addUsingAlias(CcSchedulePeer::ENDS, $ends['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::ENDS, $ends, $comparison); - } - - /** - * Filter the query on the group_id column - * - * @param int|array $groupId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByGroupId($groupId = null, $comparison = null) - { - if (is_array($groupId)) { - $useMinMax = false; - if (isset($groupId['min'])) { - $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($groupId['max'])) { - $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId, $comparison); - } - - /** - * Filter the query on the file_id column - * - * @param int|array $fileId The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByFileId($fileId = null, $comparison = null) - { - if (is_array($fileId)) { - $useMinMax = false; - if (isset($fileId['min'])) { - $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($fileId['max'])) { - $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId, $comparison); - } - - /** - * Filter the query on the clip_length column - * - * @param string|array $clipLength The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByClipLength($clipLength = null, $comparison = null) - { - if (is_array($clipLength)) { - $useMinMax = false; - if (isset($clipLength['min'])) { - $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($clipLength['max'])) { - $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength, $comparison); - } - - /** - * Filter the query on the fade_in column - * - * @param string|array $fadeIn The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByFadeIn($fadeIn = null, $comparison = null) - { - if (is_array($fadeIn)) { - $useMinMax = false; - if (isset($fadeIn['min'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($fadeIn['max'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn, $comparison); - } - - /** - * Filter the query on the fade_out column - * - * @param string|array $fadeOut The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByFadeOut($fadeOut = null, $comparison = null) - { - if (is_array($fadeOut)) { - $useMinMax = false; - if (isset($fadeOut['min'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($fadeOut['max'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut, $comparison); - } - - /** - * Filter the query on the cue_in column - * - * @param string|array $cueIn The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByCueIn($cueIn = null, $comparison = null) - { - if (is_array($cueIn)) { - $useMinMax = false; - if (isset($cueIn['min'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($cueIn['max'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn, $comparison); - } - - /** - * Filter the query on the cue_out column - * - * @param string|array $cueOut The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function filterByCueOut($cueOut = null, $comparison = null) - { - if (is_array($cueOut)) { - $useMinMax = false; - if (isset($cueOut['min'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($cueOut['max'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut, $comparison); - } - - /** - * Exclude object from result - * - * @param CcSchedule $ccSchedule Object to remove from the list of results - * - * @return CcScheduleQuery The current query, for fluid interface - */ - public function prune($ccSchedule = null) - { - if ($ccSchedule) { - $this->addUsingAlias(CcSchedulePeer::ID, $ccSchedule->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcScheduleQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSess.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSess.php deleted file mode 100644 index a68aa8e12..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSess.php +++ /dev/null @@ -1,949 +0,0 @@ -sessid; - } - - /** - * Get the [userid] column value. - * - * @return int - */ - public function getUserid() - { - return $this->userid; - } - - /** - * Get the [login] column value. - * - * @return string - */ - public function getLogin() - { - return $this->login; - } - - /** - * Get the [optionally formatted] temporal [ts] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getTs($format = 'Y-m-d H:i:s') - { - if ($this->ts === null) { - return null; - } - - - - try { - $dt = new DateTime($this->ts); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [sessid] column. - * - * @param string $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setSessid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->sessid !== $v) { - $this->sessid = $v; - $this->modifiedColumns[] = CcSessPeer::SESSID; - } - - return $this; - } // setSessid() - - /** - * Set the value of [userid] column. - * - * @param int $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setUserid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->userid !== $v) { - $this->userid = $v; - $this->modifiedColumns[] = CcSessPeer::USERID; - } - - if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) { - $this->aCcSubjs = null; - } - - return $this; - } // setUserid() - - /** - * Set the value of [login] column. - * - * @param string $v new value - * @return CcSess The current object (for fluent API support) - */ - public function setLogin($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->login !== $v) { - $this->login = $v; - $this->modifiedColumns[] = CcSessPeer::LOGIN; - } - - return $this; - } // setLogin() - - /** - * Sets the value of [ts] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSess The current object (for fluent API support) - */ - public function setTs($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->ts !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcSessPeer::TS; - } - } // if either are not null - - return $this; - } // setTs() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->sessid = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; - $this->userid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->login = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->ts = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 4; // 4 = CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcSess object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - if ($this->aCcSubjs !== null && $this->userid !== $this->aCcSubjs->getId()) { - $this->aCcSubjs = null; - } - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcSessPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->aCcSubjs = null; - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcSessQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcSessPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - // We call the save method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { - $affectedRows += $this->aCcSubjs->save($con); - } - $this->setCcSubjs($this->aCcSubjs); - } - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows += 1; - $this->setNew(false); - } else { - $affectedRows += CcSessPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - // We call the validate method on the following object(s) if they - // were passed to this object by their coresponding set - // method. This object relates to these object(s) by a - // foreign key reference. - - if ($this->aCcSubjs !== null) { - if (!$this->aCcSubjs->validate($columns)) { - $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); - } - } - - - if (($retval = CcSessPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getSessid(); - break; - case 1: - return $this->getUserid(); - break; - case 2: - return $this->getLogin(); - break; - case 3: - return $this->getTs(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) - { - $keys = CcSessPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getSessid(), - $keys[1] => $this->getUserid(), - $keys[2] => $this->getLogin(), - $keys[3] => $this->getTs(), - ); - if ($includeForeignObjects) { - if (null !== $this->aCcSubjs) { - $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); - } - } - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setSessid($value); - break; - case 1: - $this->setUserid($value); - break; - case 2: - $this->setLogin($value); - break; - case 3: - $this->setTs($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcSessPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setSessid($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setUserid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setLogin($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTs($arr[$keys[3]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcSessPeer::SESSID)) $criteria->add(CcSessPeer::SESSID, $this->sessid); - if ($this->isColumnModified(CcSessPeer::USERID)) $criteria->add(CcSessPeer::USERID, $this->userid); - if ($this->isColumnModified(CcSessPeer::LOGIN)) $criteria->add(CcSessPeer::LOGIN, $this->login); - if ($this->isColumnModified(CcSessPeer::TS)) $criteria->add(CcSessPeer::TS, $this->ts); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $this->sessid); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return string - */ - public function getPrimaryKey() - { - return $this->getSessid(); - } - - /** - * Generic method to set the primary key (sessid column). - * - * @param string $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setSessid($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getSessid(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcSess (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setSessid($this->sessid); - $copyObj->setUserid($this->userid); - $copyObj->setLogin($this->login); - $copyObj->setTs($this->ts); - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcSess Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcSessPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcSessPeer(); - } - return self::$peer; - } - - /** - * Declares an association between this object and a CcSubjs object. - * - * @param CcSubjs $v - * @return CcSess The current object (for fluent API support) - * @throws PropelException - */ - public function setCcSubjs(CcSubjs $v = null) - { - if ($v === null) { - $this->setUserid(NULL); - } else { - $this->setUserid($v->getId()); - } - - $this->aCcSubjs = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the CcSubjs object, it will not be re-added. - if ($v !== null) { - $v->addCcSess($this); - } - - return $this; - } - - - /** - * Get the associated CcSubjs object - * - * @param PropelPDO Optional Connection object. - * @return CcSubjs The associated CcSubjs object. - * @throws PropelException - */ - public function getCcSubjs(PropelPDO $con = null) - { - if ($this->aCcSubjs === null && ($this->userid !== null)) { - $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->userid, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCcSubjs->addCcSesss($this); - */ - } - return $this->aCcSubjs; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->sessid = null; - $this->userid = null; - $this->login = null; - $this->ts = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - $this->aCcSubjs = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcSess diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSessPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSessPeer.php deleted file mode 100644 index 0ca095e21..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSessPeer.php +++ /dev/null @@ -1,979 +0,0 @@ - array ('Sessid', 'Userid', 'Login', 'Ts', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('sessid', 'userid', 'login', 'ts', ), - BasePeer::TYPE_COLNAME => array (self::SESSID, self::USERID, self::LOGIN, self::TS, ), - BasePeer::TYPE_RAW_COLNAME => array ('SESSID', 'USERID', 'LOGIN', 'TS', ), - BasePeer::TYPE_FIELDNAME => array ('sessid', 'userid', 'login', 'ts', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Sessid' => 0, 'Userid' => 1, 'Login' => 2, 'Ts' => 3, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), - BasePeer::TYPE_COLNAME => array (self::SESSID => 0, self::USERID => 1, self::LOGIN => 2, self::TS => 3, ), - BasePeer::TYPE_RAW_COLNAME => array ('SESSID' => 0, 'USERID' => 1, 'LOGIN' => 2, 'TS' => 3, ), - BasePeer::TYPE_FIELDNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcSessPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcSessPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcSessPeer::SESSID); - $criteria->addSelectColumn(CcSessPeer::USERID); - $criteria->addSelectColumn(CcSessPeer::LOGIN); - $criteria->addSelectColumn(CcSessPeer::TS); - } else { - $criteria->addSelectColumn($alias . '.SESSID'); - $criteria->addSelectColumn($alias . '.USERID'); - $criteria->addSelectColumn($alias . '.LOGIN'); - $criteria->addSelectColumn($alias . '.TS'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcSess - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcSessPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcSessPeer::populateObjects(CcSessPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcSessPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcSess $value A CcSess object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcSess $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getSessid(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcSess object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcSess) { - $key = (string) $value->getSessid(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSess object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcSess Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_sess - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (string) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcSessPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcSessPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcSess object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcSessPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcSessPeer::NUM_COLUMNS; - } else { - $cls = CcSessPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcSessPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - - /** - * Returns the number of rows matching criteria, joining the related CcSubjs table - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - - /** - * Selects a collection of CcSess objects pre-filled with their CcSubjs objects. - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcSess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcSessPeer::addSelectColumns($criteria); - $startcol = (CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS); - CcSubjsPeer::addSelectColumns($criteria); - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - - $cls = CcSessPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcSessPeer::addInstanceToPool($obj1, $key1); - } // if $obj1 already loaded - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 already loaded - - // Add the $obj1 (CcSess) to $obj2 (CcSubjs) - $obj2->addCcSess($obj1); - - } // if joined row was not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - - /** - * Returns the number of rows matching criteria, joining all related tables - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return int Number of matching rows. - */ - public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - // we're going to modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSessPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - - /** - * Selects a collection of CcSess objects pre-filled with all related objects. - * - * @param Criteria $criteria - * @param PropelPDO $con - * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN - * @return array Array of CcSess objects. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) - { - $criteria = clone $criteria; - - // Set the correct dbName if it has not been overridden - if ($criteria->getDbName() == Propel::getDefaultDB()) { - $criteria->setDbName(self::DATABASE_NAME); - } - - CcSessPeer::addSelectColumns($criteria); - $startcol2 = (CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS); - - CcSubjsPeer::addSelectColumns($criteria); - $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); - - $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); - - $stmt = BasePeer::doSelect($criteria, $con); - $results = array(); - - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj1->hydrate($row, 0, true); // rehydrate - } else { - $cls = CcSessPeer::getOMClass(false); - - $obj1 = new $cls(); - $obj1->hydrate($row); - CcSessPeer::addInstanceToPool($obj1, $key1); - } // if obj1 already loaded - - // Add objects for joined CcSubjs rows - - $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); - if ($key2 !== null) { - $obj2 = CcSubjsPeer::getInstanceFromPool($key2); - if (!$obj2) { - - $cls = CcSubjsPeer::getOMClass(false); - - $obj2 = new $cls(); - $obj2->hydrate($row, $startcol2); - CcSubjsPeer::addInstanceToPool($obj2, $key2); - } // if obj2 loaded - - // Add the $obj1 (CcSess) to the collection in $obj2 (CcSubjs) - $obj2->addCcSess($obj1); - } // if joined row not null - - $results[] = $obj1; - } - $stmt->closeCursor(); - return $results; - } - - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcSessPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcSessPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcSessTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcSessPeer::CLASS_DEFAULT : CcSessPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcSess or Criteria object. - * - * @param mixed $values Criteria or CcSess object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcSess object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcSess or Criteria object. - * - * @param mixed $values Criteria or CcSess object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcSessPeer::SESSID); - $value = $criteria->remove(CcSessPeer::SESSID); - if ($value) { - $selectCriteria->add(CcSessPeer::SESSID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); - } - - } else { // $values is CcSess object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_sess table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcSessPeer::TABLE_NAME, $con, CcSessPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcSessPeer::clearInstancePool(); - CcSessPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcSess or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcSess object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcSessPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcSess) { // it's a model object - // invalidate the cache for this single object - CcSessPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcSessPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcSessPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcSess object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcSess $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcSess $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcSessPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcSessPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcSessPeer::DATABASE_NAME, CcSessPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param string $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcSess - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcSessPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $pk); - - $v = CcSessPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcSessPeer::DATABASE_NAME); - $criteria->add(CcSessPeer::SESSID, $pks, Criteria::IN); - $objs = CcSessPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcSessPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcSessPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSessQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSessQuery.php deleted file mode 100644 index f2462c695..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSessQuery.php +++ /dev/null @@ -1,334 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcSess|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcSessPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcSessPeer::SESSID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcSessPeer::SESSID, $keys, Criteria::IN); - } - - /** - * Filter the query on the sessid column - * - * @param string $sessid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterBySessid($sessid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($sessid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $sessid)) { - $sessid = str_replace('*', '%', $sessid); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSessPeer::SESSID, $sessid, $comparison); - } - - /** - * Filter the query on the userid column - * - * @param int|array $userid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByUserid($userid = null, $comparison = null) - { - if (is_array($userid)) { - $useMinMax = false; - if (isset($userid['min'])) { - $this->addUsingAlias(CcSessPeer::USERID, $userid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($userid['max'])) { - $this->addUsingAlias(CcSessPeer::USERID, $userid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSessPeer::USERID, $userid, $comparison); - } - - /** - * Filter the query on the login column - * - * @param string $login The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByLogin($login = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($login)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $login)) { - $login = str_replace('*', '%', $login); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSessPeer::LOGIN, $login, $comparison); - } - - /** - * Filter the query on the ts column - * - * @param string|array $ts The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByTs($ts = null, $comparison = null) - { - if (is_array($ts)) { - $useMinMax = false; - if (isset($ts['min'])) { - $this->addUsingAlias(CcSessPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($ts['max'])) { - $this->addUsingAlias(CcSessPeer::TS, $ts['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSessPeer::TS, $ts, $comparison); - } - - /** - * Filter the query by a related CcSubjs object - * - * @param CcSubjs $ccSubjs the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSessQuery The current query, for fluid interface - */ - public function filterByCcSubjs($ccSubjs, $comparison = null) - { - return $this - ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->getId(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSubjs relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSessQuery The current query, for fluid interface - */ - public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSubjs'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSubjs'); - } - - return $this; - } - - /** - * Use the CcSubjs relation CcSubjs object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery A secondary query class using the current class as primary query - */ - public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSubjs($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); - } - - /** - * Exclude object from result - * - * @param CcSess $ccSess Object to remove from the list of results - * - * @return CcSessQuery The current query, for fluid interface - */ - public function prune($ccSess = null) - { - if ($ccSess) { - $this->addUsingAlias(CcSessPeer::SESSID, $ccSess->getSessid(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcSessQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSmemb.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSmemb.php deleted file mode 100644 index bb98b5c1e..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSmemb.php +++ /dev/null @@ -1,891 +0,0 @@ -uid = 0; - $this->gid = 0; - $this->level = 0; - } - - /** - * Initializes internal state of BaseCcSmemb object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Get the [uid] column value. - * - * @return int - */ - public function getUid() - { - return $this->uid; - } - - /** - * Get the [gid] column value. - * - * @return int - */ - public function getGid() - { - return $this->gid; - } - - /** - * Get the [level] column value. - * - * @return int - */ - public function getLevel() - { - return $this->level; - } - - /** - * Get the [mid] column value. - * - * @return int - */ - public function getMid() - { - return $this->mid; - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcSmemb The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcSmembPeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [uid] column. - * - * @param int $v new value - * @return CcSmemb The current object (for fluent API support) - */ - public function setUid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->uid !== $v || $this->isNew()) { - $this->uid = $v; - $this->modifiedColumns[] = CcSmembPeer::UID; - } - - return $this; - } // setUid() - - /** - * Set the value of [gid] column. - * - * @param int $v new value - * @return CcSmemb The current object (for fluent API support) - */ - public function setGid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->gid !== $v || $this->isNew()) { - $this->gid = $v; - $this->modifiedColumns[] = CcSmembPeer::GID; - } - - return $this; - } // setGid() - - /** - * Set the value of [level] column. - * - * @param int $v new value - * @return CcSmemb The current object (for fluent API support) - */ - public function setLevel($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->level !== $v || $this->isNew()) { - $this->level = $v; - $this->modifiedColumns[] = CcSmembPeer::LEVEL; - } - - return $this; - } // setLevel() - - /** - * Set the value of [mid] column. - * - * @param int $v new value - * @return CcSmemb The current object (for fluent API support) - */ - public function setMid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->mid !== $v) { - $this->mid = $v; - $this->modifiedColumns[] = CcSmembPeer::MID; - } - - return $this; - } // setMid() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->uid !== 0) { - return false; - } - - if ($this->gid !== 0) { - return false; - } - - if ($this->level !== 0) { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->uid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; - $this->gid = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; - $this->level = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; - $this->mid = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 5; // 5 = CcSmembPeer::NUM_COLUMNS - CcSmembPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcSmemb object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcSmembPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcSmembQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcSmembPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setNew(false); - } else { - $affectedRows = CcSmembPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = CcSmembPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getUid(); - break; - case 2: - return $this->getGid(); - break; - case 3: - return $this->getLevel(); - break; - case 4: - return $this->getMid(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) - { - $keys = CcSmembPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getUid(), - $keys[2] => $this->getGid(), - $keys[3] => $this->getLevel(), - $keys[4] => $this->getMid(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setUid($value); - break; - case 2: - $this->setGid($value); - break; - case 3: - $this->setLevel($value); - break; - case 4: - $this->setMid($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcSmembPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setUid($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setGid($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setLevel($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setMid($arr[$keys[4]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcSmembPeer::ID)) $criteria->add(CcSmembPeer::ID, $this->id); - if ($this->isColumnModified(CcSmembPeer::UID)) $criteria->add(CcSmembPeer::UID, $this->uid); - if ($this->isColumnModified(CcSmembPeer::GID)) $criteria->add(CcSmembPeer::GID, $this->gid); - if ($this->isColumnModified(CcSmembPeer::LEVEL)) $criteria->add(CcSmembPeer::LEVEL, $this->level); - if ($this->isColumnModified(CcSmembPeer::MID)) $criteria->add(CcSmembPeer::MID, $this->mid); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); - $criteria->add(CcSmembPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcSmemb (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setId($this->id); - $copyObj->setUid($this->uid); - $copyObj->setGid($this->gid); - $copyObj->setLevel($this->level); - $copyObj->setMid($this->mid); - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcSmemb Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcSmembPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcSmembPeer(); - } - return self::$peer; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->uid = null; - $this->gid = null; - $this->level = null; - $this->mid = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcSmemb diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSmembPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSmembPeer.php deleted file mode 100644 index 152440c7e..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSmembPeer.php +++ /dev/null @@ -1,750 +0,0 @@ - array ('Id', 'Uid', 'Gid', 'Level', 'Mid', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'uid', 'gid', 'level', 'mid', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::UID, self::GID, self::LEVEL, self::MID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'UID', 'GID', 'LEVEL', 'MID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'uid', 'gid', 'level', 'mid', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Uid' => 1, 'Gid' => 2, 'Level' => 3, 'Mid' => 4, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'uid' => 1, 'gid' => 2, 'level' => 3, 'mid' => 4, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::UID => 1, self::GID => 2, self::LEVEL => 3, self::MID => 4, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'UID' => 1, 'GID' => 2, 'LEVEL' => 3, 'MID' => 4, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'uid' => 1, 'gid' => 2, 'level' => 3, 'mid' => 4, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcSmembPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcSmembPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcSmembPeer::ID); - $criteria->addSelectColumn(CcSmembPeer::UID); - $criteria->addSelectColumn(CcSmembPeer::GID); - $criteria->addSelectColumn(CcSmembPeer::LEVEL); - $criteria->addSelectColumn(CcSmembPeer::MID); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.UID'); - $criteria->addSelectColumn($alias . '.GID'); - $criteria->addSelectColumn($alias . '.LEVEL'); - $criteria->addSelectColumn($alias . '.MID'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSmembPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSmembPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcSmemb - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcSmembPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcSmembPeer::populateObjects(CcSmembPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcSmembPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcSmemb $value A CcSmemb object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcSmemb $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcSmemb object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcSmemb) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSmemb object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcSmemb Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_smemb - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcSmembPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcSmembPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcSmembPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcSmembPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcSmemb object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcSmembPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcSmembPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcSmembPeer::NUM_COLUMNS; - } else { - $cls = CcSmembPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcSmembPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcSmembPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcSmembPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcSmembTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcSmembPeer::CLASS_DEFAULT : CcSmembPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcSmemb or Criteria object. - * - * @param mixed $values Criteria or CcSmemb object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcSmemb object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcSmemb or Criteria object. - * - * @param mixed $values Criteria or CcSmemb object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcSmembPeer::ID); - $value = $criteria->remove(CcSmembPeer::ID); - if ($value) { - $selectCriteria->add(CcSmembPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcSmembPeer::TABLE_NAME); - } - - } else { // $values is CcSmemb object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_smemb table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcSmembPeer::TABLE_NAME, $con, CcSmembPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcSmembPeer::clearInstancePool(); - CcSmembPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcSmemb or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcSmemb object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcSmembPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcSmemb) { // it's a model object - // invalidate the cache for this single object - CcSmembPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcSmembPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcSmembPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcSmembPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcSmemb object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcSmemb $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcSmemb $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcSmembPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcSmembPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcSmembPeer::DATABASE_NAME, CcSmembPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcSmemb - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcSmembPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); - $criteria->add(CcSmembPeer::ID, $pk); - - $v = CcSmembPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); - $criteria->add(CcSmembPeer::ID, $pks, Criteria::IN); - $objs = CcSmembPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcSmembPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcSmembPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSmembQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSmembQuery.php deleted file mode 100644 index c0ac62c18..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSmembQuery.php +++ /dev/null @@ -1,305 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcSmemb|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcSmembPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcSmembPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcSmembPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcSmembPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the uid column - * - * @param int|array $uid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByUid($uid = null, $comparison = null) - { - if (is_array($uid)) { - $useMinMax = false; - if (isset($uid['min'])) { - $this->addUsingAlias(CcSmembPeer::UID, $uid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($uid['max'])) { - $this->addUsingAlias(CcSmembPeer::UID, $uid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSmembPeer::UID, $uid, $comparison); - } - - /** - * Filter the query on the gid column - * - * @param int|array $gid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByGid($gid = null, $comparison = null) - { - if (is_array($gid)) { - $useMinMax = false; - if (isset($gid['min'])) { - $this->addUsingAlias(CcSmembPeer::GID, $gid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($gid['max'])) { - $this->addUsingAlias(CcSmembPeer::GID, $gid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSmembPeer::GID, $gid, $comparison); - } - - /** - * Filter the query on the level column - * - * @param int|array $level The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByLevel($level = null, $comparison = null) - { - if (is_array($level)) { - $useMinMax = false; - if (isset($level['min'])) { - $this->addUsingAlias(CcSmembPeer::LEVEL, $level['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($level['max'])) { - $this->addUsingAlias(CcSmembPeer::LEVEL, $level['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSmembPeer::LEVEL, $level, $comparison); - } - - /** - * Filter the query on the mid column - * - * @param int|array $mid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function filterByMid($mid = null, $comparison = null) - { - if (is_array($mid)) { - $useMinMax = false; - if (isset($mid['min'])) { - $this->addUsingAlias(CcSmembPeer::MID, $mid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($mid['max'])) { - $this->addUsingAlias(CcSmembPeer::MID, $mid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSmembPeer::MID, $mid, $comparison); - } - - /** - * Exclude object from result - * - * @param CcSmemb $ccSmemb Object to remove from the list of results - * - * @return CcSmembQuery The current query, for fluid interface - */ - public function prune($ccSmemb = null) - { - if ($ccSmemb) { - $this->addUsingAlias(CcSmembPeer::ID, $ccSmemb->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcSmembQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjs.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSubjs.php deleted file mode 100644 index 58796a099..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjs.php +++ /dev/null @@ -1,1969 +0,0 @@ -login = ''; - $this->pass = ''; - $this->type = 'U'; - $this->realname = ''; - } - - /** - * Initializes internal state of BaseCcSubjs object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Get the [login] column value. - * - * @return string - */ - public function getLogin() - { - return $this->login; - } - - /** - * Get the [pass] column value. - * - * @return string - */ - public function getPass() - { - return $this->pass; - } - - /** - * Get the [type] column value. - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Get the [realname] column value. - * - * @return string - */ - public function getRealname() - { - return $this->realname; - } - - /** - * Get the [optionally formatted] temporal [lastlogin] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getLastlogin($format = 'Y-m-d H:i:s') - { - if ($this->lastlogin === null) { - return null; - } - - - - try { - $dt = new DateTime($this->lastlogin); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lastlogin, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [lastfail] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getLastfail($format = 'Y-m-d H:i:s') - { - if ($this->lastfail === null) { - return null; - } - - - - try { - $dt = new DateTime($this->lastfail); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lastfail, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcSubjs The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcSubjsPeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [login] column. - * - * @param string $v new value - * @return CcSubjs The current object (for fluent API support) - */ - public function setLogin($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->login !== $v || $this->isNew()) { - $this->login = $v; - $this->modifiedColumns[] = CcSubjsPeer::LOGIN; - } - - return $this; - } // setLogin() - - /** - * Set the value of [pass] column. - * - * @param string $v new value - * @return CcSubjs The current object (for fluent API support) - */ - public function setPass($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->pass !== $v || $this->isNew()) { - $this->pass = $v; - $this->modifiedColumns[] = CcSubjsPeer::PASS; - } - - return $this; - } // setPass() - - /** - * Set the value of [type] column. - * - * @param string $v new value - * @return CcSubjs The current object (for fluent API support) - */ - public function setType($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->type !== $v || $this->isNew()) { - $this->type = $v; - $this->modifiedColumns[] = CcSubjsPeer::TYPE; - } - - return $this; - } // setType() - - /** - * Set the value of [realname] column. - * - * @param string $v new value - * @return CcSubjs The current object (for fluent API support) - */ - public function setRealname($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->realname !== $v || $this->isNew()) { - $this->realname = $v; - $this->modifiedColumns[] = CcSubjsPeer::REALNAME; - } - - return $this; - } // setRealname() - - /** - * Sets the value of [lastlogin] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSubjs The current object (for fluent API support) - */ - public function setLastlogin($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->lastlogin !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->lastlogin !== null && $tmpDt = new DateTime($this->lastlogin)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->lastlogin = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcSubjsPeer::LASTLOGIN; - } - } // if either are not null - - return $this; - } // setLastlogin() - - /** - * Sets the value of [lastfail] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcSubjs The current object (for fluent API support) - */ - public function setLastfail($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->lastfail !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->lastfail !== null && $tmpDt = new DateTime($this->lastfail)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->lastfail = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcSubjsPeer::LASTFAIL; - } - } // if either are not null - - return $this; - } // setLastfail() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->login !== '') { - return false; - } - - if ($this->pass !== '') { - return false; - } - - if ($this->type !== 'U') { - return false; - } - - if ($this->realname !== '') { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->login = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->pass = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->type = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->realname = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->lastlogin = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->lastfail = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 7; // 7 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcSubjs object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcSubjsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - $this->collCcAccesss = null; - - $this->collCcFiless = null; - - $this->collCcPermss = null; - - $this->collCcPlaylists = null; - - $this->collCcPrefs = null; - - $this->collCcSesss = null; - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcSubjsQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcSubjsPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setNew(false); - } else { - $affectedRows = CcSubjsPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - if ($this->collCcAccesss !== null) { - foreach ($this->collCcAccesss as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->collCcFiless !== null) { - foreach ($this->collCcFiless as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->collCcPermss !== null) { - foreach ($this->collCcPermss as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->collCcPlaylists !== null) { - foreach ($this->collCcPlaylists as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->collCcPrefs !== null) { - foreach ($this->collCcPrefs as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->collCcSesss !== null) { - foreach ($this->collCcSesss as $referrerFK) { - if (!$referrerFK->isDeleted()) { - $affectedRows += $referrerFK->save($con); - } - } - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = CcSubjsPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - if ($this->collCcAccesss !== null) { - foreach ($this->collCcAccesss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collCcFiless !== null) { - foreach ($this->collCcFiless as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collCcPermss !== null) { - foreach ($this->collCcPermss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collCcPlaylists !== null) { - foreach ($this->collCcPlaylists as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collCcPrefs !== null) { - foreach ($this->collCcPrefs as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - if ($this->collCcSesss !== null) { - foreach ($this->collCcSesss as $referrerFK) { - if (!$referrerFK->validate($columns)) { - $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); - } - } - } - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSubjsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getLogin(); - break; - case 2: - return $this->getPass(); - break; - case 3: - return $this->getType(); - break; - case 4: - return $this->getRealname(); - break; - case 5: - return $this->getLastlogin(); - break; - case 6: - return $this->getLastfail(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) - { - $keys = CcSubjsPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getLogin(), - $keys[2] => $this->getPass(), - $keys[3] => $this->getType(), - $keys[4] => $this->getRealname(), - $keys[5] => $this->getLastlogin(), - $keys[6] => $this->getLastfail(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcSubjsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setLogin($value); - break; - case 2: - $this->setPass($value); - break; - case 3: - $this->setType($value); - break; - case 4: - $this->setRealname($value); - break; - case 5: - $this->setLastlogin($value); - break; - case 6: - $this->setLastfail($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcSubjsPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setLogin($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setPass($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setType($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setRealname($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setLastlogin($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setLastfail($arr[$keys[6]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcSubjsPeer::ID)) $criteria->add(CcSubjsPeer::ID, $this->id); - if ($this->isColumnModified(CcSubjsPeer::LOGIN)) $criteria->add(CcSubjsPeer::LOGIN, $this->login); - if ($this->isColumnModified(CcSubjsPeer::PASS)) $criteria->add(CcSubjsPeer::PASS, $this->pass); - if ($this->isColumnModified(CcSubjsPeer::TYPE)) $criteria->add(CcSubjsPeer::TYPE, $this->type); - if ($this->isColumnModified(CcSubjsPeer::REALNAME)) $criteria->add(CcSubjsPeer::REALNAME, $this->realname); - if ($this->isColumnModified(CcSubjsPeer::LASTLOGIN)) $criteria->add(CcSubjsPeer::LASTLOGIN, $this->lastlogin); - if ($this->isColumnModified(CcSubjsPeer::LASTFAIL)) $criteria->add(CcSubjsPeer::LASTFAIL, $this->lastfail); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); - $criteria->add(CcSubjsPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcSubjs (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setId($this->id); - $copyObj->setLogin($this->login); - $copyObj->setPass($this->pass); - $copyObj->setType($this->type); - $copyObj->setRealname($this->realname); - $copyObj->setLastlogin($this->lastlogin); - $copyObj->setLastfail($this->lastfail); - - if ($deepCopy) { - // important: temporarily setNew(false) because this affects the behavior of - // the getter/setter methods for fkey referrer objects. - $copyObj->setNew(false); - - foreach ($this->getCcAccesss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcAccess($relObj->copy($deepCopy)); - } - } - - foreach ($this->getCcFiless() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcFiles($relObj->copy($deepCopy)); - } - } - - foreach ($this->getCcPermss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcPerms($relObj->copy($deepCopy)); - } - } - - foreach ($this->getCcPlaylists() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcPlaylist($relObj->copy($deepCopy)); - } - } - - foreach ($this->getCcPrefs() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcPref($relObj->copy($deepCopy)); - } - } - - foreach ($this->getCcSesss() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCcSess($relObj->copy($deepCopy)); - } - } - - } // if ($deepCopy) - - - $copyObj->setNew(true); - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcSubjs Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcSubjsPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcSubjsPeer(); - } - return self::$peer; - } - - /** - * Clears out the collCcAccesss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcAccesss() - */ - public function clearCcAccesss() - { - $this->collCcAccesss = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcAccesss collection. - * - * By default this just sets the collCcAccesss collection to an empty array (like clearcollCcAccesss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcAccesss() - { - $this->collCcAccesss = new PropelObjectCollection(); - $this->collCcAccesss->setModel('CcAccess'); - } - - /** - * Gets an array of CcAccess objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcAccess[] List of CcAccess objects - * @throws PropelException - */ - public function getCcAccesss($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcAccesss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcAccesss) { - // return empty collection - $this->initCcAccesss(); - } else { - $collCcAccesss = CcAccessQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcAccesss; - } - $this->collCcAccesss = $collCcAccesss; - } - } - return $this->collCcAccesss; - } - - /** - * Returns the number of related CcAccess objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcAccess objects. - * @throws PropelException - */ - public function countCcAccesss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcAccesss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcAccesss) { - return 0; - } else { - $query = CcAccessQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcAccesss); - } - } - - /** - * Method called to associate a CcAccess object to this object - * through the CcAccess foreign key attribute. - * - * @param CcAccess $l CcAccess - * @return void - * @throws PropelException - */ - public function addCcAccess(CcAccess $l) - { - if ($this->collCcAccesss === null) { - $this->initCcAccesss(); - } - if (!$this->collCcAccesss->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcAccesss[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears out the collCcFiless collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcFiless() - */ - public function clearCcFiless() - { - $this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcFiless collection. - * - * By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcFiless() - { - $this->collCcFiless = new PropelObjectCollection(); - $this->collCcFiless->setModel('CcFiles'); - } - - /** - * Gets an array of CcFiles objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcFiles[] List of CcFiles objects - * @throws PropelException - */ - public function getCcFiless($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcFiless || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFiless) { - // return empty collection - $this->initCcFiless(); - } else { - $collCcFiless = CcFilesQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcFiless; - } - $this->collCcFiless = $collCcFiless; - } - } - return $this->collCcFiless; - } - - /** - * Returns the number of related CcFiles objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcFiles objects. - * @throws PropelException - */ - public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcFiless || null !== $criteria) { - if ($this->isNew() && null === $this->collCcFiless) { - return 0; - } else { - $query = CcFilesQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcFiless); - } - } - - /** - * Method called to associate a CcFiles object to this object - * through the CcFiles foreign key attribute. - * - * @param CcFiles $l CcFiles - * @return void - * @throws PropelException - */ - public function addCcFiles(CcFiles $l) - { - if ($this->collCcFiless === null) { - $this->initCcFiless(); - } - if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcFiless[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears out the collCcPermss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcPermss() - */ - public function clearCcPermss() - { - $this->collCcPermss = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcPermss collection. - * - * By default this just sets the collCcPermss collection to an empty array (like clearcollCcPermss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcPermss() - { - $this->collCcPermss = new PropelObjectCollection(); - $this->collCcPermss->setModel('CcPerms'); - } - - /** - * Gets an array of CcPerms objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcPerms[] List of CcPerms objects - * @throws PropelException - */ - public function getCcPermss($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcPermss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPermss) { - // return empty collection - $this->initCcPermss(); - } else { - $collCcPermss = CcPermsQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcPermss; - } - $this->collCcPermss = $collCcPermss; - } - } - return $this->collCcPermss; - } - - /** - * Returns the number of related CcPerms objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcPerms objects. - * @throws PropelException - */ - public function countCcPermss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcPermss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPermss) { - return 0; - } else { - $query = CcPermsQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcPermss); - } - } - - /** - * Method called to associate a CcPerms object to this object - * through the CcPerms foreign key attribute. - * - * @param CcPerms $l CcPerms - * @return void - * @throws PropelException - */ - public function addCcPerms(CcPerms $l) - { - if ($this->collCcPermss === null) { - $this->initCcPermss(); - } - if (!$this->collCcPermss->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcPermss[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears out the collCcPlaylists collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcPlaylists() - */ - public function clearCcPlaylists() - { - $this->collCcPlaylists = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcPlaylists collection. - * - * By default this just sets the collCcPlaylists collection to an empty array (like clearcollCcPlaylists()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcPlaylists() - { - $this->collCcPlaylists = new PropelObjectCollection(); - $this->collCcPlaylists->setModel('CcPlaylist'); - } - - /** - * Gets an array of CcPlaylist objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcPlaylist[] List of CcPlaylist objects - * @throws PropelException - */ - public function getCcPlaylists($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcPlaylists || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylists) { - // return empty collection - $this->initCcPlaylists(); - } else { - $collCcPlaylists = CcPlaylistQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcPlaylists; - } - $this->collCcPlaylists = $collCcPlaylists; - } - } - return $this->collCcPlaylists; - } - - /** - * Returns the number of related CcPlaylist objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcPlaylist objects. - * @throws PropelException - */ - public function countCcPlaylists(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcPlaylists || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPlaylists) { - return 0; - } else { - $query = CcPlaylistQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcPlaylists); - } - } - - /** - * Method called to associate a CcPlaylist object to this object - * through the CcPlaylist foreign key attribute. - * - * @param CcPlaylist $l CcPlaylist - * @return void - * @throws PropelException - */ - public function addCcPlaylist(CcPlaylist $l) - { - if ($this->collCcPlaylists === null) { - $this->initCcPlaylists(); - } - if (!$this->collCcPlaylists->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcPlaylists[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears out the collCcPrefs collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcPrefs() - */ - public function clearCcPrefs() - { - $this->collCcPrefs = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcPrefs collection. - * - * By default this just sets the collCcPrefs collection to an empty array (like clearcollCcPrefs()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcPrefs() - { - $this->collCcPrefs = new PropelObjectCollection(); - $this->collCcPrefs->setModel('CcPref'); - } - - /** - * Gets an array of CcPref objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcPref[] List of CcPref objects - * @throws PropelException - */ - public function getCcPrefs($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcPrefs || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPrefs) { - // return empty collection - $this->initCcPrefs(); - } else { - $collCcPrefs = CcPrefQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcPrefs; - } - $this->collCcPrefs = $collCcPrefs; - } - } - return $this->collCcPrefs; - } - - /** - * Returns the number of related CcPref objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcPref objects. - * @throws PropelException - */ - public function countCcPrefs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcPrefs || null !== $criteria) { - if ($this->isNew() && null === $this->collCcPrefs) { - return 0; - } else { - $query = CcPrefQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcPrefs); - } - } - - /** - * Method called to associate a CcPref object to this object - * through the CcPref foreign key attribute. - * - * @param CcPref $l CcPref - * @return void - * @throws PropelException - */ - public function addCcPref(CcPref $l) - { - if ($this->collCcPrefs === null) { - $this->initCcPrefs(); - } - if (!$this->collCcPrefs->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcPrefs[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears out the collCcSesss collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addCcSesss() - */ - public function clearCcSesss() - { - $this->collCcSesss = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Initializes the collCcSesss collection. - * - * By default this just sets the collCcSesss collection to an empty array (like clearcollCcSesss()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @return void - */ - public function initCcSesss() - { - $this->collCcSesss = new PropelObjectCollection(); - $this->collCcSesss->setModel('CcSess'); - } - - /** - * Gets an array of CcSess objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this CcSubjs is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param PropelPDO $con optional connection object - * @return PropelCollection|array CcSess[] List of CcSess objects - * @throws PropelException - */ - public function getCcSesss($criteria = null, PropelPDO $con = null) - { - if(null === $this->collCcSesss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcSesss) { - // return empty collection - $this->initCcSesss(); - } else { - $collCcSesss = CcSessQuery::create(null, $criteria) - ->filterByCcSubjs($this) - ->find($con); - if (null !== $criteria) { - return $collCcSesss; - } - $this->collCcSesss = $collCcSesss; - } - } - return $this->collCcSesss; - } - - /** - * Returns the number of related CcSess objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param PropelPDO $con - * @return int Count of related CcSess objects. - * @throws PropelException - */ - public function countCcSesss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) - { - if(null === $this->collCcSesss || null !== $criteria) { - if ($this->isNew() && null === $this->collCcSesss) { - return 0; - } else { - $query = CcSessQuery::create(null, $criteria); - if($distinct) { - $query->distinct(); - } - return $query - ->filterByCcSubjs($this) - ->count($con); - } - } else { - return count($this->collCcSesss); - } - } - - /** - * Method called to associate a CcSess object to this object - * through the CcSess foreign key attribute. - * - * @param CcSess $l CcSess - * @return void - * @throws PropelException - */ - public function addCcSess(CcSess $l) - { - if ($this->collCcSesss === null) { - $this->initCcSesss(); - } - if (!$this->collCcSesss->contains($l)) { // only add it if the **same** object is not already associated - $this->collCcSesss[]= $l; - $l->setCcSubjs($this); - } - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->login = null; - $this->pass = null; - $this->type = null; - $this->realname = null; - $this->lastlogin = null; - $this->lastfail = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - if ($this->collCcAccesss) { - foreach ((array) $this->collCcAccesss as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collCcFiless) { - foreach ((array) $this->collCcFiless as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collCcPermss) { - foreach ((array) $this->collCcPermss as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collCcPlaylists) { - foreach ((array) $this->collCcPlaylists as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collCcPrefs) { - foreach ((array) $this->collCcPrefs as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collCcSesss) { - foreach ((array) $this->collCcSesss as $o) { - $o->clearAllReferences($deep); - } - } - } // if ($deep) - - $this->collCcAccesss = null; - $this->collCcFiless = null; - $this->collCcPermss = null; - $this->collCcPlaylists = null; - $this->collCcPrefs = null; - $this->collCcSesss = null; - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcSubjs diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsPeer.php deleted file mode 100644 index f4bc75f9f..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsPeer.php +++ /dev/null @@ -1,769 +0,0 @@ - array ('Id', 'Login', 'Pass', 'Type', 'Realname', 'Lastlogin', 'Lastfail', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'login', 'pass', 'type', 'realname', 'lastlogin', 'lastfail', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::REALNAME, self::LASTLOGIN, self::LASTFAIL, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'REALNAME', 'LASTLOGIN', 'LASTFAIL', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'realname', 'lastlogin', 'lastfail', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Login' => 1, 'Pass' => 2, 'Type' => 3, 'Realname' => 4, 'Lastlogin' => 5, 'Lastfail' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'realname' => 4, 'lastlogin' => 5, 'lastfail' => 6, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::REALNAME => 4, self::LASTLOGIN => 5, self::LASTFAIL => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'REALNAME' => 4, 'LASTLOGIN' => 5, 'LASTFAIL' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'realname' => 4, 'lastlogin' => 5, 'lastfail' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcSubjsPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcSubjsPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcSubjsPeer::ID); - $criteria->addSelectColumn(CcSubjsPeer::LOGIN); - $criteria->addSelectColumn(CcSubjsPeer::PASS); - $criteria->addSelectColumn(CcSubjsPeer::TYPE); - $criteria->addSelectColumn(CcSubjsPeer::REALNAME); - $criteria->addSelectColumn(CcSubjsPeer::LASTLOGIN); - $criteria->addSelectColumn(CcSubjsPeer::LASTFAIL); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.LOGIN'); - $criteria->addSelectColumn($alias . '.PASS'); - $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.REALNAME'); - $criteria->addSelectColumn($alias . '.LASTLOGIN'); - $criteria->addSelectColumn($alias . '.LASTFAIL'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcSubjsPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcSubjsPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcSubjs - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcSubjsPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcSubjsPeer::populateObjects(CcSubjsPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcSubjsPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcSubjs $value A CcSubjs object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcSubjs $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcSubjs object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcSubjs) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSubjs object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcSubjs Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_subjs - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - // Invalidate objects in CcPermsPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcPermsPeer::clearInstancePool(); - // Invalidate objects in CcPrefPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcPrefPeer::clearInstancePool(); - // Invalidate objects in CcSessPeer instance pool, - // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CcSessPeer::clearInstancePool(); - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcSubjsPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcSubjsPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcSubjsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcSubjsPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcSubjs object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcSubjsPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcSubjsPeer::NUM_COLUMNS; - } else { - $cls = CcSubjsPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcSubjsPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcSubjsPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcSubjsPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcSubjsTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcSubjsPeer::CLASS_DEFAULT : CcSubjsPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcSubjs or Criteria object. - * - * @param mixed $values Criteria or CcSubjs object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcSubjs object - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcSubjs or Criteria object. - * - * @param mixed $values Criteria or CcSubjs object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcSubjsPeer::ID); - $value = $criteria->remove(CcSubjsPeer::ID); - if ($value) { - $selectCriteria->add(CcSubjsPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcSubjsPeer::TABLE_NAME); - } - - } else { // $values is CcSubjs object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_subjs table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcSubjsPeer::TABLE_NAME, $con, CcSubjsPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcSubjsPeer::clearInstancePool(); - CcSubjsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcSubjs or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcSubjs object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcSubjsPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcSubjs) { // it's a model object - // invalidate the cache for this single object - CcSubjsPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcSubjsPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcSubjsPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcSubjsPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcSubjs object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcSubjs $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcSubjs $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcSubjsPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcSubjsPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcSubjsPeer::DATABASE_NAME, CcSubjsPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcSubjs - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcSubjsPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); - $criteria->add(CcSubjsPeer::ID, $pk); - - $v = CcSubjsPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); - $criteria->add(CcSubjsPeer::ID, $pks, Criteria::IN); - $objs = CcSubjsPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcSubjsPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcSubjsPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsQuery.php deleted file mode 100644 index af3b6fe5e..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcSubjsQuery.php +++ /dev/null @@ -1,747 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcSubjs|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcSubjsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcSubjsPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcSubjsPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcSubjsPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the login column - * - * @param string $login The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByLogin($login = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($login)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $login)) { - $login = str_replace('*', '%', $login); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSubjsPeer::LOGIN, $login, $comparison); - } - - /** - * Filter the query on the pass column - * - * @param string $pass The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByPass($pass = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($pass)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $pass)) { - $pass = str_replace('*', '%', $pass); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSubjsPeer::PASS, $pass, $comparison); - } - - /** - * Filter the query on the type column - * - * @param string $type The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByType($type = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($type)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $type)) { - $type = str_replace('*', '%', $type); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSubjsPeer::TYPE, $type, $comparison); - } - - /** - * Filter the query on the realname column - * - * @param string $realname The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByRealname($realname = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($realname)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $realname)) { - $realname = str_replace('*', '%', $realname); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcSubjsPeer::REALNAME, $realname, $comparison); - } - - /** - * Filter the query on the lastlogin column - * - * @param string|array $lastlogin The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByLastlogin($lastlogin = null, $comparison = null) - { - if (is_array($lastlogin)) { - $useMinMax = false; - if (isset($lastlogin['min'])) { - $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $lastlogin['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($lastlogin['max'])) { - $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $lastlogin['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $lastlogin, $comparison); - } - - /** - * Filter the query on the lastfail column - * - * @param string|array $lastfail The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByLastfail($lastfail = null, $comparison = null) - { - if (is_array($lastfail)) { - $useMinMax = false; - if (isset($lastfail['min'])) { - $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $lastfail['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($lastfail['max'])) { - $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $lastfail['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $lastfail, $comparison); - } - - /** - * Filter the query by a related CcAccess object - * - * @param CcAccess $ccAccess the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcAccess($ccAccess, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccAccess->getOwner(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcAccess relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcAccess($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcAccess'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcAccess'); - } - - return $this; - } - - /** - * Use the CcAccess relation CcAccess object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcAccessQuery A secondary query class using the current class as primary query - */ - public function useCcAccessQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcAccess($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcAccess', 'CcAccessQuery'); - } - - /** - * Filter the query by a related CcFiles object - * - * @param CcFiles $ccFiles the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcFiles($ccFiles, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getEditedby(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcFiles relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcFiles'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcFiles'); - } - - return $this; - } - - /** - * Use the CcFiles relation CcFiles object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcFilesQuery A secondary query class using the current class as primary query - */ - public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcFiles($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); - } - - /** - * Filter the query by a related CcPerms object - * - * @param CcPerms $ccPerms the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcPerms($ccPerms, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccPerms->getSubj(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPerms relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcPerms($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPerms'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPerms'); - } - - return $this; - } - - /** - * Use the CcPerms relation CcPerms object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPermsQuery A secondary query class using the current class as primary query - */ - public function useCcPermsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPerms($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPerms', 'CcPermsQuery'); - } - - /** - * Filter the query by a related CcPlaylist object - * - * @param CcPlaylist $ccPlaylist the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcPlaylist($ccPlaylist, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccPlaylist->getDbEditedby(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPlaylist relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcPlaylist($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPlaylist'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPlaylist'); - } - - return $this; - } - - /** - * Use the CcPlaylist relation CcPlaylist object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPlaylistQuery A secondary query class using the current class as primary query - */ - public function useCcPlaylistQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPlaylist($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery'); - } - - /** - * Filter the query by a related CcPref object - * - * @param CcPref $ccPref the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcPref($ccPref, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccPref->getSubjid(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcPref relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcPref($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcPref'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcPref'); - } - - return $this; - } - - /** - * Use the CcPref relation CcPref object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcPrefQuery A secondary query class using the current class as primary query - */ - public function useCcPrefQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcPref($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcPref', 'CcPrefQuery'); - } - - /** - * Filter the query by a related CcSess object - * - * @param CcSess $ccSess the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function filterByCcSess($ccSess, $comparison = null) - { - return $this - ->addUsingAlias(CcSubjsPeer::ID, $ccSess->getUserid(), $comparison); - } - - /** - * Adds a JOIN clause to the query using the CcSess relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function joinCcSess($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CcSess'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CcSess'); - } - - return $this; - } - - /** - * Use the CcSess relation CcSess object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return CcSessQuery A secondary query class using the current class as primary query - */ - public function useCcSessQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCcSess($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CcSess', 'CcSessQuery'); - } - - /** - * Exclude object from result - * - * @param CcSubjs $ccSubjs Object to remove from the list of results - * - * @return CcSubjsQuery The current query, for fluid interface - */ - public function prune($ccSubjs = null) - { - if ($ccSubjs) { - $this->addUsingAlias(CcSubjsPeer::ID, $ccSubjs->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcSubjsQuery diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcTrans.php b/backend/propel-db/build/classes/campcaster/om/BaseCcTrans.php deleted file mode 100644 index e7ce7ef9f..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcTrans.php +++ /dev/null @@ -1,1903 +0,0 @@ -lock = 'N'; - } - - /** - * Initializes internal state of BaseCcTrans object. - * @see applyDefaults() - */ - public function __construct() - { - parent::__construct(); - $this->applyDefaultValues(); - } - - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Get the [trtok] column value. - * - * @return string - */ - public function getTrtok() - { - return $this->trtok; - } - - /** - * Get the [direction] column value. - * - * @return string - */ - public function getDirection() - { - return $this->direction; - } - - /** - * Get the [state] column value. - * - * @return string - */ - public function getState() - { - return $this->state; - } - - /** - * Get the [trtype] column value. - * - * @return string - */ - public function getTrtype() - { - return $this->trtype; - } - - /** - * Get the [lock] column value. - * - * @return string - */ - public function getLock() - { - return $this->lock; - } - - /** - * Get the [target] column value. - * - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Get the [rtrtok] column value. - * - * @return string - */ - public function getRtrtok() - { - return $this->rtrtok; - } - - /** - * Get the [mdtrtok] column value. - * - * @return string - */ - public function getMdtrtok() - { - return $this->mdtrtok; - } - - /** - * Get the [gunid] column value. - * - * @return string - */ - public function getGunid() - { - return $this->gunid; - } - - /** - * Get the [pdtoken] column value. - * - * @return string - */ - public function getPdtoken() - { - return $this->pdtoken; - } - - /** - * Get the [url] column value. - * - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Get the [localfile] column value. - * - * @return string - */ - public function getLocalfile() - { - return $this->localfile; - } - - /** - * Get the [fname] column value. - * - * @return string - */ - public function getFname() - { - return $this->fname; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the [expectedsum] column value. - * - * @return string - */ - public function getExpectedsum() - { - return $this->expectedsum; - } - - /** - * Get the [realsum] column value. - * - * @return string - */ - public function getRealsum() - { - return $this->realsum; - } - - /** - * Get the [expectedsize] column value. - * - * @return int - */ - public function getExpectedsize() - { - return $this->expectedsize; - } - - /** - * Get the [realsize] column value. - * - * @return int - */ - public function getRealsize() - { - return $this->realsize; - } - - /** - * Get the [uid] column value. - * - * @return int - */ - public function getUid() - { - return $this->uid; - } - - /** - * Get the [errmsg] column value. - * - * @return string - */ - public function getErrmsg() - { - return $this->errmsg; - } - - /** - * Get the [jobpid] column value. - * - * @return int - */ - public function getJobpid() - { - return $this->jobpid; - } - - /** - * Get the [optionally formatted] temporal [start] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getStart($format = 'Y-m-d H:i:s') - { - if ($this->start === null) { - return null; - } - - - - try { - $dt = new DateTime($this->start); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Get the [optionally formatted] temporal [ts] column value. - * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw DateTime object will be returned. - * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL - * @throws PropelException - if unable to parse/validate the date/time value. - */ - public function getTs($format = 'Y-m-d H:i:s') - { - if ($this->ts === null) { - return null; - } - - - - try { - $dt = new DateTime($this->ts); - } catch (Exception $x) { - throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, true), $x); - } - - if ($format === null) { - // Because propel.useDateTimeClass is TRUE, we return a DateTime object. - return $dt; - } elseif (strpos($format, '%') !== false) { - return strftime($format, $dt->format('U')); - } else { - return $dt->format($format); - } - } - - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CcTransPeer::ID; - } - - return $this; - } // setId() - - /** - * Set the value of [trtok] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setTrtok($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->trtok !== $v) { - $this->trtok = $v; - $this->modifiedColumns[] = CcTransPeer::TRTOK; - } - - return $this; - } // setTrtok() - - /** - * Set the value of [direction] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setDirection($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->direction !== $v) { - $this->direction = $v; - $this->modifiedColumns[] = CcTransPeer::DIRECTION; - } - - return $this; - } // setDirection() - - /** - * Set the value of [state] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setState($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->state !== $v) { - $this->state = $v; - $this->modifiedColumns[] = CcTransPeer::STATE; - } - - return $this; - } // setState() - - /** - * Set the value of [trtype] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setTrtype($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->trtype !== $v) { - $this->trtype = $v; - $this->modifiedColumns[] = CcTransPeer::TRTYPE; - } - - return $this; - } // setTrtype() - - /** - * Set the value of [lock] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setLock($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->lock !== $v || $this->isNew()) { - $this->lock = $v; - $this->modifiedColumns[] = CcTransPeer::LOCK; - } - - return $this; - } // setLock() - - /** - * Set the value of [target] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setTarget($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->target !== $v) { - $this->target = $v; - $this->modifiedColumns[] = CcTransPeer::TARGET; - } - - return $this; - } // setTarget() - - /** - * Set the value of [rtrtok] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setRtrtok($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->rtrtok !== $v) { - $this->rtrtok = $v; - $this->modifiedColumns[] = CcTransPeer::RTRTOK; - } - - return $this; - } // setRtrtok() - - /** - * Set the value of [mdtrtok] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setMdtrtok($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->mdtrtok !== $v) { - $this->mdtrtok = $v; - $this->modifiedColumns[] = CcTransPeer::MDTRTOK; - } - - return $this; - } // setMdtrtok() - - /** - * Set the value of [gunid] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setGunid($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->gunid !== $v) { - $this->gunid = $v; - $this->modifiedColumns[] = CcTransPeer::GUNID; - } - - return $this; - } // setGunid() - - /** - * Set the value of [pdtoken] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setPdtoken($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->pdtoken !== $v) { - $this->pdtoken = $v; - $this->modifiedColumns[] = CcTransPeer::PDTOKEN; - } - - return $this; - } // setPdtoken() - - /** - * Set the value of [url] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->url !== $v) { - $this->url = $v; - $this->modifiedColumns[] = CcTransPeer::URL; - } - - return $this; - } // setUrl() - - /** - * Set the value of [localfile] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setLocalfile($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->localfile !== $v) { - $this->localfile = $v; - $this->modifiedColumns[] = CcTransPeer::LOCALFILE; - } - - return $this; - } // setLocalfile() - - /** - * Set the value of [fname] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setFname($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->fname !== $v) { - $this->fname = $v; - $this->modifiedColumns[] = CcTransPeer::FNAME; - } - - return $this; - } // setFname() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = CcTransPeer::TITLE; - } - - return $this; - } // setTitle() - - /** - * Set the value of [expectedsum] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setExpectedsum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->expectedsum !== $v) { - $this->expectedsum = $v; - $this->modifiedColumns[] = CcTransPeer::EXPECTEDSUM; - } - - return $this; - } // setExpectedsum() - - /** - * Set the value of [realsum] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setRealsum($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->realsum !== $v) { - $this->realsum = $v; - $this->modifiedColumns[] = CcTransPeer::REALSUM; - } - - return $this; - } // setRealsum() - - /** - * Set the value of [expectedsize] column. - * - * @param int $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setExpectedsize($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->expectedsize !== $v) { - $this->expectedsize = $v; - $this->modifiedColumns[] = CcTransPeer::EXPECTEDSIZE; - } - - return $this; - } // setExpectedsize() - - /** - * Set the value of [realsize] column. - * - * @param int $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setRealsize($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->realsize !== $v) { - $this->realsize = $v; - $this->modifiedColumns[] = CcTransPeer::REALSIZE; - } - - return $this; - } // setRealsize() - - /** - * Set the value of [uid] column. - * - * @param int $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setUid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->uid !== $v) { - $this->uid = $v; - $this->modifiedColumns[] = CcTransPeer::UID; - } - - return $this; - } // setUid() - - /** - * Set the value of [errmsg] column. - * - * @param string $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setErrmsg($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->errmsg !== $v) { - $this->errmsg = $v; - $this->modifiedColumns[] = CcTransPeer::ERRMSG; - } - - return $this; - } // setErrmsg() - - /** - * Set the value of [jobpid] column. - * - * @param int $v new value - * @return CcTrans The current object (for fluent API support) - */ - public function setJobpid($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->jobpid !== $v) { - $this->jobpid = $v; - $this->modifiedColumns[] = CcTransPeer::JOBPID; - } - - return $this; - } // setJobpid() - - /** - * Sets the value of [start] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcTrans The current object (for fluent API support) - */ - public function setStart($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->start !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->start !== null && $tmpDt = new DateTime($this->start)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->start = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcTransPeer::START; - } - } // if either are not null - - return $this; - } // setStart() - - /** - * Sets the value of [ts] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will - * be treated as NULL for temporal objects. - * @return CcTrans The current object (for fluent API support) - */ - public function setTs($v) - { - // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') - // -- which is unexpected, to say the least. - if ($v === null || $v === '') { - $dt = null; - } elseif ($v instanceof DateTime) { - $dt = $v; - } else { - // some string/numeric value passed; we normalize that so that we can - // validate it. - try { - if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); - } else { - $dt = new DateTime($v); - } - } catch (Exception $x) { - throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); - } - } - - if ( $this->ts !== null || $dt !== null ) { - // (nested ifs are a little easier to read in this case) - - $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; - $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; - - if ( ($currNorm !== $newNorm) // normalized values don't match - ) - { - $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); - $this->modifiedColumns[] = CcTransPeer::TS; - } - } // if either are not null - - return $this; - } // setTs() - - /** - * Indicates whether the columns in this object are only set to default values. - * - * This method can be used in conjunction with isModified() to indicate whether an object is both - * modified _and_ has some values set which are non-default. - * - * @return boolean Whether the columns in this object are only been set with default values. - */ - public function hasOnlyDefaultValues() - { - if ($this->lock !== 'N') { - return false; - } - - // otherwise, everything was equal, so return TRUE - return true; - } // hasOnlyDefaultValues() - - /** - * Hydrates (populates) the object variables with values from the database resultset. - * - * An offset (0-based "start column") is specified so that objects can be hydrated - * with a subset of the columns in the resultset rows. This is needed, for example, - * for results of JOIN queries where the resultset row includes columns from two or - * more tables. - * - * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) - * @param int $startcol 0-based offset column which indicates which restultset column to start with. - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. - * @return int next starting column - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. - */ - public function hydrate($row, $startcol = 0, $rehydrate = false) - { - try { - - $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; - $this->trtok = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; - $this->direction = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; - $this->state = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; - $this->trtype = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->lock = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; - $this->target = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; - $this->rtrtok = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; - $this->mdtrtok = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; - $this->gunid = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; - $this->pdtoken = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; - $this->url = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; - $this->localfile = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; - $this->fname = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; - $this->title = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; - $this->expectedsum = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; - $this->realsum = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; - $this->expectedsize = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null; - $this->realsize = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null; - $this->uid = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null; - $this->errmsg = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; - $this->jobpid = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null; - $this->start = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; - $this->ts = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null; - $this->resetModified(); - - $this->setNew(false); - - if ($rehydrate) { - $this->ensureConsistency(); - } - - return $startcol + 24; // 24 = CcTransPeer::NUM_COLUMNS - CcTransPeer::NUM_LAZY_LOAD_COLUMNS). - - } catch (Exception $e) { - throw new PropelException("Error populating CcTrans object", $e); - } - } - - /** - * Checks and repairs the internal consistency of the object. - * - * This method is executed after an already-instantiated object is re-hydrated - * from the database. It exists to check any foreign keys to make sure that - * the objects related to the current object are correct based on foreign key. - * - * You can override this method in the stub class, but you should always invoke - * the base method from the overridden method (i.e. parent::ensureConsistency()), - * in case your model changes. - * - * @throws PropelException - */ - public function ensureConsistency() - { - - } // ensureConsistency - - /** - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. - * - * This will only work if the object has been saved and has a valid primary key set. - * - * @param boolean $deep (optional) Whether to also de-associated any related objects. - * @param PropelPDO $con (optional) The PropelPDO connection to use. - * @return void - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db - */ - public function reload($deep = false, PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("Cannot reload a deleted object."); - } - - if ($this->isNew()) { - throw new PropelException("Cannot reload an unsaved object."); - } - - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - // We don't need to alter the object instance pool; we're just modifying this instance - // already in the pool. - - $stmt = CcTransPeer::doSelectStmt($this->buildPkeyCriteria(), $con); - $row = $stmt->fetch(PDO::FETCH_NUM); - $stmt->closeCursor(); - if (!$row) { - throw new PropelException('Cannot find matching row in the database to reload object values.'); - } - $this->hydrate($row, 0, true); // rehydrate - - if ($deep) { // also de-associate any related objects? - - } // if (deep) - } - - /** - * Removes this object from datastore and sets delete attribute. - * - * @param PropelPDO $con - * @return void - * @throws PropelException - * @see BaseObject::setDeleted() - * @see BaseObject::isDeleted() - */ - public function delete(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("This object has already been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - try { - $ret = $this->preDelete($con); - if ($ret) { - CcTransQuery::create() - ->filterByPrimaryKey($this->getPrimaryKey()) - ->delete($con); - $this->postDelete($con); - $con->commit(); - $this->setDeleted(true); - } else { - $con->commit(); - } - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Persists this object to the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All modified related objects will also be persisted in the doSave() - * method. This method wraps all precipitate database operations in a - * single transaction. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see doSave() - */ - public function save(PropelPDO $con = null) - { - if ($this->isDeleted()) { - throw new PropelException("You cannot save an object that has been deleted."); - } - - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $con->beginTransaction(); - $isInsert = $this->isNew(); - try { - $ret = $this->preSave($con); - if ($isInsert) { - $ret = $ret && $this->preInsert($con); - } else { - $ret = $ret && $this->preUpdate($con); - } - if ($ret) { - $affectedRows = $this->doSave($con); - if ($isInsert) { - $this->postInsert($con); - } else { - $this->postUpdate($con); - } - $this->postSave($con); - CcTransPeer::addInstanceToPool($this); - } else { - $affectedRows = 0; - } - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Performs the work of inserting or updating the row in the database. - * - * If the object is new, it inserts it; otherwise an update is performed. - * All related objects are also updated in this method. - * - * @param PropelPDO $con - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. - * @throws PropelException - * @see save() - */ - protected function doSave(PropelPDO $con) - { - $affectedRows = 0; // initialize var to track total num of affected rows - if (!$this->alreadyInSave) { - $this->alreadyInSave = true; - - if ($this->isNew() ) { - $this->modifiedColumns[] = CcTransPeer::ID; - } - - // If this object has been modified, then save it to the database. - if ($this->isModified()) { - if ($this->isNew()) { - $criteria = $this->buildCriteria(); - if ($criteria->keyContainsValue(CcTransPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTransPeer::ID.')'); - } - - $pk = BasePeer::doInsert($criteria, $con); - $affectedRows = 1; - $this->setId($pk); //[IMV] update autoincrement primary key - $this->setNew(false); - } else { - $affectedRows = CcTransPeer::doUpdate($this, $con); - } - - $this->resetModified(); // [HL] After being saved an object is no longer 'modified' - } - - $this->alreadyInSave = false; - - } - return $affectedRows; - } // doSave() - - /** - * Array of ValidationFailed objects. - * @var array ValidationFailed[] - */ - protected $validationFailures = array(); - - /** - * Gets any ValidationFailed objects that resulted from last call to validate(). - * - * - * @return array ValidationFailed[] - * @see validate() - */ - public function getValidationFailures() - { - return $this->validationFailures; - } - - /** - * Validates the objects modified field values and all objects related to this table. - * - * If $columns is either a column name or an array of column names - * only those columns are validated. - * - * @param mixed $columns Column name or an array of column names. - * @return boolean Whether all columns pass validation. - * @see doValidate() - * @see getValidationFailures() - */ - public function validate($columns = null) - { - $res = $this->doValidate($columns); - if ($res === true) { - $this->validationFailures = array(); - return true; - } else { - $this->validationFailures = $res; - return false; - } - } - - /** - * This function performs the validation work for complex object models. - * - * In addition to checking the current object, all related objects will - * also be validated. If all pass then true is returned; otherwise - * an aggreagated array of ValidationFailed objects will be returned. - * - * @param array $columns Array of column names to validate. - * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. - */ - protected function doValidate($columns = null) - { - if (!$this->alreadyInValidation) { - $this->alreadyInValidation = true; - $retval = null; - - $failureMap = array(); - - - if (($retval = CcTransPeer::doValidate($this, $columns)) !== true) { - $failureMap = array_merge($failureMap, $retval); - } - - - - $this->alreadyInValidation = false; - } - - return (!empty($failureMap) ? $failureMap : true); - } - - /** - * Retrieves a field from the object by name passed in as a string. - * - * @param string $name name - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return mixed Value of field. - */ - public function getByName($name, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcTransPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - $field = $this->getByPosition($pos); - return $field; - } - - /** - * Retrieves a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @return mixed Value of field at $pos - */ - public function getByPosition($pos) - { - switch($pos) { - case 0: - return $this->getId(); - break; - case 1: - return $this->getTrtok(); - break; - case 2: - return $this->getDirection(); - break; - case 3: - return $this->getState(); - break; - case 4: - return $this->getTrtype(); - break; - case 5: - return $this->getLock(); - break; - case 6: - return $this->getTarget(); - break; - case 7: - return $this->getRtrtok(); - break; - case 8: - return $this->getMdtrtok(); - break; - case 9: - return $this->getGunid(); - break; - case 10: - return $this->getPdtoken(); - break; - case 11: - return $this->getUrl(); - break; - case 12: - return $this->getLocalfile(); - break; - case 13: - return $this->getFname(); - break; - case 14: - return $this->getTitle(); - break; - case 15: - return $this->getExpectedsum(); - break; - case 16: - return $this->getRealsum(); - break; - case 17: - return $this->getExpectedsize(); - break; - case 18: - return $this->getRealsize(); - break; - case 19: - return $this->getUid(); - break; - case 20: - return $this->getErrmsg(); - break; - case 21: - return $this->getJobpid(); - break; - case 22: - return $this->getStart(); - break; - case 23: - return $this->getTs(); - break; - default: - return null; - break; - } // switch() - } - - /** - * Exports the object as an array. - * - * You can specify the key type of the array by passing one of the class - * type constants. - * - * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * Defaults to BasePeer::TYPE_PHPNAME. - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. - * - * @return array an associative array containing the field names (as keys) and field values - */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) - { - $keys = CcTransPeer::getFieldNames($keyType); - $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getTrtok(), - $keys[2] => $this->getDirection(), - $keys[3] => $this->getState(), - $keys[4] => $this->getTrtype(), - $keys[5] => $this->getLock(), - $keys[6] => $this->getTarget(), - $keys[7] => $this->getRtrtok(), - $keys[8] => $this->getMdtrtok(), - $keys[9] => $this->getGunid(), - $keys[10] => $this->getPdtoken(), - $keys[11] => $this->getUrl(), - $keys[12] => $this->getLocalfile(), - $keys[13] => $this->getFname(), - $keys[14] => $this->getTitle(), - $keys[15] => $this->getExpectedsum(), - $keys[16] => $this->getRealsum(), - $keys[17] => $this->getExpectedsize(), - $keys[18] => $this->getRealsize(), - $keys[19] => $this->getUid(), - $keys[20] => $this->getErrmsg(), - $keys[21] => $this->getJobpid(), - $keys[22] => $this->getStart(), - $keys[23] => $this->getTs(), - ); - return $result; - } - - /** - * Sets a field from the object by name passed in as a string. - * - * @param string $name peer name - * @param mixed $value field value - * @param string $type The type of fieldname the $name is of: - * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return void - */ - public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) - { - $pos = CcTransPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); - return $this->setByPosition($pos, $value); - } - - /** - * Sets a field from the object by Position as specified in the xml schema. - * Zero-based. - * - * @param int $pos position in xml schema - * @param mixed $value field value - * @return void - */ - public function setByPosition($pos, $value) - { - switch($pos) { - case 0: - $this->setId($value); - break; - case 1: - $this->setTrtok($value); - break; - case 2: - $this->setDirection($value); - break; - case 3: - $this->setState($value); - break; - case 4: - $this->setTrtype($value); - break; - case 5: - $this->setLock($value); - break; - case 6: - $this->setTarget($value); - break; - case 7: - $this->setRtrtok($value); - break; - case 8: - $this->setMdtrtok($value); - break; - case 9: - $this->setGunid($value); - break; - case 10: - $this->setPdtoken($value); - break; - case 11: - $this->setUrl($value); - break; - case 12: - $this->setLocalfile($value); - break; - case 13: - $this->setFname($value); - break; - case 14: - $this->setTitle($value); - break; - case 15: - $this->setExpectedsum($value); - break; - case 16: - $this->setRealsum($value); - break; - case 17: - $this->setExpectedsize($value); - break; - case 18: - $this->setRealsize($value); - break; - case 19: - $this->setUid($value); - break; - case 20: - $this->setErrmsg($value); - break; - case 21: - $this->setJobpid($value); - break; - case 22: - $this->setStart($value); - break; - case 23: - $this->setTs($value); - break; - } // switch() - } - - /** - * Populates the object using an array. - * - * This is particularly useful when populating an object from one of the - * request arrays (e.g. $_POST). This method goes through the column - * names, checking to see whether a matching key exists in populated - * array. If so the setByName() method is called for that column. - * - * You can specify the key type of the array by additionally passing one - * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. - * The default key type is the column's phpname (e.g. 'AuthorId') - * - * @param array $arr An array to populate the object from. - * @param string $keyType The type of keys the array uses. - * @return void - */ - public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) - { - $keys = CcTransPeer::getFieldNames($keyType); - - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setTrtok($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setDirection($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setState($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setTrtype($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setLock($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setTarget($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setRtrtok($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setMdtrtok($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setGunid($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setPdtoken($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setUrl($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setLocalfile($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setFname($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setTitle($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setExpectedsum($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setRealsum($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setExpectedsize($arr[$keys[17]]); - if (array_key_exists($keys[18], $arr)) $this->setRealsize($arr[$keys[18]]); - if (array_key_exists($keys[19], $arr)) $this->setUid($arr[$keys[19]]); - if (array_key_exists($keys[20], $arr)) $this->setErrmsg($arr[$keys[20]]); - if (array_key_exists($keys[21], $arr)) $this->setJobpid($arr[$keys[21]]); - if (array_key_exists($keys[22], $arr)) $this->setStart($arr[$keys[22]]); - if (array_key_exists($keys[23], $arr)) $this->setTs($arr[$keys[23]]); - } - - /** - * Build a Criteria object containing the values of all modified columns in this object. - * - * @return Criteria The Criteria object containing all modified values. - */ - public function buildCriteria() - { - $criteria = new Criteria(CcTransPeer::DATABASE_NAME); - - if ($this->isColumnModified(CcTransPeer::ID)) $criteria->add(CcTransPeer::ID, $this->id); - if ($this->isColumnModified(CcTransPeer::TRTOK)) $criteria->add(CcTransPeer::TRTOK, $this->trtok); - if ($this->isColumnModified(CcTransPeer::DIRECTION)) $criteria->add(CcTransPeer::DIRECTION, $this->direction); - if ($this->isColumnModified(CcTransPeer::STATE)) $criteria->add(CcTransPeer::STATE, $this->state); - if ($this->isColumnModified(CcTransPeer::TRTYPE)) $criteria->add(CcTransPeer::TRTYPE, $this->trtype); - if ($this->isColumnModified(CcTransPeer::LOCK)) $criteria->add(CcTransPeer::LOCK, $this->lock); - if ($this->isColumnModified(CcTransPeer::TARGET)) $criteria->add(CcTransPeer::TARGET, $this->target); - if ($this->isColumnModified(CcTransPeer::RTRTOK)) $criteria->add(CcTransPeer::RTRTOK, $this->rtrtok); - if ($this->isColumnModified(CcTransPeer::MDTRTOK)) $criteria->add(CcTransPeer::MDTRTOK, $this->mdtrtok); - if ($this->isColumnModified(CcTransPeer::GUNID)) $criteria->add(CcTransPeer::GUNID, $this->gunid); - if ($this->isColumnModified(CcTransPeer::PDTOKEN)) $criteria->add(CcTransPeer::PDTOKEN, $this->pdtoken); - if ($this->isColumnModified(CcTransPeer::URL)) $criteria->add(CcTransPeer::URL, $this->url); - if ($this->isColumnModified(CcTransPeer::LOCALFILE)) $criteria->add(CcTransPeer::LOCALFILE, $this->localfile); - if ($this->isColumnModified(CcTransPeer::FNAME)) $criteria->add(CcTransPeer::FNAME, $this->fname); - if ($this->isColumnModified(CcTransPeer::TITLE)) $criteria->add(CcTransPeer::TITLE, $this->title); - if ($this->isColumnModified(CcTransPeer::EXPECTEDSUM)) $criteria->add(CcTransPeer::EXPECTEDSUM, $this->expectedsum); - if ($this->isColumnModified(CcTransPeer::REALSUM)) $criteria->add(CcTransPeer::REALSUM, $this->realsum); - if ($this->isColumnModified(CcTransPeer::EXPECTEDSIZE)) $criteria->add(CcTransPeer::EXPECTEDSIZE, $this->expectedsize); - if ($this->isColumnModified(CcTransPeer::REALSIZE)) $criteria->add(CcTransPeer::REALSIZE, $this->realsize); - if ($this->isColumnModified(CcTransPeer::UID)) $criteria->add(CcTransPeer::UID, $this->uid); - if ($this->isColumnModified(CcTransPeer::ERRMSG)) $criteria->add(CcTransPeer::ERRMSG, $this->errmsg); - if ($this->isColumnModified(CcTransPeer::JOBPID)) $criteria->add(CcTransPeer::JOBPID, $this->jobpid); - if ($this->isColumnModified(CcTransPeer::START)) $criteria->add(CcTransPeer::START, $this->start); - if ($this->isColumnModified(CcTransPeer::TS)) $criteria->add(CcTransPeer::TS, $this->ts); - - return $criteria; - } - - /** - * Builds a Criteria object containing the primary key for this object. - * - * Unlike buildCriteria() this method includes the primary key values regardless - * of whether or not they have been modified. - * - * @return Criteria The Criteria object containing value(s) for primary key(s). - */ - public function buildPkeyCriteria() - { - $criteria = new Criteria(CcTransPeer::DATABASE_NAME); - $criteria->add(CcTransPeer::ID, $this->id); - - return $criteria; - } - - /** - * Returns the primary key for this object (row). - * @return int - */ - public function getPrimaryKey() - { - return $this->getId(); - } - - /** - * Generic method to set the primary key (id column). - * - * @param int $key Primary key. - * @return void - */ - public function setPrimaryKey($key) - { - $this->setId($key); - } - - /** - * Returns true if the primary key for this object is null. - * @return boolean - */ - public function isPrimaryKeyNull() - { - return null === $this->getId(); - } - - /** - * Sets contents of passed object to values from current object. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param object $copyObj An object of CcTrans (or compatible) type. - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @throws PropelException - */ - public function copyInto($copyObj, $deepCopy = false) - { - $copyObj->setTrtok($this->trtok); - $copyObj->setDirection($this->direction); - $copyObj->setState($this->state); - $copyObj->setTrtype($this->trtype); - $copyObj->setLock($this->lock); - $copyObj->setTarget($this->target); - $copyObj->setRtrtok($this->rtrtok); - $copyObj->setMdtrtok($this->mdtrtok); - $copyObj->setGunid($this->gunid); - $copyObj->setPdtoken($this->pdtoken); - $copyObj->setUrl($this->url); - $copyObj->setLocalfile($this->localfile); - $copyObj->setFname($this->fname); - $copyObj->setTitle($this->title); - $copyObj->setExpectedsum($this->expectedsum); - $copyObj->setRealsum($this->realsum); - $copyObj->setExpectedsize($this->expectedsize); - $copyObj->setRealsize($this->realsize); - $copyObj->setUid($this->uid); - $copyObj->setErrmsg($this->errmsg); - $copyObj->setJobpid($this->jobpid); - $copyObj->setStart($this->start); - $copyObj->setTs($this->ts); - - $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value - } - - /** - * Makes a copy of this object that will be inserted as a new row in table when saved. - * It creates a new object filling in the simple attributes, but skipping any primary - * keys that are defined for the table. - * - * If desired, this method can also make copies of all associated (fkey referrers) - * objects. - * - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return CcTrans Clone of current object. - * @throws PropelException - */ - public function copy($deepCopy = false) - { - // we use get_class(), because this might be a subclass - $clazz = get_class($this); - $copyObj = new $clazz(); - $this->copyInto($copyObj, $deepCopy); - return $copyObj; - } - - /** - * Returns a peer instance associated with this om. - * - * Since Peer classes are not to have any instance attributes, this method returns the - * same instance for all member of this class. The method could therefore - * be static, but this would prevent one from overriding the behavior. - * - * @return CcTransPeer - */ - public function getPeer() - { - if (self::$peer === null) { - self::$peer = new CcTransPeer(); - } - return self::$peer; - } - - /** - * Clears the current object and sets all attributes to their default values - */ - public function clear() - { - $this->id = null; - $this->trtok = null; - $this->direction = null; - $this->state = null; - $this->trtype = null; - $this->lock = null; - $this->target = null; - $this->rtrtok = null; - $this->mdtrtok = null; - $this->gunid = null; - $this->pdtoken = null; - $this->url = null; - $this->localfile = null; - $this->fname = null; - $this->title = null; - $this->expectedsum = null; - $this->realsum = null; - $this->expectedsize = null; - $this->realsize = null; - $this->uid = null; - $this->errmsg = null; - $this->jobpid = null; - $this->start = null; - $this->ts = null; - $this->alreadyInSave = false; - $this->alreadyInValidation = false; - $this->clearAllReferences(); - $this->applyDefaultValues(); - $this->resetModified(); - $this->setNew(true); - $this->setDeleted(false); - } - - /** - * Resets all collections of referencing foreign keys. - * - * This method is a user-space workaround for PHP's inability to garbage collect objects - * with circular references. This is currently necessary when using Propel in certain - * daemon or large-volumne/high-memory operations. - * - * @param boolean $deep Whether to also clear the references on all associated objects. - */ - public function clearAllReferences($deep = false) - { - if ($deep) { - } // if ($deep) - - } - - /** - * Catches calls to virtual methods - */ - public function __call($name, $params) - { - if (preg_match('/get(\w+)/', $name, $matches)) { - $virtualColumn = $matches[1]; - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - // no lcfirst in php<5.3... - $virtualColumn[0] = strtolower($virtualColumn[0]); - if ($this->hasVirtualColumn($virtualColumn)) { - return $this->getVirtualColumn($virtualColumn); - } - } - throw new PropelException('Call to undefined method: ' . $name); - } - -} // BaseCcTrans diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcTransPeer.php b/backend/propel-db/build/classes/campcaster/om/BaseCcTransPeer.php deleted file mode 100644 index c8dd333a9..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcTransPeer.php +++ /dev/null @@ -1,849 +0,0 @@ - array ('Id', 'Trtok', 'Direction', 'State', 'Trtype', 'Lock', 'Target', 'Rtrtok', 'Mdtrtok', 'Gunid', 'Pdtoken', 'Url', 'Localfile', 'Fname', 'Title', 'Expectedsum', 'Realsum', 'Expectedsize', 'Realsize', 'Uid', 'Errmsg', 'Jobpid', 'Start', 'Ts', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'trtok', 'direction', 'state', 'trtype', 'lock', 'target', 'rtrtok', 'mdtrtok', 'gunid', 'pdtoken', 'url', 'localfile', 'fname', 'title', 'expectedsum', 'realsum', 'expectedsize', 'realsize', 'uid', 'errmsg', 'jobpid', 'start', 'ts', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::TRTOK, self::DIRECTION, self::STATE, self::TRTYPE, self::LOCK, self::TARGET, self::RTRTOK, self::MDTRTOK, self::GUNID, self::PDTOKEN, self::URL, self::LOCALFILE, self::FNAME, self::TITLE, self::EXPECTEDSUM, self::REALSUM, self::EXPECTEDSIZE, self::REALSIZE, self::UID, self::ERRMSG, self::JOBPID, self::START, self::TS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TRTOK', 'DIRECTION', 'STATE', 'TRTYPE', 'LOCK', 'TARGET', 'RTRTOK', 'MDTRTOK', 'GUNID', 'PDTOKEN', 'URL', 'LOCALFILE', 'FNAME', 'TITLE', 'EXPECTEDSUM', 'REALSUM', 'EXPECTEDSIZE', 'REALSIZE', 'UID', 'ERRMSG', 'JOBPID', 'START', 'TS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'trtok', 'direction', 'state', 'trtype', 'lock', 'target', 'rtrtok', 'mdtrtok', 'gunid', 'pdtoken', 'url', 'localfile', 'fname', 'title', 'expectedsum', 'realsum', 'expectedsize', 'realsize', 'uid', 'errmsg', 'jobpid', 'start', 'ts', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) - ); - - /** - * holds an array of keys for quick access to the fieldnames array - * - * first dimension keys are the type constants - * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 - */ - private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Trtok' => 1, 'Direction' => 2, 'State' => 3, 'Trtype' => 4, 'Lock' => 5, 'Target' => 6, 'Rtrtok' => 7, 'Mdtrtok' => 8, 'Gunid' => 9, 'Pdtoken' => 10, 'Url' => 11, 'Localfile' => 12, 'Fname' => 13, 'Title' => 14, 'Expectedsum' => 15, 'Realsum' => 16, 'Expectedsize' => 17, 'Realsize' => 18, 'Uid' => 19, 'Errmsg' => 20, 'Jobpid' => 21, 'Start' => 22, 'Ts' => 23, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'trtok' => 1, 'direction' => 2, 'state' => 3, 'trtype' => 4, 'lock' => 5, 'target' => 6, 'rtrtok' => 7, 'mdtrtok' => 8, 'gunid' => 9, 'pdtoken' => 10, 'url' => 11, 'localfile' => 12, 'fname' => 13, 'title' => 14, 'expectedsum' => 15, 'realsum' => 16, 'expectedsize' => 17, 'realsize' => 18, 'uid' => 19, 'errmsg' => 20, 'jobpid' => 21, 'start' => 22, 'ts' => 23, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TRTOK => 1, self::DIRECTION => 2, self::STATE => 3, self::TRTYPE => 4, self::LOCK => 5, self::TARGET => 6, self::RTRTOK => 7, self::MDTRTOK => 8, self::GUNID => 9, self::PDTOKEN => 10, self::URL => 11, self::LOCALFILE => 12, self::FNAME => 13, self::TITLE => 14, self::EXPECTEDSUM => 15, self::REALSUM => 16, self::EXPECTEDSIZE => 17, self::REALSIZE => 18, self::UID => 19, self::ERRMSG => 20, self::JOBPID => 21, self::START => 22, self::TS => 23, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TRTOK' => 1, 'DIRECTION' => 2, 'STATE' => 3, 'TRTYPE' => 4, 'LOCK' => 5, 'TARGET' => 6, 'RTRTOK' => 7, 'MDTRTOK' => 8, 'GUNID' => 9, 'PDTOKEN' => 10, 'URL' => 11, 'LOCALFILE' => 12, 'FNAME' => 13, 'TITLE' => 14, 'EXPECTEDSUM' => 15, 'REALSUM' => 16, 'EXPECTEDSIZE' => 17, 'REALSIZE' => 18, 'UID' => 19, 'ERRMSG' => 20, 'JOBPID' => 21, 'START' => 22, 'TS' => 23, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'trtok' => 1, 'direction' => 2, 'state' => 3, 'trtype' => 4, 'lock' => 5, 'target' => 6, 'rtrtok' => 7, 'mdtrtok' => 8, 'gunid' => 9, 'pdtoken' => 10, 'url' => 11, 'localfile' => 12, 'fname' => 13, 'title' => 14, 'expectedsum' => 15, 'realsum' => 16, 'expectedsize' => 17, 'realsize' => 18, 'uid' => 19, 'errmsg' => 20, 'jobpid' => 21, 'start' => 22, 'ts' => 23, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) - ); - - /** - * Translates a fieldname to another type - * - * @param string $name field name - * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @param string $toType One of the class type constants - * @return string translated name of the field. - * @throws PropelException - if the specified name could not be found in the fieldname mappings. - */ - static public function translateFieldName($name, $fromType, $toType) - { - $toNames = self::getFieldNames($toType); - $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; - if ($key === null) { - throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); - } - return $toNames[$key]; - } - - /** - * Returns an array of field names. - * - * @param string $type The type of fieldnames to return: - * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME - * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM - * @return array A list of field names - */ - - static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) - { - if (!array_key_exists($type, self::$fieldNames)) { - throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); - } - return self::$fieldNames[$type]; - } - - /** - * Convenience method which changes table.column to alias.column. - * - * Using this method you can maintain SQL abstraction while using column aliases. - * - * $c->addAlias("alias1", TablePeer::TABLE_NAME); - * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); - * - * @param string $alias The alias for the current table. - * @param string $column The column name for current table. (i.e. CcTransPeer::COLUMN_NAME). - * @return string - */ - public static function alias($alias, $column) - { - return str_replace(CcTransPeer::TABLE_NAME.'.', $alias.'.', $column); - } - - /** - * Add all the columns needed to create a new object. - * - * Note: any columns that were marked with lazyLoad="true" in the - * XML schema will not be added to the select list and only loaded - * on demand. - * - * @param Criteria $criteria object containing the columns to add. - * @param string $alias optional table alias - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function addSelectColumns(Criteria $criteria, $alias = null) - { - if (null === $alias) { - $criteria->addSelectColumn(CcTransPeer::ID); - $criteria->addSelectColumn(CcTransPeer::TRTOK); - $criteria->addSelectColumn(CcTransPeer::DIRECTION); - $criteria->addSelectColumn(CcTransPeer::STATE); - $criteria->addSelectColumn(CcTransPeer::TRTYPE); - $criteria->addSelectColumn(CcTransPeer::LOCK); - $criteria->addSelectColumn(CcTransPeer::TARGET); - $criteria->addSelectColumn(CcTransPeer::RTRTOK); - $criteria->addSelectColumn(CcTransPeer::MDTRTOK); - $criteria->addSelectColumn(CcTransPeer::GUNID); - $criteria->addSelectColumn(CcTransPeer::PDTOKEN); - $criteria->addSelectColumn(CcTransPeer::URL); - $criteria->addSelectColumn(CcTransPeer::LOCALFILE); - $criteria->addSelectColumn(CcTransPeer::FNAME); - $criteria->addSelectColumn(CcTransPeer::TITLE); - $criteria->addSelectColumn(CcTransPeer::EXPECTEDSUM); - $criteria->addSelectColumn(CcTransPeer::REALSUM); - $criteria->addSelectColumn(CcTransPeer::EXPECTEDSIZE); - $criteria->addSelectColumn(CcTransPeer::REALSIZE); - $criteria->addSelectColumn(CcTransPeer::UID); - $criteria->addSelectColumn(CcTransPeer::ERRMSG); - $criteria->addSelectColumn(CcTransPeer::JOBPID); - $criteria->addSelectColumn(CcTransPeer::START); - $criteria->addSelectColumn(CcTransPeer::TS); - } else { - $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.TRTOK'); - $criteria->addSelectColumn($alias . '.DIRECTION'); - $criteria->addSelectColumn($alias . '.STATE'); - $criteria->addSelectColumn($alias . '.TRTYPE'); - $criteria->addSelectColumn($alias . '.LOCK'); - $criteria->addSelectColumn($alias . '.TARGET'); - $criteria->addSelectColumn($alias . '.RTRTOK'); - $criteria->addSelectColumn($alias . '.MDTRTOK'); - $criteria->addSelectColumn($alias . '.GUNID'); - $criteria->addSelectColumn($alias . '.PDTOKEN'); - $criteria->addSelectColumn($alias . '.URL'); - $criteria->addSelectColumn($alias . '.LOCALFILE'); - $criteria->addSelectColumn($alias . '.FNAME'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.EXPECTEDSUM'); - $criteria->addSelectColumn($alias . '.REALSUM'); - $criteria->addSelectColumn($alias . '.EXPECTEDSIZE'); - $criteria->addSelectColumn($alias . '.REALSIZE'); - $criteria->addSelectColumn($alias . '.UID'); - $criteria->addSelectColumn($alias . '.ERRMSG'); - $criteria->addSelectColumn($alias . '.JOBPID'); - $criteria->addSelectColumn($alias . '.START'); - $criteria->addSelectColumn($alias . '.TS'); - } - } - - /** - * Returns the number of rows matching criteria. - * - * @param Criteria $criteria - * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. - * @param PropelPDO $con - * @return int Number of matching rows. - */ - public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) - { - // we may modify criteria, so copy it first - $criteria = clone $criteria; - - // We need to set the primary table name, since in the case that there are no WHERE columns - // it will be impossible for the BasePeer::createSelectSql() method to determine which - // tables go into the FROM clause. - $criteria->setPrimaryTableName(CcTransPeer::TABLE_NAME); - - if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { - $criteria->setDistinct(); - } - - if (!$criteria->hasSelectClause()) { - CcTransPeer::addSelectColumns($criteria); - } - - $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count - $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName - - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - // BasePeer returns a PDOStatement - $stmt = BasePeer::doCount($criteria, $con); - - if ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $count = (int) $row[0]; - } else { - $count = 0; // no rows returned; we infer that means 0 matches. - } - $stmt->closeCursor(); - return $count; - } - /** - * Method to select one object from the DB. - * - * @param Criteria $criteria object used to create the SELECT statement. - * @param PropelPDO $con - * @return CcTrans - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) - { - $critcopy = clone $criteria; - $critcopy->setLimit(1); - $objects = CcTransPeer::doSelect($critcopy, $con); - if ($objects) { - return $objects[0]; - } - return null; - } - /** - * Method to do selects. - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con - * @return array Array of selected Objects - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doSelect(Criteria $criteria, PropelPDO $con = null) - { - return CcTransPeer::populateObjects(CcTransPeer::doSelectStmt($criteria, $con)); - } - /** - * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. - * - * Use this method directly if you want to work with an executed statement durirectly (for example - * to perform your own object hydration). - * - * @param Criteria $criteria The Criteria object used to build the SELECT statement. - * @param PropelPDO $con The connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. - * @see BasePeer::doSelect() - */ - public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - if (!$criteria->hasSelectClause()) { - $criteria = clone $criteria; - CcTransPeer::addSelectColumns($criteria); - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - // BasePeer returns a PDOStatement - return BasePeer::doSelect($criteria, $con); - } - /** - * Adds an object to the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doSelect*() - * methods in your stub classes -- you may need to explicitly add objects - * to the cache in order to ensure that the same objects are always returned by doSelect*() - * and retrieveByPK*() calls. - * - * @param CcTrans $value A CcTrans object. - * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). - */ - public static function addInstanceToPool(CcTrans $obj, $key = null) - { - if (Propel::isInstancePoolingEnabled()) { - if ($key === null) { - $key = (string) $obj->getId(); - } // if key === null - self::$instances[$key] = $obj; - } - } - - /** - * Removes an object from the instance pool. - * - * Propel keeps cached copies of objects in an instance pool when they are retrieved - * from the database. In some cases -- especially when you override doDelete - * methods in your stub classes -- you may need to explicitly remove objects - * from the cache in order to prevent returning objects that no longer exist. - * - * @param mixed $value A CcTrans object or a primary key value. - */ - public static function removeInstanceFromPool($value) - { - if (Propel::isInstancePoolingEnabled() && $value !== null) { - if (is_object($value) && $value instanceof CcTrans) { - $key = (string) $value->getId(); - } elseif (is_scalar($value)) { - // assume we've been passed a primary key - $key = (string) $value; - } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcTrans object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); - throw $e; - } - - unset(self::$instances[$key]); - } - } // removeInstanceFromPool() - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param string $key The key (@see getPrimaryKeyHash()) for this instance. - * @return CcTrans Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. - * @see getPrimaryKeyHash() - */ - public static function getInstanceFromPool($key) - { - if (Propel::isInstancePoolingEnabled()) { - if (isset(self::$instances[$key])) { - return self::$instances[$key]; - } - } - return null; // just to be explicit - } - - /** - * Clear the instance pool. - * - * @return void - */ - public static function clearInstancePool() - { - self::$instances = array(); - } - - /** - * Method to invalidate the instance pool of all tables related to cc_trans - * by a foreign key with ON DELETE CASCADE - */ - public static function clearRelatedInstancePool() - { - } - - /** - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. - * - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, a serialize()d version of the primary key will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return string A string version of PK or NULL if the components of primary key in result array are all null. - */ - public static function getPrimaryKeyHashFromRow($row, $startcol = 0) - { - // If the PK cannot be derived from the row, return NULL. - if ($row[$startcol] === null) { - return null; - } - return (string) $row[$startcol]; - } - - /** - * Retrieves the primary key from the DB resultset row - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with - * a multi-column primary key, an array of the primary key columns will be returned. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @return mixed The primary key of the row - */ - public static function getPrimaryKeyFromRow($row, $startcol = 0) - { - return (int) $row[$startcol]; - } - - /** - * The returned array will contain objects of the default type or - * objects that inherit from the default. - * - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function populateObjects(PDOStatement $stmt) - { - $results = array(); - - // set the class once to avoid overhead in the loop - $cls = CcTransPeer::getOMClass(false); - // populate the object(s) - while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - $key = CcTransPeer::getPrimaryKeyHashFromRow($row, 0); - if (null !== ($obj = CcTransPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, 0, true); // rehydrate - $results[] = $obj; - } else { - $obj = new $cls(); - $obj->hydrate($row); - $results[] = $obj; - CcTransPeer::addInstanceToPool($obj, $key); - } // if key exists - } - $stmt->closeCursor(); - return $results; - } - /** - * Populates an object of the default type or an object that inherit from the default. - * - * @param array $row PropelPDO resultset row. - * @param int $startcol The 0-based offset for reading from the resultset row. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - * @return array (CcTrans object, last column rank) - */ - public static function populateObject($row, $startcol = 0) - { - $key = CcTransPeer::getPrimaryKeyHashFromRow($row, $startcol); - if (null !== ($obj = CcTransPeer::getInstanceFromPool($key))) { - // We no longer rehydrate the object, since this can cause data loss. - // See http://www.propelorm.org/ticket/509 - // $obj->hydrate($row, $startcol, true); // rehydrate - $col = $startcol + CcTransPeer::NUM_COLUMNS; - } else { - $cls = CcTransPeer::OM_CLASS; - $obj = new $cls(); - $col = $obj->hydrate($row, $startcol); - CcTransPeer::addInstanceToPool($obj, $key); - } - return array($obj, $col); - } - /** - * Returns the TableMap related to this peer. - * This method is not needed for general use but a specific application could have a need. - * @return TableMap - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function getTableMap() - { - return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); - } - - /** - * Add a TableMap instance to the database for this peer class. - */ - public static function buildTableMap() - { - $dbMap = Propel::getDatabaseMap(BaseCcTransPeer::DATABASE_NAME); - if (!$dbMap->hasTable(BaseCcTransPeer::TABLE_NAME)) - { - $dbMap->addTableObject(new CcTransTableMap()); - } - } - - /** - * The class that the Peer will make instances of. - * - * If $withPrefix is true, the returned path - * uses a dot-path notation which is tranalted into a path - * relative to a location on the PHP include_path. - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') - * - * @param boolean $withPrefix Whether or not to return the path with the class name - * @return string path.to.ClassName - */ - public static function getOMClass($withPrefix = true) - { - return $withPrefix ? CcTransPeer::CLASS_DEFAULT : CcTransPeer::OM_CLASS; - } - - /** - * Method perform an INSERT on the database, given a CcTrans or Criteria object. - * - * @param mixed $values Criteria or CcTrans object containing data that is used to create the INSERT statement. - * @param PropelPDO $con the PropelPDO connection to use - * @return mixed The new primary key. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doInsert($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - } else { - $criteria = $values->buildCriteria(); // build Criteria from CcTrans object - } - - if ($criteria->containsKey(CcTransPeer::ID) && $criteria->keyContainsValue(CcTransPeer::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTransPeer::ID.')'); - } - - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - try { - // use transaction because $criteria could contain info - // for more than one table (I guess, conceivably) - $con->beginTransaction(); - $pk = BasePeer::doInsert($criteria, $con); - $con->commit(); - } catch(PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $pk; - } - - /** - * Method perform an UPDATE on the database, given a CcTrans or Criteria object. - * - * @param mixed $values Criteria or CcTrans object containing data that is used to create the UPDATE statement. - * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). - * @return int The number of affected rows (if supported by underlying database driver). - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doUpdate($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - $selectCriteria = new Criteria(self::DATABASE_NAME); - - if ($values instanceof Criteria) { - $criteria = clone $values; // rename for clarity - - $comparison = $criteria->getComparison(CcTransPeer::ID); - $value = $criteria->remove(CcTransPeer::ID); - if ($value) { - $selectCriteria->add(CcTransPeer::ID, $value, $comparison); - } else { - $selectCriteria->setPrimaryTableName(CcTransPeer::TABLE_NAME); - } - - } else { // $values is CcTrans object - $criteria = $values->buildCriteria(); // gets full criteria - $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) - } - - // set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - return BasePeer::doUpdate($selectCriteria, $criteria, $con); - } - - /** - * Method to DELETE all rows from the cc_trans table. - * - * @return int The number of affected rows (if supported by underlying database driver). - */ - public static function doDeleteAll($con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += BasePeer::doDeleteAll(CcTransPeer::TABLE_NAME, $con, CcTransPeer::DATABASE_NAME); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CcTransPeer::clearInstancePool(); - CcTransPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Method perform a DELETE on the database, given a CcTrans or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or CcTrans object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param PropelPDO $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function doDelete($values, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); - } - - if ($values instanceof Criteria) { - // invalidate the cache for all objects of this type, since we have no - // way of knowing (without running a query) what objects should be invalidated - // from the cache based on this Criteria. - CcTransPeer::clearInstancePool(); - // rename for clarity - $criteria = clone $values; - } elseif ($values instanceof CcTrans) { // it's a model object - // invalidate the cache for this single object - CcTransPeer::removeInstanceFromPool($values); - // create criteria based on pk values - $criteria = $values->buildPkeyCriteria(); - } else { // it's a primary key, or an array of pks - $criteria = new Criteria(self::DATABASE_NAME); - $criteria->add(CcTransPeer::ID, (array) $values, Criteria::IN); - // invalidate the cache for this object(s) - foreach ((array) $values as $singleval) { - CcTransPeer::removeInstanceFromPool($singleval); - } - } - - // Set the correct dbName - $criteria->setDbName(self::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - $affectedRows += BasePeer::doDelete($criteria, $con); - CcTransPeer::clearRelatedInstancePool(); - $con->commit(); - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - /** - * Validates all modified columns of given CcTrans object. - * If parameter $columns is either a single column name or an array of column names - * than only those columns are validated. - * - * NOTICE: This does not apply to primary or foreign keys for now. - * - * @param CcTrans $obj The object to validate. - * @param mixed $cols Column name or array of column names. - * - * @return mixed TRUE if all columns are valid or the error message of the first invalid column. - */ - public static function doValidate(CcTrans $obj, $cols = null) - { - $columns = array(); - - if ($cols) { - $dbMap = Propel::getDatabaseMap(CcTransPeer::DATABASE_NAME); - $tableMap = $dbMap->getTable(CcTransPeer::TABLE_NAME); - - if (! is_array($cols)) { - $cols = array($cols); - } - - foreach ($cols as $colName) { - if ($tableMap->containsColumn($colName)) { - $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); - $columns[$colName] = $obj->$get(); - } - } - } else { - - } - - return BasePeer::doValidate(CcTransPeer::DATABASE_NAME, CcTransPeer::TABLE_NAME, $columns); - } - - /** - * Retrieve a single object by pkey. - * - * @param int $pk the primary key. - * @param PropelPDO $con the connection to use - * @return CcTrans - */ - public static function retrieveByPK($pk, PropelPDO $con = null) - { - - if (null !== ($obj = CcTransPeer::getInstanceFromPool((string) $pk))) { - return $obj; - } - - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $criteria = new Criteria(CcTransPeer::DATABASE_NAME); - $criteria->add(CcTransPeer::ID, $pk); - - $v = CcTransPeer::doSelect($criteria, $con); - - return !empty($v) > 0 ? $v[0] : null; - } - - /** - * Retrieve multiple objects by pkey. - * - * @param array $pks List of primary keys - * @param PropelPDO $con the connection to use - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public static function retrieveByPKs($pks, PropelPDO $con = null) - { - if ($con === null) { - $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); - } - - $objs = null; - if (empty($pks)) { - $objs = array(); - } else { - $criteria = new Criteria(CcTransPeer::DATABASE_NAME); - $criteria->add(CcTransPeer::ID, $pks, Criteria::IN); - $objs = CcTransPeer::doSelect($criteria, $con); - } - return $objs; - } - -} // BaseCcTransPeer - -// This is the static code needed to register the TableMap for this table with the main Propel class. -// -BaseCcTransPeer::buildTableMap(); - diff --git a/backend/propel-db/build/classes/campcaster/om/BaseCcTransQuery.php b/backend/propel-db/build/classes/campcaster/om/BaseCcTransQuery.php deleted file mode 100644 index e00396ef6..000000000 --- a/backend/propel-db/build/classes/campcaster/om/BaseCcTransQuery.php +++ /dev/null @@ -1,826 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - return $query; - } - - /** - * Find object by primary key - * Use instance pooling to avoid a database query if the object exists - * - * $obj = $c->findPk(12, $con); - * - * @param mixed $key Primary key to use for the query - * @param PropelPDO $con an optional connection object - * - * @return CcTrans|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ((null !== ($obj = CcTransPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { - // the object is alredy in the instance pool - return $obj; - } else { - // the object has not been requested yet, or the formatter is not an object formatter - $criteria = $this->isKeepQuery() ? clone $this : $this; - $stmt = $criteria - ->filterByPrimaryKey($key) - ->getSelectStatement($con); - return $criteria->getFormatter()->init($criteria)->formatOne($stmt); - } - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param PropelPDO $con an optional connection object - * - * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - $criteria = $this->isKeepQuery() ? clone $this : $this; - return $this - ->filterByPrimaryKeys($keys) - ->find($con); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - return $this->addUsingAlias(CcTransPeer::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - return $this->addUsingAlias(CcTransPeer::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * @param int|array $id The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id) && null === $comparison) { - $comparison = Criteria::IN; - } - return $this->addUsingAlias(CcTransPeer::ID, $id, $comparison); - } - - /** - * Filter the query on the trtok column - * - * @param string $trtok The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByTrtok($trtok = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($trtok)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $trtok)) { - $trtok = str_replace('*', '%', $trtok); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::TRTOK, $trtok, $comparison); - } - - /** - * Filter the query on the direction column - * - * @param string $direction The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByDirection($direction = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($direction)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $direction)) { - $direction = str_replace('*', '%', $direction); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::DIRECTION, $direction, $comparison); - } - - /** - * Filter the query on the state column - * - * @param string $state The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByState($state = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($state)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $state)) { - $state = str_replace('*', '%', $state); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::STATE, $state, $comparison); - } - - /** - * Filter the query on the trtype column - * - * @param string $trtype The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByTrtype($trtype = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($trtype)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $trtype)) { - $trtype = str_replace('*', '%', $trtype); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::TRTYPE, $trtype, $comparison); - } - - /** - * Filter the query on the lock column - * - * @param string $lock The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByLock($lock = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($lock)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $lock)) { - $lock = str_replace('*', '%', $lock); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::LOCK, $lock, $comparison); - } - - /** - * Filter the query on the target column - * - * @param string $target The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByTarget($target = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($target)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $target)) { - $target = str_replace('*', '%', $target); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::TARGET, $target, $comparison); - } - - /** - * Filter the query on the rtrtok column - * - * @param string $rtrtok The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByRtrtok($rtrtok = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($rtrtok)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $rtrtok)) { - $rtrtok = str_replace('*', '%', $rtrtok); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::RTRTOK, $rtrtok, $comparison); - } - - /** - * Filter the query on the mdtrtok column - * - * @param string $mdtrtok The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByMdtrtok($mdtrtok = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($mdtrtok)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $mdtrtok)) { - $mdtrtok = str_replace('*', '%', $mdtrtok); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::MDTRTOK, $mdtrtok, $comparison); - } - - /** - * Filter the query on the gunid column - * - * @param string $gunid The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByGunid($gunid = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($gunid)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $gunid)) { - $gunid = str_replace('*', '%', $gunid); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::GUNID, $gunid, $comparison); - } - - /** - * Filter the query on the pdtoken column - * - * @param string|array $pdtoken The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByPdtoken($pdtoken = null, $comparison = null) - { - if (is_array($pdtoken)) { - $useMinMax = false; - if (isset($pdtoken['min'])) { - $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($pdtoken['max'])) { - $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken, $comparison); - } - - /** - * Filter the query on the url column - * - * @param string $url The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByUrl($url = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($url)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $url)) { - $url = str_replace('*', '%', $url); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::URL, $url, $comparison); - } - - /** - * Filter the query on the localfile column - * - * @param string $localfile The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByLocalfile($localfile = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($localfile)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $localfile)) { - $localfile = str_replace('*', '%', $localfile); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::LOCALFILE, $localfile, $comparison); - } - - /** - * Filter the query on the fname column - * - * @param string $fname The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByFname($fname = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($fname)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $fname)) { - $fname = str_replace('*', '%', $fname); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::FNAME, $fname, $comparison); - } - - /** - * Filter the query on the title column - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::TITLE, $title, $comparison); - } - - /** - * Filter the query on the expectedsum column - * - * @param string $expectedsum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByExpectedsum($expectedsum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($expectedsum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $expectedsum)) { - $expectedsum = str_replace('*', '%', $expectedsum); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::EXPECTEDSUM, $expectedsum, $comparison); - } - - /** - * Filter the query on the realsum column - * - * @param string $realsum The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByRealsum($realsum = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($realsum)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $realsum)) { - $realsum = str_replace('*', '%', $realsum); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::REALSUM, $realsum, $comparison); - } - - /** - * Filter the query on the expectedsize column - * - * @param int|array $expectedsize The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByExpectedsize($expectedsize = null, $comparison = null) - { - if (is_array($expectedsize)) { - $useMinMax = false; - if (isset($expectedsize['min'])) { - $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($expectedsize['max'])) { - $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize, $comparison); - } - - /** - * Filter the query on the realsize column - * - * @param int|array $realsize The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByRealsize($realsize = null, $comparison = null) - { - if (is_array($realsize)) { - $useMinMax = false; - if (isset($realsize['min'])) { - $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($realsize['max'])) { - $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize, $comparison); - } - - /** - * Filter the query on the uid column - * - * @param int|array $uid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByUid($uid = null, $comparison = null) - { - if (is_array($uid)) { - $useMinMax = false; - if (isset($uid['min'])) { - $this->addUsingAlias(CcTransPeer::UID, $uid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($uid['max'])) { - $this->addUsingAlias(CcTransPeer::UID, $uid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::UID, $uid, $comparison); - } - - /** - * Filter the query on the errmsg column - * - * @param string $errmsg The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByErrmsg($errmsg = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($errmsg)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $errmsg)) { - $errmsg = str_replace('*', '%', $errmsg); - $comparison = Criteria::LIKE; - } - } - return $this->addUsingAlias(CcTransPeer::ERRMSG, $errmsg, $comparison); - } - - /** - * Filter the query on the jobpid column - * - * @param int|array $jobpid The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByJobpid($jobpid = null, $comparison = null) - { - if (is_array($jobpid)) { - $useMinMax = false; - if (isset($jobpid['min'])) { - $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($jobpid['max'])) { - $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid, $comparison); - } - - /** - * Filter the query on the start column - * - * @param string|array $start The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByStart($start = null, $comparison = null) - { - if (is_array($start)) { - $useMinMax = false; - if (isset($start['min'])) { - $this->addUsingAlias(CcTransPeer::START, $start['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($start['max'])) { - $this->addUsingAlias(CcTransPeer::START, $start['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::START, $start, $comparison); - } - - /** - * Filter the query on the ts column - * - * @param string|array $ts The value to use as filter. - * Accepts an associative array('min' => $minValue, 'max' => $maxValue) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return CcTransQuery The current query, for fluid interface - */ - public function filterByTs($ts = null, $comparison = null) - { - if (is_array($ts)) { - $useMinMax = false; - if (isset($ts['min'])) { - $this->addUsingAlias(CcTransPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($ts['max'])) { - $this->addUsingAlias(CcTransPeer::TS, $ts['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - return $this->addUsingAlias(CcTransPeer::TS, $ts, $comparison); - } - - /** - * Exclude object from result - * - * @param CcTrans $ccTrans Object to remove from the list of results - * - * @return CcTransQuery The current query, for fluid interface - */ - public function prune($ccTrans = null) - { - if ($ccTrans) { - $this->addUsingAlias(CcTransPeer::ID, $ccTrans->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - -} // BaseCcTransQuery diff --git a/backend/propel-db/build/conf/campcaster-conf.php b/backend/propel-db/build/conf/campcaster-conf.php deleted file mode 100644 index 562e1fffb..000000000 --- a/backend/propel-db/build/conf/campcaster-conf.php +++ /dev/null @@ -1,20 +0,0 @@ - - array ( - 'campcaster' => - array ( - 'adapter' => 'pgsql', - 'connection' => - array ( - 'dsn' => 'pgsql:host=localhost;port=5432;dbname=campcaster;user=campcaster;password=campcaster', - ), - ), - 'default' => 'campcaster', - ), - 'generator_version' => '1.5.2', -); -$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-campcaster-conf.php'); -return $conf; \ No newline at end of file diff --git a/backend/propel-db/build/conf/classmap-campcaster-conf.php b/backend/propel-db/build/conf/classmap-campcaster-conf.php deleted file mode 100644 index b5e883082..000000000 --- a/backend/propel-db/build/conf/classmap-campcaster-conf.php +++ /dev/null @@ -1,88 +0,0 @@ - 'campcaster/map/CcAccessTableMap.php', - 'CcAccessPeer' => 'campcaster/CcAccessPeer.php', - 'CcAccess' => 'campcaster/CcAccess.php', - 'CcAccessQuery' => 'campcaster/CcAccessQuery.php', - 'BaseCcAccessPeer' => 'campcaster/om/BaseCcAccessPeer.php', - 'BaseCcAccess' => 'campcaster/om/BaseCcAccess.php', - 'BaseCcAccessQuery' => 'campcaster/om/BaseCcAccessQuery.php', - 'CcBackupTableMap' => 'campcaster/map/CcBackupTableMap.php', - 'CcBackupPeer' => 'campcaster/CcBackupPeer.php', - 'CcBackup' => 'campcaster/CcBackup.php', - 'CcBackupQuery' => 'campcaster/CcBackupQuery.php', - 'BaseCcBackupPeer' => 'campcaster/om/BaseCcBackupPeer.php', - 'BaseCcBackup' => 'campcaster/om/BaseCcBackup.php', - 'BaseCcBackupQuery' => 'campcaster/om/BaseCcBackupQuery.php', - 'CcFilesTableMap' => 'campcaster/map/CcFilesTableMap.php', - 'CcFilesPeer' => 'campcaster/CcFilesPeer.php', - 'CcFiles' => 'campcaster/CcFiles.php', - 'CcFilesQuery' => 'campcaster/CcFilesQuery.php', - 'BaseCcFilesPeer' => 'campcaster/om/BaseCcFilesPeer.php', - 'BaseCcFiles' => 'campcaster/om/BaseCcFiles.php', - 'BaseCcFilesQuery' => 'campcaster/om/BaseCcFilesQuery.php', - 'CcPermsTableMap' => 'campcaster/map/CcPermsTableMap.php', - 'CcPermsPeer' => 'campcaster/CcPermsPeer.php', - 'CcPerms' => 'campcaster/CcPerms.php', - 'CcPermsQuery' => 'campcaster/CcPermsQuery.php', - 'BaseCcPermsPeer' => 'campcaster/om/BaseCcPermsPeer.php', - 'BaseCcPerms' => 'campcaster/om/BaseCcPerms.php', - 'BaseCcPermsQuery' => 'campcaster/om/BaseCcPermsQuery.php', - 'CcPlaylistTableMap' => 'campcaster/map/CcPlaylistTableMap.php', - 'CcPlaylistPeer' => 'campcaster/CcPlaylistPeer.php', - 'CcPlaylist' => 'campcaster/CcPlaylist.php', - 'CcPlaylistQuery' => 'campcaster/CcPlaylistQuery.php', - 'BaseCcPlaylistPeer' => 'campcaster/om/BaseCcPlaylistPeer.php', - 'BaseCcPlaylist' => 'campcaster/om/BaseCcPlaylist.php', - 'BaseCcPlaylistQuery' => 'campcaster/om/BaseCcPlaylistQuery.php', - 'CcPlaylistcontentsTableMap' => 'campcaster/map/CcPlaylistcontentsTableMap.php', - 'CcPlaylistcontentsPeer' => 'campcaster/CcPlaylistcontentsPeer.php', - 'CcPlaylistcontents' => 'campcaster/CcPlaylistcontents.php', - 'CcPlaylistcontentsQuery' => 'campcaster/CcPlaylistcontentsQuery.php', - 'BaseCcPlaylistcontentsPeer' => 'campcaster/om/BaseCcPlaylistcontentsPeer.php', - 'BaseCcPlaylistcontents' => 'campcaster/om/BaseCcPlaylistcontents.php', - 'BaseCcPlaylistcontentsQuery' => 'campcaster/om/BaseCcPlaylistcontentsQuery.php', - 'CcPrefTableMap' => 'campcaster/map/CcPrefTableMap.php', - 'CcPrefPeer' => 'campcaster/CcPrefPeer.php', - 'CcPref' => 'campcaster/CcPref.php', - 'CcPrefQuery' => 'campcaster/CcPrefQuery.php', - 'BaseCcPrefPeer' => 'campcaster/om/BaseCcPrefPeer.php', - 'BaseCcPref' => 'campcaster/om/BaseCcPref.php', - 'BaseCcPrefQuery' => 'campcaster/om/BaseCcPrefQuery.php', - 'CcScheduleTableMap' => 'campcaster/map/CcScheduleTableMap.php', - 'CcSchedulePeer' => 'campcaster/CcSchedulePeer.php', - 'CcSchedule' => 'campcaster/CcSchedule.php', - 'CcScheduleQuery' => 'campcaster/CcScheduleQuery.php', - 'BaseCcSchedulePeer' => 'campcaster/om/BaseCcSchedulePeer.php', - 'BaseCcSchedule' => 'campcaster/om/BaseCcSchedule.php', - 'BaseCcScheduleQuery' => 'campcaster/om/BaseCcScheduleQuery.php', - 'CcSessTableMap' => 'campcaster/map/CcSessTableMap.php', - 'CcSessPeer' => 'campcaster/CcSessPeer.php', - 'CcSess' => 'campcaster/CcSess.php', - 'CcSessQuery' => 'campcaster/CcSessQuery.php', - 'BaseCcSessPeer' => 'campcaster/om/BaseCcSessPeer.php', - 'BaseCcSess' => 'campcaster/om/BaseCcSess.php', - 'BaseCcSessQuery' => 'campcaster/om/BaseCcSessQuery.php', - 'CcSmembTableMap' => 'campcaster/map/CcSmembTableMap.php', - 'CcSmembPeer' => 'campcaster/CcSmembPeer.php', - 'CcSmemb' => 'campcaster/CcSmemb.php', - 'CcSmembQuery' => 'campcaster/CcSmembQuery.php', - 'BaseCcSmembPeer' => 'campcaster/om/BaseCcSmembPeer.php', - 'BaseCcSmemb' => 'campcaster/om/BaseCcSmemb.php', - 'BaseCcSmembQuery' => 'campcaster/om/BaseCcSmembQuery.php', - 'CcSubjsTableMap' => 'campcaster/map/CcSubjsTableMap.php', - 'CcSubjsPeer' => 'campcaster/CcSubjsPeer.php', - 'CcSubjs' => 'campcaster/CcSubjs.php', - 'CcSubjsQuery' => 'campcaster/CcSubjsQuery.php', - 'BaseCcSubjsPeer' => 'campcaster/om/BaseCcSubjsPeer.php', - 'BaseCcSubjs' => 'campcaster/om/BaseCcSubjs.php', - 'BaseCcSubjsQuery' => 'campcaster/om/BaseCcSubjsQuery.php', - 'CcTransTableMap' => 'campcaster/map/CcTransTableMap.php', - 'CcTransPeer' => 'campcaster/CcTransPeer.php', - 'CcTrans' => 'campcaster/CcTrans.php', - 'CcTransQuery' => 'campcaster/CcTransQuery.php', - 'BaseCcTransPeer' => 'campcaster/om/BaseCcTransPeer.php', - 'BaseCcTrans' => 'campcaster/om/BaseCcTrans.php', - 'BaseCcTransQuery' => 'campcaster/om/BaseCcTransQuery.php', -); \ No newline at end of file diff --git a/backend/propel-db/build/sql/schema.sql b/backend/propel-db/build/sql/schema.sql deleted file mode 100644 index 38ae1b962..000000000 --- a/backend/propel-db/build/sql/schema.sql +++ /dev/null @@ -1,388 +0,0 @@ - ------------------------------------------------------------------------------ --- cc_access ------------------------------------------------------------------------------ - -DROP TABLE "cc_access" CASCADE; - - -CREATE TABLE "cc_access" -( - "id" serial NOT NULL, - "gunid" CHAR(32), - "token" INT8, - "chsum" CHAR(32) default '' NOT NULL, - "ext" VARCHAR(128) default '' NOT NULL, - "type" VARCHAR(20) default '' NOT NULL, - "parent" INT8, - "owner" INTEGER, - "ts" TIMESTAMP, - PRIMARY KEY ("id") -); - -COMMENT ON TABLE "cc_access" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_access_gunid_idx" ON "cc_access" ("gunid"); - -CREATE INDEX "cc_access_parent_idx" ON "cc_access" ("parent"); - -CREATE INDEX "cc_access_token_idx" ON "cc_access" ("token"); - ------------------------------------------------------------------------------ --- cc_backup ------------------------------------------------------------------------------ - -DROP TABLE "cc_backup" CASCADE; - - -CREATE TABLE "cc_backup" -( - "token" VARCHAR(64) NOT NULL, - "sessionid" VARCHAR(64) NOT NULL, - "status" VARCHAR(32) NOT NULL, - "fromtime" TIMESTAMP NOT NULL, - "totime" TIMESTAMP NOT NULL, - PRIMARY KEY ("token") -); - -COMMENT ON TABLE "cc_backup" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_files ------------------------------------------------------------------------------ - -DROP TABLE "cc_files" CASCADE; - - -CREATE TABLE "cc_files" -( - "id" serial NOT NULL, - "gunid" CHAR(32) NOT NULL, - "name" VARCHAR(255) default '' NOT NULL, - "mime" VARCHAR(255) default '' NOT NULL, - "ftype" VARCHAR(128) default '' NOT NULL, - "filepath" TEXT default '', - "state" VARCHAR(128) default 'empty' NOT NULL, - "currentlyaccessing" INTEGER default 0 NOT NULL, - "editedby" INTEGER, - "mtime" TIMESTAMP(6), - "md5" CHAR(32), - "track_title" VARCHAR(512), - "artist_name" VARCHAR(512), - "bit_rate" VARCHAR(32), - "sample_rate" VARCHAR(32), - "format" VARCHAR(128), - "length" TIME, - "album_title" VARCHAR(512), - "genre" VARCHAR(64), - "comments" TEXT, - "year" VARCHAR(16), - "track_number" INTEGER, - "channels" INTEGER, - "url" VARCHAR(1024), - "bpm" VARCHAR(8), - "rating" VARCHAR(8), - "encoded_by" VARCHAR(255), - "disc_number" VARCHAR(8), - "mood" VARCHAR(64), - "label" VARCHAR(512), - "composer" VARCHAR(512), - "encoder" VARCHAR(64), - "checksum" VARCHAR(256), - "lyrics" TEXT, - "orchestra" VARCHAR(512), - "conductor" VARCHAR(512), - "lyricist" VARCHAR(512), - "original_lyricist" VARCHAR(512), - "radio_station_name" VARCHAR(512), - "info_url" VARCHAR(512), - "artist_url" VARCHAR(512), - "audio_source_url" VARCHAR(512), - "radio_station_url" VARCHAR(512), - "buy_this_url" VARCHAR(512), - "isrc_number" VARCHAR(512), - "catalog_number" VARCHAR(512), - "original_artist" VARCHAR(512), - "copyright" VARCHAR(512), - "report_datetime" VARCHAR(32), - "report_location" VARCHAR(512), - "report_organization" VARCHAR(512), - "subject" VARCHAR(512), - "contributor" VARCHAR(512), - "language" VARCHAR(512), - PRIMARY KEY ("id"), - CONSTRAINT "cc_files_gunid_idx" UNIQUE ("gunid") -); - -COMMENT ON TABLE "cc_files" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_files_md5_idx" ON "cc_files" ("md5"); - -CREATE INDEX "cc_files_name_idx" ON "cc_files" ("name"); - ------------------------------------------------------------------------------ --- cc_perms ------------------------------------------------------------------------------ - -DROP TABLE "cc_perms" CASCADE; - - -CREATE TABLE "cc_perms" -( - "permid" INTEGER NOT NULL, - "subj" INTEGER, - "action" VARCHAR(20), - "obj" INTEGER, - "type" CHAR(1), - PRIMARY KEY ("permid"), - CONSTRAINT "cc_perms_all_idx" UNIQUE ("subj","action","obj"), - CONSTRAINT "cc_perms_permid_idx" UNIQUE ("permid") -); - -COMMENT ON TABLE "cc_perms" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_perms_subj_obj_idx" ON "cc_perms" ("subj","obj"); - ------------------------------------------------------------------------------ --- cc_playlist ------------------------------------------------------------------------------ - -DROP TABLE "cc_playlist" CASCADE; - - -CREATE TABLE "cc_playlist" -( - "id" serial NOT NULL, - "name" VARCHAR(255) default '' NOT NULL, - "state" VARCHAR(128) default 'empty' NOT NULL, - "currentlyaccessing" INTEGER default 0 NOT NULL, - "editedby" INTEGER, - "mtime" TIMESTAMP(6), - "creator" VARCHAR(32), - "description" VARCHAR(512), - PRIMARY KEY ("id") -); - -COMMENT ON TABLE "cc_playlist" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_playlistcontents ------------------------------------------------------------------------------ - -DROP TABLE "cc_playlistcontents" CASCADE; - - -CREATE TABLE "cc_playlistcontents" -( - "id" serial NOT NULL, - "playlist_id" INTEGER, - "file_id" INTEGER, - "position" INTEGER, - "cliplength" TIME default '00:00:00', - "cuein" TIME default '00:00:00', - "cueout" TIME default '00:00:00', - "fadein" TIME default '00:00:00', - "fadeout" TIME default '00:00:00', - PRIMARY KEY ("id") -); - -COMMENT ON TABLE "cc_playlistcontents" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_pref ------------------------------------------------------------------------------ - -DROP TABLE "cc_pref" CASCADE; - - -CREATE TABLE "cc_pref" -( - "id" serial NOT NULL, - "subjid" INTEGER, - "keystr" VARCHAR(255), - "valstr" TEXT, - PRIMARY KEY ("id"), - CONSTRAINT "cc_pref_id_idx" UNIQUE ("id"), - CONSTRAINT "cc_pref_subj_key_idx" UNIQUE ("subjid","keystr") -); - -COMMENT ON TABLE "cc_pref" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_pref_subjid_idx" ON "cc_pref" ("subjid"); - ------------------------------------------------------------------------------ --- cc_schedule ------------------------------------------------------------------------------ - -DROP TABLE "cc_schedule" CASCADE; - - -CREATE TABLE "cc_schedule" -( - "id" INT8 NOT NULL, - "playlist_id" INTEGER NOT NULL, - "starts" TIMESTAMP NOT NULL, - "ends" TIMESTAMP NOT NULL, - "group_id" INTEGER, - "file_id" INTEGER, - "clip_length" TIME default '00:00:00', - "fade_in" TIME default '00:00:00', - "fade_out" TIME default '00:00:00', - "cue_in" TIME default '00:00:00', - "cue_out" TIME default '00:00:00', - "schedule_group_played" BOOLEAN default 'f', - "media_item_played" BOOLEAN default 'f', - PRIMARY KEY ("id") -); - -COMMENT ON TABLE "cc_schedule" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_sess ------------------------------------------------------------------------------ - -DROP TABLE "cc_sess" CASCADE; - - -CREATE TABLE "cc_sess" -( - "sessid" CHAR(32) NOT NULL, - "userid" INTEGER, - "login" VARCHAR(255), - "ts" TIMESTAMP, - PRIMARY KEY ("sessid") -); - -COMMENT ON TABLE "cc_sess" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login"); - -CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid"); - ------------------------------------------------------------------------------ --- cc_smemb ------------------------------------------------------------------------------ - -DROP TABLE "cc_smemb" CASCADE; - - -CREATE TABLE "cc_smemb" -( - "id" INTEGER NOT NULL, - "uid" INTEGER default 0 NOT NULL, - "gid" INTEGER default 0 NOT NULL, - "level" INTEGER default 0 NOT NULL, - "mid" INTEGER, - PRIMARY KEY ("id"), - CONSTRAINT "cc_smemb_id_idx" UNIQUE ("id") -); - -COMMENT ON TABLE "cc_smemb" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_subjs ------------------------------------------------------------------------------ - -DROP TABLE "cc_subjs" CASCADE; - - -CREATE TABLE "cc_subjs" -( - "id" INTEGER NOT NULL, - "login" VARCHAR(255) default '' NOT NULL, - "pass" VARCHAR(255) default '' NOT NULL, - "type" CHAR(1) default 'U' NOT NULL, - "realname" VARCHAR(255) default '' NOT NULL, - "lastlogin" TIMESTAMP, - "lastfail" TIMESTAMP, - PRIMARY KEY ("id"), - CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"), - CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login") -); - -COMMENT ON TABLE "cc_subjs" IS ''; - - -SET search_path TO public; ------------------------------------------------------------------------------ --- cc_trans ------------------------------------------------------------------------------ - -DROP TABLE "cc_trans" CASCADE; - - -CREATE TABLE "cc_trans" -( - "id" serial NOT NULL, - "trtok" CHAR(16) NOT NULL, - "direction" VARCHAR(128) NOT NULL, - "state" VARCHAR(128) NOT NULL, - "trtype" VARCHAR(128) NOT NULL, - "lock" CHAR(1) default 'N' NOT NULL, - "target" VARCHAR(255), - "rtrtok" CHAR(16), - "mdtrtok" CHAR(16), - "gunid" CHAR(32), - "pdtoken" INT8, - "url" VARCHAR(255), - "localfile" VARCHAR(255), - "fname" VARCHAR(255), - "title" VARCHAR(255), - "expectedsum" CHAR(32), - "realsum" CHAR(32), - "expectedsize" INTEGER, - "realsize" INTEGER, - "uid" INTEGER, - "errmsg" VARCHAR(255), - "jobpid" INTEGER, - "start" TIMESTAMP, - "ts" TIMESTAMP, - PRIMARY KEY ("id"), - CONSTRAINT "cc_trans_id_idx" UNIQUE ("id"), - CONSTRAINT "cc_trans_token_idx" UNIQUE ("pdtoken"), - CONSTRAINT "cc_trans_trtok_idx" UNIQUE ("trtok") -); - -COMMENT ON TABLE "cc_trans" IS ''; - - -SET search_path TO public; -CREATE INDEX "cc_trans_gunid_idx" ON "cc_trans" ("gunid"); - -CREATE INDEX "cc_trans_state_idx" ON "cc_trans" ("state"); - -ALTER TABLE "cc_access" ADD CONSTRAINT "cc_access_owner_fkey" FOREIGN KEY ("owner") REFERENCES "cc_subjs" ("id"); - -ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id"); - -ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey" FOREIGN KEY ("subj") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; - -ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id"); - -ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE; - -ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey" FOREIGN KEY ("playlist_id") REFERENCES "cc_playlist" ("id") ON DELETE CASCADE; - -ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; - -ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; diff --git a/backend/propel-db/build/sql/sequences.sql b/backend/propel-db/build/sql/sequences.sql deleted file mode 100644 index 2eb10faee..000000000 --- a/backend/propel-db/build/sql/sequences.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP SEQUENCE schedule_group_id_seq CASCADE; - -CREATE SEQUENCE schedule_group_id_seq; diff --git a/backend/propel-db/build/sql/sqldb.map b/backend/propel-db/build/sql/sqldb.map deleted file mode 100644 index 0eb7c6b2b..000000000 --- a/backend/propel-db/build/sql/sqldb.map +++ /dev/null @@ -1,5 +0,0 @@ -# Sqlfile -> Database map -schema.sql=campcaster -sequences.sql=campcaster -views.sql=campcaster -triggers.sql=campcaster diff --git a/backend/propel-db/build/sql/triggers.sql b/backend/propel-db/build/sql/triggers.sql deleted file mode 100644 index c059ffe80..000000000 --- a/backend/propel-db/build/sql/triggers.sql +++ /dev/null @@ -1,23 +0,0 @@ ----------------------------------------------------------------------------------- ---calculate_position() ----------------------------------------------------------------------------------- -DROP FUNCTION calculate_position() CASCADE; - -CREATE FUNCTION calculate_position() RETURNS trigger AS - ' - BEGIN - IF(TG_OP=''INSERT'') THEN - UPDATE cc_playlistcontents SET position = (position + 1) - WHERE (playlist_id = new.playlist_id AND position >= new.position AND id != new.id); - END IF; - IF(TG_OP=''DELETE'') THEN - UPDATE cc_playlistcontents SET position = (position - 1) - WHERE (playlist_id = old.playlist_id AND position > old.position); - END IF; - RETURN NULL; - END; - ' - LANGUAGE 'plpgsql'; - -CREATE TRIGGER calculate_position AFTER INSERT OR DELETE ON cc_playlistcontents -FOR EACH ROW EXECUTE PROCEDURE calculate_position(); diff --git a/backend/propel-db/build/sql/views.sql b/backend/propel-db/build/sql/views.sql deleted file mode 100644 index 08eec6a5b..000000000 --- a/backend/propel-db/build/sql/views.sql +++ /dev/null @@ -1,11 +0,0 @@ -------------------------------------------------------- ----cc_playlisttimes -------------------------------------------------------- - -CREATE VIEW cc_playlisttimes AS -SELECT pl.id, COALESCE(t.length, '00:00:00'::time without time zone) AS length - FROM cc_playlist pl - LEFT JOIN ( SELECT cc_playlistcontents.playlist_id AS id, - sum(cc_playlistcontents.cliplength::interval)::time without time zone AS length - FROM cc_playlistcontents - GROUP BY cc_playlistcontents.playlist_id) t ON pl.id = t.id; diff --git a/backend/propel-db/runtime-conf.xml b/backend/propel-db/runtime-conf.xml deleted file mode 100644 index 4c83aa481..000000000 --- a/backend/propel-db/runtime-conf.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - pgsql - - pgsql:host=localhost;port=5432;dbname=campcaster;user=campcaster;password=campcaster - - - - - diff --git a/backend/propel-db/schema.xml b/backend/propel-db/schema.xml deleted file mode 100644 index 8741b649c..000000000 --- a/backend/propel-db/schema.xml +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    diff --git a/backend/propel-db/test.php b/backend/propel-db/test.php deleted file mode 100644 index 3c6767d99..000000000 --- a/backend/propel-db/test.php +++ /dev/null @@ -1,14 +0,0 @@ -setName("Playlist in Campcaster!"); -$pl->save(); - diff --git a/backend/tests/0000000000010001 b/backend/tests/0000000000010001 deleted file mode 100644 index 5fe526402..000000000 Binary files a/backend/tests/0000000000010001 and /dev/null differ diff --git a/backend/tests/0000000000010002 b/backend/tests/0000000000010002 deleted file mode 100644 index 1219a9056..000000000 Binary files a/backend/tests/0000000000010002 and /dev/null differ diff --git a/backend/tests/AllTests.php b/backend/tests/AllTests.php deleted file mode 100644 index add11030e..000000000 --- a/backend/tests/AllTests.php +++ /dev/null @@ -1,24 +0,0 @@ -addTestSuite("PlaylistTests"); -$suite->addTestSuite("SchedulerTests"); -//$suite->addTestSuite("SchedulerExportTests"); -$result = PHPUnit::run($suite); - -echo $result->toString(); - -?> diff --git a/backend/tests/PlaylistTests.php b/backend/tests/PlaylistTests.php deleted file mode 100644 index bd8bc95bf..000000000 --- a/backend/tests/PlaylistTests.php +++ /dev/null @@ -1,181 +0,0 @@ -getMessage()." ".$CC_DBC->getUserInfo()."\n"; - exit(1); -} -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -class PlaylistTests extends PHPUnit_TestCase { - - private $greenbox; - private $storedFile; - private $storedFile2; - - function __construct($name) { - parent::__construct($name); - } - - function setup() { - global $CC_CONFIG, $CC_DBC; - $this->greenbox = new GreenBox(); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10001.mp3"); - $this->storedFile = StoredFile::Insert($values, false); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10002.mp3"); - $this->storedFile2 = StoredFile::Insert($values, false); - - } - - function testGBCreatePlaylist() { - - $pl = new Playlist(); - $pl_id = $pl->create("Playlist UnitTest: create ".date("g:i a")); - - if (!is_int($pl_id)) { - $this->fail("problems creating playlist."); - return; - } - } - - function testGBLock() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist Metadata: lock ".date("g:i a")); - - $sessid = Alib::Login('root', 'q'); - - $res = $this->greenbox->lockPlaylistForEdit($pl_id, $sessid); - - if($res !== TRUE) { - $this->fail("problems locking playlist for editing."); - return; - } - } - - function testGBUnLock() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist UnitTest: unlock ".date("g:i a")); - - $sessid = Alib::Login('root', 'q'); - - $this->greenbox->lockPlaylistForEdit($pl_id, $sessid); - $res = $this->greenbox->releaseLockedPlaylist($pl_id, $sessid); - - if($res !== TRUE) { - $this->fail("problems unlocking playlist."); - return; - } - } - - function testGBSetPLMetaData() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist UnitTest: Set Metadata ".date("g:i a")); - - $res = $this->greenbox->setPLMetadataValue($pl_id, "dc:title", "Playlist Unit Test: Updated Title ".date("g:i a")); - - if($res !== TRUE) { - $this->fail("problems setting playlist metadata."); - return; - } - } - - function testGBGetPLMetaData() { - $pl = new Playlist(); - $name = "Playlist UnitTest: GetMetadata ".date("g:i a"); - $pl_id = $pl->create($name); - - $res = $this->greenbox->getPLMetadataValue($pl_id, "dc:title"); - - if($res !== $name) { - $this->fail("problems getting playlist metadata."); - return; - } - } - - function testAddAudioClip() { - - $pl = new Playlist(); - $pl_id = $pl->create("Playlist Unit Test ". date("g:i a")); - $res = $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile->getId()); - if($res !== TRUE) { - $this->fail("problems adding audioclip to playlist."); - return; - } - - $res = $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile2->getId()); - if($res !== TRUE) { - $this->fail("problems adding audioclip 2 to playlist."); - return; - } - } - - function testMoveAudioClip() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist Unit Test: Move ". date("g:i a")); - - $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile->getId()); - $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile2->getId()); - - $res = $this->greenbox->moveAudioClipInPlaylist($pl_id, 0, 1); - - if($res !== TRUE) { - $this->fail("problems moving audioclip in playlist."); - return; - } - } - - function testDeleteAudioClip() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist UnitTest: Delete ".date("g:i a")); - - $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile->getId()); - $res = $this->greenbox->delAudioClipFromPlaylist($pl_id, 0); - - if($res !== TRUE) { - $this->fail("problems deleting audioclip from playlist."); - return; - } - } - - function testFadeInfo() { - $pl = new Playlist(); - $pl_id = $pl->create("Playlist Unit Test: Fade Info " . date("g:i a")); - - $this->greenbox->addAudioClipToPlaylist($pl_id, $this->storedFile2->getId()); - - $res = $this->greenbox->changeFadeInfo($pl_id, 0, '00:00:01.14', null); - - if(!is_array($res) && count($res) !== 2) { - $this->fail("problems setting fade in playlist."); - return; - } - } -} - -?> diff --git a/backend/tests/SchedulerExportTests.php b/backend/tests/SchedulerExportTests.php deleted file mode 100644 index 6bdbd4ee2..000000000 --- a/backend/tests/SchedulerExportTests.php +++ /dev/null @@ -1,42 +0,0 @@ -query($sql); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10001.mp3"); - $this->storedFile = StoredFile::Insert($values, false); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10002.mp3"); - $this->storedFile2 = StoredFile::Insert($values, false); - - // Clear the schedule table - $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]; - $CC_DBC->query($sql); - - // Create a playlist - $playlist = new Playlist(); - $playlist->create("Scheduler Unit Test"); - $result = $playlist->addAudioClip($this->storedFile->getId()); - $result = $playlist->addAudioClip($this->storedFile2->getId()); - $result = $playlist->addAudioClip($this->storedFile2->getId()); - - // Schedule it - $i = new ScheduleGroup(); - $this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId()); - } - - public function testExport() { - echo Schedule::ExportRangeAsJson("2010-01-01 00:00:00", "2011-01-01 00:00:00"); - } -} - -?> \ No newline at end of file diff --git a/backend/tests/SchedulerTests.php b/backend/tests/SchedulerTests.php deleted file mode 100644 index 36c0084df..000000000 --- a/backend/tests/SchedulerTests.php +++ /dev/null @@ -1,128 +0,0 @@ -query($sql); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10001.mp3"); - $this->storedFile = StoredFile::Insert($values, false); - - // Add a file - $values = array("filepath" => dirname(__FILE__)."/test10002.mp3"); - $this->storedFile2 = StoredFile::Insert($values, false); - - // Clear the schedule table - //$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]; - //$CC_DBC->query($sql); - } - - function testDateToId() { - $dateStr = "2006-04-02 10:20:08.123456"; - $id = ScheduleGroup::dateToId($dateStr); - $expected = "20060402102008123"; - if ($id != $expected) { - $this->fail("Did not convert date to ID correctly #1: $id != $expected"); - } - - $dateStr = "2006-04-02 10:20:08"; - $id = ScheduleGroup::dateToId($dateStr); - $expected = "20060402102008000"; - if ($id != $expected) { - $this->fail("Did not convert date to ID correctly #2: $id != $expected"); - } - } - - function testAddAndRemoveAudioFile() { - $i = new ScheduleGroup(); - $this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId()); - if (PEAR::isError($this->groupIdCreated)) { - $this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage()); - } - - $i = new ScheduleGroup($this->groupIdCreated); - $result = $i->remove(); - if ($result != 1) { - $this->fail("Did not remove item."); - } - } - - function testAddAndRemovePlaylist() { - // Create a playlist - $playlist = new Playlist(); - $playlist->create("Scheduler Unit Test ".uniqid()); - $result = $playlist->addAudioClip($this->storedFile->getId()); - $result = $playlist->addAudioClip($this->storedFile2->getId()); - $result = $playlist->addAudioClip($this->storedFile2->getId()); - - $i = new ScheduleGroup(); - $this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId()); - if (PEAR::isError($this->groupIdCreated)) { - $this->fail("Failed to create scheduled item: ". $this->groupIdCreated->getMessage()); - } - $group = new ScheduleGroup($this->groupIdCreated); - if ($group->count() != 3) { - $this->fail("Wrong number of items added."); - } - $items = $group->getItems(); - if (!is_array($items) || ($items[1]["starts"] != "2010-11-11 01:30:34.231")) { - $this->fail("Wrong start time for 2nd item."); - } - - $result = $group->remove(); - if ($result != 1) { - $this->fail("Did not remove item."); - } - - Playlist::Delete($playlist->getId()); - } - - function testIsScheduleEmptyInRange() { - $i = new ScheduleGroup(); - $this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId()); - if (PEAR::isError($this->groupIdCreated)) { - $this->fail($this->groupIdCreated->getMessage()); - return; - } - if (Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) { - $this->fail("Reporting empty schedule when it isnt."); - return; - } - // echo "groupid: ".$this->groupIdCreated."\n"; - $success = $i->remove(); - if ($success === false) { - $this->fail("Failed to delete schedule group."); - return; - } - if (!Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) { - $this->fail("Reporting booked schedule when it isnt."); - return; - } - } - - function testGetItems() { - $i1 = new ScheduleGroup(); - $groupId1 = $i1->add('2008-01-01 12:00:00.000', $this->storedFile->getId()); - $i2 = new ScheduleGroup(); - $i2->addAfter($groupId1, $this->storedFile->getId()); - $items = Schedule::GetItems("2008-01-01", "2008-01-02"); - if (count($items) != 2) { - $this->fail("Wrong number of items returned."); - return; - } - $i1->remove(); - $i2->remove(); - } -} - -?> \ No newline at end of file diff --git a/backend/tests/StoredFileTests.php b/backend/tests/StoredFileTests.php deleted file mode 100644 index e2ebcca08..000000000 --- a/backend/tests/StoredFileTests.php +++ /dev/null @@ -1,87 +0,0 @@ -getMessage()." ".$CC_DBC->getUserInfo()."\n"; - exit(1); -} -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -class StoredFileTest extends PHPUnit_TestCase { - - function __construct($name) { - parent::__construct($name); - } - - function setup() { - } - - function testGetAudioMetadata() { - $filePath = dirname(__FILE__)."/ex1.mp3"; - $metadata = camp_get_audio_metadata($filePath); - if (PEAR::isError($metadata)) { - $this->fail($metadata->getMessage()); - return; - } - if (($metadata["dc:description"] != "Tmu sem tam videla ...") - || ($metadata["audio"]["dataformat"] != "mp3") - || ($metadata["dc:type"] != "Speech")) { - $str = " [dc:description] = " . $metadata["dc:description"] ."\n" - . " [audio][dataformat] = " . $metadata["audio"]["dataformat"]."\n" - . " [dc:type] = ".$metadata["dc:type"]."\n"; - $this->fail("Metadata has unexpected values:\n".$str); - } - //var_dump($metadata); - //$this->assertTrue(FALSE); - } - - function testDeleteAndPutFile() { - $STORAGE_SERVER_PATH = dirname(__FILE__)."/../../"; - $filePath = dirname(__FILE__)."/ex1.mp3"; - - // Delete any old data from previous tests - $md5 = md5_file($filePath); - $duplicate = StoredFile::RecallByMd5($md5); - if ($duplicate) { - $duplicate->delete(); - } - - // Test inserting a file by linking - $values = array("filepath" => $filePath, - "dc:description" => "Unit test ".time()); - $storedFile = StoredFile::Insert($values, false); - if (PEAR::isError($storedFile)) { - $this->fail("Failed to create StoredFile: ".$storedFile->getMessage()); - return; - } - //var_dump($storedFile); - $id = $storedFile->getId(); - if (!is_numeric($id)) { - $this->fail("StoredFile not created correctly. id = ".$id); - return; - } - - // Test loading metadata - $f = new StoredFile(); - $f->__setGunid($storedFile->getGunid()); - $f->loadMetadata(); - if (!is_array($md = $f->getMetadata())) { - $this->fail("Unable to load metadata."); - return; - } - //var_dump($md); - - // Check if the length field has been set. - $f2 = StoredFile::RecallByGunid($storedFile->getGunid()); - $m2 = $f2->getMetadata(); - if (!isset($m2["length"]) || $m2["length"] == "00:00:00.000000") { - $this->fail("Length not reporting correctly in metadata."); - return; - } - - } - -} -?> \ No newline at end of file diff --git a/backend/tests/analyze.php b/backend/tests/analyze.php deleted file mode 100755 index c1435b9c8..000000000 --- a/backend/tests/analyze.php +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/php -q -analyzeFile(); - -echo "r=$r (".gettype($r).")\n"; -if (PEAR::isError($r)) { - echo "ERR: ".$r->getMessage()."\n".$r->getUserInfo()."\n"; -} -if (is_array($r)) { - print_r($r); -} -echo"\n"; -?> \ No newline at end of file diff --git a/backend/tests/ex1.mp3 b/backend/tests/ex1.mp3 deleted file mode 100644 index 9d1f20156..000000000 Binary files a/backend/tests/ex1.mp3 and /dev/null differ diff --git a/backend/tests/ex2.ogg b/backend/tests/ex2.ogg deleted file mode 100644 index d018a4a11..000000000 Binary files a/backend/tests/ex2.ogg and /dev/null differ diff --git a/backend/tests/ex2.wav b/backend/tests/ex2.wav deleted file mode 100644 index 8d1eddce9..000000000 Binary files a/backend/tests/ex2.wav and /dev/null differ diff --git a/backend/tests/ex3.wav b/backend/tests/ex3.wav deleted file mode 100644 index 785f4edb3..000000000 Binary files a/backend/tests/ex3.wav and /dev/null differ diff --git a/backend/tests/exportedPl_lspl.tar b/backend/tests/exportedPl_lspl.tar deleted file mode 100644 index 42cfb22dd..000000000 Binary files a/backend/tests/exportedPl_lspl.tar and /dev/null differ diff --git a/backend/tests/index.php b/backend/tests/index.php deleted file mode 100644 index 125fdaf8e..000000000 --- a/backend/tests/index.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/backend/tests/pdoTest.php b/backend/tests/pdoTest.php deleted file mode 100644 index 3aae4465b..000000000 --- a/backend/tests/pdoTest.php +++ /dev/null @@ -1,22 +0,0 @@ -= '2010-01-01 00:00:00.000') " - ." AND (ends <= (TIMESTAMP '2011-01-01 00:00:00.000' + INTERVAL '01:00:00.123456'))"; -$rows1 = $con->query($sql); -var_dump($rows1->fetchAll()); - -$sql2 = "SELECT COUNT(*) FROM cc_playlistcontents"; -$rows2 = $con->query($sql2); -var_dump($rows2->fetchAll()); - -$sql3 = "SELECT TIMESTAMP '2011-01-01 00:00:00.000' + INTERVAL '01:00:00.123456'"; -$result3 = $con->query($sql3); -var_dump($result3->fetchAll()); - -?> \ No newline at end of file diff --git a/backend/tests/plistEmbedded.xml b/backend/tests/plistEmbedded.xml deleted file mode 100644 index db9b7ce03..000000000 --- a/backend/tests/plistEmbedded.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - embedded playlist - 01:30:11.500000 - - - diff --git a/backend/tests/pypoTester.php b/backend/tests/pypoTester.php deleted file mode 100644 index 4443b14c1..000000000 --- a/backend/tests/pypoTester.php +++ /dev/null @@ -1,85 +0,0 @@ -delete(); -} -echo "done.\n"; - -// Create a new playlist -echo "Creating new playlist '$playlistName'..."; -$pl = new Playlist(); -$pl->create($playlistName); - -// Add a media clip -$mediaFile = StoredFile::findByOriginalName("Manolo Camp - Morning Coffee.mp3"); -if (is_null($mediaFile)) { - echo "Adding test audio clip to the database.\n"; - $v = array("filepath" => __DIR__."/../../audio_samples/OpSound/Manolo Camp - Morning Coffee.mp3"); - $mediaFile = StoredFile::Insert($v); - if (PEAR::isError($mediaFile)) { - var_dump($mediaFile); - exit(); - } -} -$pl->addAudioClip($mediaFile->getId()); -$mediaFile = StoredFile::findByOriginalName("Peter Rudenko - Opening.mp3"); -if (is_null($mediaFile)) { - echo "Adding test audio clip to the database.\n"; - $v = array("filepath" => __DIR__."/../../audio_samples/OpSound/Peter Rudenko - Opening.mp3"); - $mediaFile = StoredFile::Insert($v); - if (PEAR::isError($mediaFile)) { - var_dump($mediaFile); - exit(); - } -} -$pl->addAudioClip($mediaFile->getId()); -echo "done.\n"; - -//$pl2 = Playlist::findPlaylistByName("pypo_playlist_test"); -//var_dump($pl2); - -// Get current time -// In the format YYYY-MM-DD HH:MM:SS.nnnnnn -$startTime = date("Y-m-d H:i:s"); -$endTime = date("Y-m-d H:i:s", time()+(60*60)); - -echo "Removing everything from the scheduler between $startTime and $endTime..."; -// Scheduler: remove any playlists for the next hour -Schedule::RemoveItemsInRange($startTime, $endTime); -// Check for succcess -$scheduleClear = Schedule::isScheduleEmptyInRange($startTime, "01:00:00"); -if (!$scheduleClear) { - echo "\nERROR: Schedule could not be cleared.\n\n"; - var_dump(Schedule::GetItems($startTime, $endTime)); - exit; -} -echo "done.\n"; - -// Schedule the playlist for two minutes from now -echo "Scheduling new playlist...\n"; -$playTime = date("Y-m-d H:i:s", time()+(60*$minutesFromNow)); -$scheduleGroup = new ScheduleGroup(); -$scheduleGroup->add($playTime, null, $pl->getId()); - -echo " SUCCESS: Playlist scheduled at $playTime\n\n"; -?> \ No newline at end of file diff --git a/backend/tests/question.wav b/backend/tests/question.wav deleted file mode 100644 index 6c8b2a0cb..000000000 Binary files a/backend/tests/question.wav and /dev/null differ diff --git a/backend/tests/test10001.mp3 b/backend/tests/test10001.mp3 deleted file mode 100644 index c5631e435..000000000 Binary files a/backend/tests/test10001.mp3 and /dev/null differ diff --git a/backend/tests/test10002.mp3 b/backend/tests/test10002.mp3 deleted file mode 100644 index a7fe34c06..000000000 Binary files a/backend/tests/test10002.mp3 and /dev/null differ diff --git a/backend/tests/test10003.mp3 b/backend/tests/test10003.mp3 deleted file mode 100644 index a98fa3730..000000000 Binary files a/backend/tests/test10003.mp3 and /dev/null differ diff --git a/backend/tests/transTest.php b/backend/tests/transTest.php deleted file mode 100644 index edf04354c..000000000 --- a/backend/tests/transTest.php +++ /dev/null @@ -1,143 +0,0 @@ -\n"); -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); -$gb = new GreenBox(); -$tr = new Transport($gb); -$ls = new LocStor(); -@unlink($CC_CONFIG['transDir']."/activity.log"); -@unlink($CC_CONFIG['transDir']."/debug.log"); -$tr->_cleanUp(); - -$gunid = 'a23456789abcdefb'; -$mediaFile = '../tests/ex1.mp3'; -$mdataFile = '../tests/mdata1.xml'; - -// Test remote search -$result = $tr->remoteSearch(""); -if (PEAR::isError($result)) { - echo $result->message."\n"; -} else { - var_dump($result); -} - -// ========== STORE ========== - -echo"# Store: "; -//$parid = $gb->_getHomeDirIdFromSess($sessid); -$values = array( - "filename" => "xx1.mp3", - "filepath" => $mediaFile, - "metadata" => $mdataFile, - "gunid" => $gunid, - "filetype" => "audioclip" -); -$storedFile = StoredFile::Insert($values); -if (PEAR::isError($storedFile)) { - if ($storedFile->getCode()!=GBERR_GUNID) { - echo "ERROR: ".$storedFile->getMessage()."\n"; - exit(1); - } -} -$oid = $storedFile->getId(); -$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`; -echo "$oid\n"; - -// ========== DELETE FROM HUB ========== -echo"# loginToArchive: "; -$r = $tr->loginToArchive(); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; exit(1); } -echo "{$r['sessid']}\n"; -$asessid = $r['sessid']; -echo"# deleteAudioClip on Hub: "; -$r = $tr->xmlrpcCall( - 'archive.deleteAudioClip', - array( - 'sessid' => $asessid, - 'gunid' => $gunid, - 'forced' => TRUE, - ) -); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; if($r->getCode()!=800+GBERR_FILENEX) exit(1); } -else{ echo " {$r['status']}\n"; } -echo"# logoutFromArchive: "; -$r = $tr->logoutFromArchive($asessid); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()." / ".$r->getUserInfo()."\n"; exit(1); } -var_export($r); echo"\n"; - - -// ========== UPLOAD ========== -echo "# UPLOAD test:\n"; -echo"# uploadAudioClip2Hub: "; -$r = $gb->upload2Hub($gunid); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } -var_export($r); echo"\n"; -$trtok = $r; - -echo"# logout: "; $r = Alib::Logout($sessid); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } -echo "$r\n"; -#$trtok='280a6f1c18389620'; - -for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){ - echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok); - if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } - $state = $r['state']; - echo "# state=$state, title={$r['title']}\n"; -} -if($state=='failed') exit(1); - -// === DELETE LOCAL === -echo "# Login: ".($sessid = Alib::Login('root', 'q'))."\n"; -echo "# Delete: "; $r = $ls->deleteAudioClip($sessid, $gunid, TRUE); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()."\n"; - exit(1); -} -echo "$r\n"; -echo "# logout: "; $r = Alib::Logout($sessid); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()."\n"; - exit(1); -} -echo "$r\n"; -$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; -echo `$comm`; - -// === DOWNLOAD === -echo "# DOWNLOAD test:\n"; -echo"# Login: ".($sessid = Alib::Login('root', 'q'))."\n"; - -echo"# downloadAudioClipFromHub: "; -$r = $gb->downloadFromHub($sessid, $gunid); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } -var_export($r); echo"\n"; -$trtok = $r; - -echo"# logout: "; $r = Alib::Logout($sessid); -if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."\n"; exit(1); } -echo "$r\n"; - -for($state='', $nu=1; ($state!='closed' && $state!='failed' && $nu<=12); $nu++, sleep(2)){ - echo"# getTransportInfo: "; $r = $gb->getTransportInfo($trtok); - if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } - $state = $r['state']; - echo "# state=$state, title={$r['title']}\n"; -} -if($state=='failed') exit(1); - -$comm = "ls -l ".$CC_CONFIG['storageDir']."/a23"; echo `$comm`; - -if(file_exists("../trans/log")) echo `tail -n 25 ../trans/log`; -echo "#Transport test: OK.\n\n"; -*/ -?> \ No newline at end of file diff --git a/backend/tests/webstreamTest.php b/backend/tests/webstreamTest.php deleted file mode 100644 index d8393867c..000000000 --- a/backend/tests/webstreamTest.php +++ /dev/null @@ -1,62 +0,0 @@ -\n"); -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); -$gb = new GreenBox(); - -#$gunid = "123456789abcdee0"; -$gunid = ""; -#$mdataFileLP = '../tests/mdata1.xml'; -$mdataFileLP = NULL; - -echo "# Login: ".($sessid = Alib::Login('root', 'q'))."\n"; -$parid = $gb->_getHomeDirId($sessid); - -echo "# storeWebstream: "; -$r = $gb->storeWebstream( - $parid, 'test stream', $mdataFileLP, $sessid, $gunid, 'http://localhost/y'); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; - exit(1); -} -echo ""; -var_dump($r); -//$id = BasicStor::IdFromGunid($gunid); -$id = $r; - -echo "# getMdata: "; -$r = $gb->getMetadata($id, $sessid); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; - exit(1); -} -echo "\n$r\n"; - -echo "# deleteFile: "; -$r = $gb->deleteFile($id, $sessid); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()." ".$r->getUserInfo()."\n"; - exit(1); -} -echo "\n$r\n"; - -echo "# logout: "; -$r = Alib::Logout($sessid); -if (PEAR::isError($r)) { - echo "ERROR: ".$r->getMessage()."\n"; - exit(1); -} -echo "$r\n"; - -echo "#storeWebstream test: OK.\n\n" -*/ -?> \ No newline at end of file diff --git a/backend/tests/wstream1.xml b/backend/tests/wstream1.xml deleted file mode 100644 index 57e228d8a..000000000 --- a/backend/tests/wstream1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - Webstream test 1 - 01:30:00.000000 - http://localhost/y - - diff --git a/backend/webstreamFormat.php b/backend/webstreamFormat.php deleted file mode 100644 index 219230779..000000000 --- a/backend/webstreamFormat.php +++ /dev/null @@ -1,345 +0,0 @@ -'audioClip', - 'audioClip'=>array( - 'childs'=>array( - 'required'=>array('metadata'), - ), - ), - 'metadata'=>array( - 'childs'=>array( - 'required'=>array( - 'dc:title', 'dcterms:extent', 'ls:url' - ), - 'optional'=>array( - 'dc:identifier', - 'dc:creator', 'dc:source', 'ls:genre', - 'ls:year', 'dc:type', 'dc:description', 'dc:format', - 'ls:bpm', 'ls:rating', 'ls:encoded_by', 'ls:track_num', - 'ls:disc_num', 'ls:disc_num', 'dc:publisher', 'ls:composer', - 'ls:bitrate', 'ls:channels', 'ls:samplerate', 'ls:encoder', - 'ls:crc', 'ls:lyrics', 'ls:orchestra', 'ls:conductor', - 'ls:lyricist', 'ls:originallyricist', 'ls:radiostationname', - 'ls:audiofileinfourl', 'ls:artisturl', 'ls:audiosourceurl', - 'ls:radiostationurl', 'ls:buycdurl', 'ls:isrcnumber', - 'ls:catalognumber', 'ls:originalartist', 'dc:rights', - 'ls:license', 'dc:title', 'dcterms:temporal', - 'dcterms:spatial', 'dcterms:entity', 'dc:description', - 'dc:creator', 'dc:subject', 'dc:type', 'dc:format', - 'dc:contributor', 'dc:language', 'dc:rights', - 'dcterms:isPartOf', 'dc:date', - 'dc:publisher', - // extra - 'dcterms:alternative', 'ls:filename', 'ls:mtime', - // added lately by sebastian - 'ls:mood', - ), - ), - 'namespaces'=>array( - 'dc'=>"http://purl.org/dc/elements/1.1/", - 'dcterms'=>"http://purl.org/dc/terms/", - 'xbmf'=>"http://www.streamonthefly.org/xbmf", - 'xsi'=>"http://www.w3.org/2001/XMLSchema-instance", - 'xml'=>"http://www.w3.org/XML/1998/namespace", - ), - ), - 'ls:url'=>array( - 'type'=>'URL', - ), - 'dc:identifier'=>array( - 'type'=>'Text', - 'auto'=>TRUE, - ), - 'dc:title'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:alternative'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:extent'=>array( - 'type'=>'Time', - 'regexp'=>'^\d{2}:\d{2}:\d{2}.\d{6}$', - ), - 'dc:creator'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:source'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:genre'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:year'=>array( - 'type'=>'Menu', - 'area'=>'Music', - ), - 'dc:type'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:description'=>array( - 'type'=>'Longtext', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:format'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:bpm'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:rating'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:encoded_by'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:track_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:disc_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:disc_num'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:publisher'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:composer'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:bitrate'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:channels'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:samplerate'=>array( - 'type'=>'Menu', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:encoder'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:crc'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:lyrics'=>array( - 'type'=>'Longtext', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:orchestra'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:conductor'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:lyricist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:originallyricist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:radiostationname'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:audiofileinfourl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:artisturl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:audiosourceurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:radiostationurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:buycdurl'=>array( - 'type'=>'URL', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:isrcnumber'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:catalognumber'=>array( - 'type'=>'Number', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:originalartist'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:rights'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:license'=>array( - 'type'=>'Text', - 'area'=>'Music', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:title'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:temporal'=>array( - 'type'=>'Time/Date', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:spatial'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:entity'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:description'=>array( - 'type'=>'Longtext', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:creator'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:subject'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:type'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:format'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:contributor'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:language'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:rights'=>array( - 'type'=>'Menu', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dcterms:isPartOf'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:date'=>array( - 'type'=>'Date', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'dc:publisher'=>array( - 'type'=>'Text', - 'area'=>'Talk', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:filename'=>array( - 'type'=>'Text', - 'attrs'=>array('implied'=>array('xml:lang')), - ), - 'ls:mtime'=>array( - 'type'=>'Int', -// 'regexp'=>'^\d{4}(-\d{2}(-\d{2}(T\d{2}:\d{2}(:\d{2}\.\d+)?(Z)|([\+\-]?\d{2}:\d{2}))?)?)?$', - ), -/* - ''=>array( - 'type'=>'', - 'area'=>'', - 'attrs'=>array(), - ), -*/ -); - -/* -? -ls:filename Text auto -*/ -?> \ No newline at end of file diff --git a/backend/xmlrpc/XR_LocStor.php b/backend/xmlrpc/XR_LocStor.php deleted file mode 100644 index f8df60978..000000000 --- a/backend/xmlrpc/XR_LocStor.php +++ /dev/null @@ -1,3833 +0,0 @@ - - *
  • version : string
  • - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_getVersion: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Subjects::getVersion - */ -// public function xr_getVersion($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// $res = $this->getVersion(); -// if (PEAR::isError($res)) { -// return new XML_RPC_Response(0, 805, -// "xr_getVersion: ".$res->getMessage(). -// " ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response( -// XML_RPC_encode(array('version'=>$res)) -// ); -// } - public function xr_getVersion() - { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } - $res = $this->getVersion(); -// if (PEAR::isError($res)) { -// return new XML_RPC_Response(0, 805, -// "xr_getVersion: ".$res->getMessage(). -// " ".$res->getUserInfo() -// ); -// } - return new XML_RPC_Response( - XML_RPC_encode(array('version'=>$res)) - ); - } - - - /* ------------------------------------------------------- authentication */ - /** - * Checks the login name and password of the user and return - * true if login data are correct, othervise return false. - * - * The XML-RPC name of this method is "locstor.authenticate". - * - * Input parameters: XML-RPC struct with the following fields: - *
      - *
    • login : string - login name
    • - *
    • pass : string - password
    • - *
    - * On success, returns a XML-RPC struct with single field: - *
      - *
    • authenticate : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 804 - xr_authenticate: database error
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Subjects::authenticate - */ - public function xr_authenticate($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->authenticate($r['login'], $r['pass']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 804, - "xr_authenticate: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - $retval = ($res !== FALSE); - return new XML_RPC_Response( - XML_RPC_encode(array('authenticate'=>$retval)) - ); - } - - - /** - * Checks the login name and password of the user. If the login is - * correct, a new session ID string is generated, to be used in all - * subsequent XML-RPC calls as the "sessid" field of the - * parameters. - * - * The XML-RPC name of this method is "locstor.login". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • login : string - login name
    • - *
    • pass : string - password
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • sessid : string - the newly generated session ID
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 802 - xr_login: login failed - - * incorrect username or password.
    • - *
    • 804 - xr_login:: database error
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Alib::login - */ - public function xr_login($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = Alib::Login($r['login'], $r['pass']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 804, - "xr_login: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - if ($res === FALSE) { - return new XML_RPC_Response(0, 802, - "xr_login: login failed - incorrect username or password." - ); - } else { - return new XML_RPC_Response(XML_RPC_encode(array('sessid'=>$res))); - } - } - - /** - * Logout, destroy session and return status. - * If session is not valid error message is returned. - * - * The XML-RPC name of this method is "locstor.logout". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean - TRUE
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 803 - xr_logout: logout failed - not logged.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - public function xr_logout($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = Alib::Logout($r['sessid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 803, - "xr_logout: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /* ---------------------------------------------------------------- store */ - /** - * Open writable URL for store new AudioClip or replace existing one. - * Writing to returned URL is possible using HTTP PUT method - * (as e.g. curl -T <filename> command does) - * - * The XML-RPC name of this method is "locstor.storeAudioClipOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip, - * if gunid is empty string, new one is generated - * (returned by subsequent storeAudioClipClose call) - *
    • - *
    • metadata : string - metadata XML string - * (as defined in Campcaster::Core::AudioClip Class Reference, - * examples are in storageServer/var/tests/*.xml) - *
    • - *
    • fname : string - human readable mnemonic file name - * with extension corresponding to filetype
    • - *
    • chsum : string - md5 checksum of media file
    • - *
    - * - * On success, returns a XML-RPC struct: - *
      - *
    • url : string - writable URL for HTTP PUT
    • - *
    • token : string - access token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_storeAudioClipOpen: - * <message from lower layer>
    • - *
    • 888 - If the file being uploaded is a duplicate of - * a file already in the system.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::storeAudioClipOpen - */ - public function xr_storeAudioClipOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->storeAudioClipOpen($r['sessid'], $r['gunid'], - $r['metadata'], $r['fname'], $r['chsum']); - if (PEAR::isError($res)) { - $code = 805; - if ($res->getCode() == 888) { - $code = 888; - } - return new XML_RPC_Response(0, $code, - "xr_storeAudioClipOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Close writable URL for store new AudioClip or replace existing one. - * - * The XML-RPC name of this method is "locstor.storeAudioClipClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - access token
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • gunid : string - gunid of stored file
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_storeAudioClipClose: - * <message from lower layer>
    • - *
    • 850 - wrong 1st parameter, struct expected.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::storeAudioClipClose - */ - public function xr_storeAudioClipClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->storeAudioClipClose($r['sessid'], $r['token']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_TOKEN ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_storeAudioClipClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); - } - - /** - * Store audio stream identified by URL - no raw audio data - * - * The XML-RPC name of this method is "locstor.storeWebstream". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip
    • - *
    • metadata : string - metadata XML string
    • - *
    • fname : string - human readable mnemonic file name - * with extension corresponding to filetype
    • - *
    • url : string - URL of the webstrea,
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • gunid : string - gunid of stored file
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_storeWebstream: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::storeWebstream - */ - public function xr_storeWebstream($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->storeWebstream( - $r['sessid'], $r['gunid'], $r['metadata'], $r['fname'], $r['url'] - ); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_storeWebstream: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); - } - - /* ------------------------------------------------ access raw audio data */ - /** - * Make access to audio clip. - * - * The XML-RPC name of this method is "locstor.accessRawAudioData". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioClip
    • - *
    - * - * On success, returns a XML-RPC struct: - *
      - *
    • url : string - local access url
    • - *
    • token : string - access token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_accessRawAudioData: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::accessRawAudioData - */ - public function xr_accessRawAudioData($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->accessRawAudioData($r['sessid'], $r['gunid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_accessRawAudioData: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Release access to audio clip - * - * The XML-RPC name of this method is "locstor.releaseRawAudioData". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - access token - * returned by locstor.accessRawAudioData
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_releaseRawAudioData: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::releaseRawAudioData - */ - public function xr_releaseRawAudioData($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->releaseRawAudioData(NULL, $r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_releaseRawAudioData: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /* ---------------------------------------------- download raw audio data */ - /** - * Create downlodable URL for stored file - * - * The XML-RPC name of this method is "locstor.downloadRawAudioDataOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioClip
    • - *
    - * - * On success, returns a XML-RPC struct: - *
      - *
    • url : string - downloadable url
    • - *
    • token : string - download token
    • - *
    • chsum : string - md5 checksum
    • - *
    • size : int - file size
    • - *
    • filename : string - human readable mnemonic file name
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_accessRawAudioDataOpen: - * <message from lower layer>
    • - *
    • 847 - invalid gunid.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::downloadRawAudioDataOpen - */ - public function xr_downloadRawAudioDataOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->downloadRawAudioDataOpen($r['sessid'], $r['gunid']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_NOTF ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_downloadRawAudioDataOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Delete downlodable URL with media file. - * - * The XML-RPC name of this method is "locstor.downloadRawAudioDataClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - download token - * returned by locstor.downloadRawAudioDataOpen
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • gunid : string - global unique ID
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_releaseRawAudioDataClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::downloadRawAudioDataClose - */ - public function xr_downloadRawAudioDataClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->downloadRawAudioDataClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_downloadRawAudioDataClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); - } - - /* ---------------------------------------------------- download metadata */ - /** - * Create downlodable URL for metadata part of stored file - * - * The XML-RPC name of this method is "locstor.downloadMetadataOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioClip
    • - *
    - * - * On success, returns a XML-RPC struct: - *
      - *
    • url : string - downloadable url
    • - *
    • token : string - download token
    • - *
    • chsum : string - md5 checksum
    • - *
    • filename : string - mnemonic filename
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_downloadMetadataOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::downloadRawAudioDataOpen - */ - public function xr_downloadMetadataOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - #$this->debugLog("{$r['sessid']}, {$r['gunid']}"); - $res = $this->downloadMetadataOpen($r['sessid'], $r['gunid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_downloadMetadataOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Delete downlodable URL with metadata. - * - * The XML-RPC name of this method is "locstor.downloadMetadataClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - download token - * returned by locstor.downloadRawAudioDataOpen
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • gunid : string - global unique ID
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_downloadMetadataClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::downloadRawAudioDataClose - */ - public function xr_downloadMetadataClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->downloadMetadataClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_downloadMetadataClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); - } - - /* --------------------------------------------------------------- delete */ - /** - * Delete existing audio clip - DISABLED now! - * - * The XML-RPC name of this method is "locstor.deleteAudioClip". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean - TRUE
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_deleteAudioClip: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::deleteAudioClip - */ - public function xr_deleteAudioClip($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - if (!isset($r['forced'])) { - $r['forced']=FALSE; - } - $res = $this->deleteAudioClip($r['sessid'], $r['gunid'], $r['forced']); - if (!$r['forced']) { - return new XML_RPC_Response(0, 805, "xr_deleteAudioClip: method disabled"); - } - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_deleteAudioClip: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /*====================================================== playlist methods */ - /** - * Create a new Playlist metafile. - * - * The XML-RPC name of this method is "locstor.createPlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    • fname : string - human readable menmonic file name
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • plid : string
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_createPlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::createPlaylist - */ - public function xr_createPlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->createPlaylist($r['sessid'], $r['plid'], $r['fname']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_createPlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); - } - - /** - * Open a Playlist metafile for editing. - * Open readable URL and mark file as beeing edited. - * - * The XML-RPC name of this method is "locstor.editPlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • url : string - readable url
    • - *
    • token : string - playlist token
    • - *
    • chsum : string - md5 checksum
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_editPlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::editPlaylist - */ - public function xr_editPlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->editPlaylist($r['sessid'], $r['plid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_editPlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Store a new Playlist metafile in place of the old one. - * - * The XML-RPC name of this method is "locstor.savePlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - playlist token - * returned by locstor.editPlaylist
    • - *
    • newPlaylist : string - new Playlist in XML string
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • plid : string - playlistId
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_savePlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::savePlaylist - */ - public function xr_savePlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->savePlaylist($r['sessid'], $r['token'], $r['newPlaylist']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_savePlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); - } - - /** - * RollBack playlist changes to the locked state - * - * The XML-RPC name of this method is "locstor.revertEditedPlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - playlist token - * returned by locstor.editPlaylist
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • plid : string - playlistId
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_revertEditedPlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::revertEditedPlaylist - */ - public function xr_revertEditedPlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->revertEditedPlaylist($r['token'], $r['sessid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_revertEditedPlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); - } - - /* ------------------------------------------------------- delete playlist*/ - /** - * Delete a Playlist metafile - DISABLED now! - * - * The XML-RPC name of this method is "locstor.deletePlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean - TRUE
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_deletePlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::deletePlaylist - */ - public function xr_deletePlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - if (!isset($r['forced'])) { - $r['forced']=FALSE; - } - $res = $this->deletePlaylist($r['sessid'], $r['plid'], $r['forced']); - if (! $r['forced']) { - return new XML_RPC_Response(0, 805,"xr_deletePlaylist: method disabled"); - } - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_FILENEX ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_deletePlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /* ------------------------------------------------------- access playlist*/ - /** - * Access (read) a Playlist metafile. - * - * The XML-RPC name of this method is "locstor.accessPlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    • recursive : boolean - flag for recursive access content - * inside playlist (default: false)
    • - *
    - * - * On success, returns an XML-RPC struct with the following fields: - *
      - *
    • url : string - readable url of accessed playlist in - * XML format
    • - *
    • token : string - playlist token
    • - *
    • chsum : string - md5 checksum
    • - *
    • content: array of structs - recursive access (optional)
    • - *
    - * - * The content field contains a struct for each playlist - * element contained in the playlist. For audio clips, this struct is - * of type {url, token}; for sub-playlists, it is of type - * {url, token, chsum, content}. - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_accessPlaylist: - * <message from lower layer>
    • - *
    • 847 - invalid plid.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::accessPlaylist - */ - public function xr_accessPlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - if (!isset($r['recursive']) || is_null($r['recursive'])) { - $r['recursive']=FALSE; - } - $res = $this->accessPlaylist($r['sessid'], $r['plid'], (boolean)$r['recursive']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_NOTF ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_accessPlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Release the resources obtained earlier by accessPlaylist(). - * - * The XML-RPC name of this method is "locstor.releasePlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - playlist token - * returned by locstor.accessPlaylist
    • - *
    • recursive : boolean - flag for recursive release content - * accessed by recursive accessPlaylist - * (ignored now - true forced)
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • plid : string - playlist ID
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_releasePlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::releasePlaylist - */ - public function xr_releasePlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - //if (!isset($r['recursive']) || is_null($r['recursive'])) $r['recursive']=FALSE; - $res = $this->releasePlaylist(NULL, $r['token'], TRUE); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_releasePlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); - } - - /* -------------------------------------------------------- playlist info */ - /** - * Check whether a Playlist metafile with the given playlist ID exists. - * - * The XML-RPC name of this method is "locstor.existsPlaylist". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • exists : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_existsPlaylist: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::existsPlaylist - */ - public function xr_existsPlaylist($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->existsPlaylist($r['sessid'], $r['plid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_existsPlaylist: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('exists'=>$res))); - } - - /** - * Check whether a Playlist metafile with the given playlist ID - * is available for editing, i.e., exists and is not marked as - * beeing edited. - * - * The XML-RPC name of this method is "locstor.playlistIsAvailable". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - global unique id of Playlist
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • available : boolean
    • - *
    • ownerid : int - local user id
    • - *
    • ownerlogin : string - local username
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_playlistIsAvailable: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::playlistIsAvailable - */ - public function xr_playlistIsAvailable($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->playlistIsAvailable($r['sessid'], $r['plid'], TRUE); - $ownerId = ($res === TRUE ? NULL : $res); - $ownerLogin = (is_null($ownerId) ? NULL : Subjects::GetSubjName($ownerId)); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_playlistIsAvailable: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'available' => ($res === TRUE), - 'ownerid' => $ownerId, - 'ownerlogin' => $ownerLogin, - ))); - } - - /* ------------------------------------------------------ export playlist */ - /** - * Create a tarfile with playlist export - playlist and all matching - * sub-playlists and media files (if desired) - * - * The XML-RPC name of this method is "locstor.exportPlaylistOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plids : array of strings - global unique IDs of Playlists
    • - *
    • type : string - playlist format, values: lspl | smil
    • - *
    • standalone : boolean - if only playlist should be exported or - * with all related files
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • url : string - readable url
    • - *
    • token : string - access token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_exportPlaylistOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::exportPlaylistOpen - */ - public function xr_exportPlaylistOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - if (!isset($r['standalone']) || empty($r['standalone'])) { - $r['standalone']=FALSE; - } - $res = $this->exportPlaylistOpen( - $r['sessid'], $r['plids'], $r['type'], $r['standalone'] - ); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_exportPlaylistOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'url' => $res['url'], - 'token' => $res['token'], - ))); - } - - /** - * Close playlist export previously opened by the exportPlaylistOpen method - * - * The XML-RPC name of this method is "locstor.exportPlaylistClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - access token
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean - status/li> - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_exportPlaylistClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::exportPlaylistClose - */ - public function xr_exportPlaylistClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->exportPlaylistClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_exportPlaylistClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>TRUE))); - } - - /* ------------------------------------------------------ import playlist */ - /** - * Open writable URL for import playlist in LS Archive format - * - * The XML-RPC name of this method is "locstor.importPlaylistOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • chsum : string - md5 checksum of imported file
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • url : string - writable url
    • - *
    • token : string - PUT token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_importPlaylistOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::importPlaylistOpen - */ - public function xr_importPlaylistOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->importPlaylistOpen($r['sessid'], $r['chsum']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_importPlaylistOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'url'=>$res['url'], - 'token'=>$res['token'], - ))); - } - - /** - * Open writable URL for import playlist in LS Archive format - * - * The XML-RPC name of this method is "locstor.importPlaylistClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - access token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • gunid : string - global id
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_importPlaylistClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::importPlaylistClose - */ - public function xr_importPlaylistClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->importPlaylistClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_importPlaylistClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'gunid'=>$res, - ))); - } - - /* ---------------------------------------------- render playlist to file */ - /** - * Render playlist to ogg file (open handle) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToFileOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - playlist gunid
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToFileOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToFileOpen - */ - public function xr_renderPlaylistToFileOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToFileOpen($r['sessid'], $r['plid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToFileOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Render playlist to ogg file (check results) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToFileCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • url : string - readable url
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToFileCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToFileCheck - */ - public function xr_renderPlaylistToFileCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToFileCheck($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToFileCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'url'=>$res['url'], - 'status'=>$res['status'], - ))); - } - - /** - * Render playlist to ogg file (close handle) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToFileClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToFileClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToFileClose - */ - public function xr_renderPlaylistToFileClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToFileClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToFileClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res['status'], - ))); - } - - /* ------------------------------------------- render playlist to storage */ - /** - * Render playlist to storage media clip (open handle) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToStorageOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - playlist gunid
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToStorageOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToStorageOpen - */ - public function xr_renderPlaylistToStorageOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToStorageOpen($r['sessid'], $r['plid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToStorageOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Render playlist to storage media clip (check results) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToStorageCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • gunid : string - gunid of result file
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToStorageCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToStorageCheck - */ - public function xr_renderPlaylistToStorageCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToStorageCheck($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToStorageCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res['status'], - 'gunid'=>$res['gunid'], - ))); - } - - /* ----------------------------------------------- render playlist to RSS */ - /** - * Render playlist to RSS file (open handle) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToRSSOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • plid : string - playlist gunid
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToRSSOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToRSSOpen - */ - public function xr_renderPlaylistToRSSOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToRSSOpen($r['sessid'], $r['plid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToRSSOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Render playlist to RSS file (check results) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToRSSCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • url : string - readable url
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToRSSCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToRSSCheck - */ - public function xr_renderPlaylistToRSSCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToRSSCheck($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToRSSCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'url'=>$res['url'], - 'status'=>$res['status'], - ))); - } - - /** - * Render playlist to RSS file (close handle) - * - * The XML-RPC name of this method is "locstor.renderPlaylistToRSSClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - render token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_renderPlaylistToRSSClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::renderPlaylistToRSSClose - */ - public function xr_renderPlaylistToRSSClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->renderPlaylistToRSSClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_renderPlaylistToRSSClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res['status'], - ))); - } - - /*==================================================storage admin methods */ - /* ------------------------------------------------------- backup methods */ - /** - * Create backup of storage (open handle) - * - * The XML-RPC name of this method is "locstor.createBackupOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • criteria : struct - see search criteria
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • token : string - backup token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_createBackupOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::createBackupOpen - */ - public function xr_createBackupOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - -# return new XML_RPC_Response(XML_RPC_encode(var_export($this, TRUE))); - - $res = $this->createBackupOpen($r['sessid'], $r['criteria']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_createBackupOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Create backup of storage (check results) - * - * The XML-RPC name of this method is "locstor.createBackupCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - backup token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • url : string - readable url
    • - *
    • metafile : string - archive metafile in XML format
    • - *
    • faultString : string - error message - * (use only if status==fault)
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_createBackupCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::createBackupCheck - */ - //
  • 854 - backup process fault
  • - public function xr_createBackupCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->createBackupCheck($r['token']); - - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_BGERR ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_createBackupCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Create backup of storage (list results) - * - * The XML-RPC name of this method is "locstor.createBackupList". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • stat : string - backup status
    • - *
    - * - * On success, returns a XML-RPC array of struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • url : string - readable url
    • - *
    • metafile : string - archive metafile in XML format
    • - *
    • faultString : string - error message - * (use only if status==fault)
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_createBackupCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::createBackupCheck - */ - //
  • 854 - backup process fault
  • - public function xr_createBackupList($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - if (!isset($r['stat']) || is_null($r['stat'])) { - $r['stat']=''; - } - $res = $this->createBackupList($r['stat']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_BGERR ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_createBackupCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Create backup of storage (close handle) - * - * The XML-RPC name of this method is "locstor.createBackupClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - backup token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_createBackupClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::createBackupClose - */ - public function xr_createBackupClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->createBackupClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_createBackupClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res['status'], - ))); - } - /* ------------------------------------------------------ restore methods */ - /** - * Open restore a backup file - * - * The XML-RPC name of this method is "locstor.restoreBackupOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • chsum : string - md5 checksum of restore file
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • url : string - writable URL for HTTP PUT
    • - *
    • token : string - PUT token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_restoreBackupOpen: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::restoreBackupOpen - */ - public function xr_restoreBackupOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->restoreBackupOpen($r['sessid'], $r['chsum']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_restoreBackupOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - unset($res['fname']); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Close writable URL for restore a backup file and start the restore - * process - * - * The XML-RPC name of this method is "locstor.restoreBackupClosePut". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • token : string - PUT token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • token : string - restore token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_restoreBackupClosePut: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::restoreBackupClosePut - */ - public function xr_restoreBackupClosePut($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->restoreBackupClosePut($r['sessid'], $r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_restoreBackupClosePut: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Check the state of restore procedure - * - * The XML-RPC name of this method is "locstor.restoreBackupCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - restore token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - success | working | fault
    • - *
    • faultString: string - description of fault
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_restoreBackupCheck: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::restoreBackupCheck - */ - public function xr_restoreBackupCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->restoreBackupCheck($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_restoreBackupCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } -# return new XML_RPC_Response(XML_RPC_encode(array( -# 'status'=>$res, -# ))); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Close the restore process - * - * The XML-RPC name of this method is "locstor.restoreBackupClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • token : string - restore token
    • - *
    - * - * On success, returns a XML-RPC struct with following fields: - *
      - *
    • status : string - status
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_restoreBackupClose: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::restoreBackupClose - */ - public function xr_restoreBackupClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->restoreBackupClose($r['token']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_restoreBackupClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } -# return new XML_RPC_Response(XML_RPC_encode(array( -# 'gunid'=>$res, -# ))); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /*========================================================== info methods */ - /** - * Check if audio clip exists and return TRUE/FALSE - * - * The XML-RPC name of this method is "locstor.existsAudioClip". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • exists : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_existsAudioClip: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::existsAudioClip - */ - public function xr_existsAudioClip($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - #$this->debugLog(join(', ', $r)); - $res = $this->existsAudioClip($r['sessid'], $r['gunid']); - #$this->debugLog($res); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 805, - "xr_existsAudioClip: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode(array('exists'=>$res))); - } - - /*====================================================== metadata methods */ - /** - * Return all file's metadata as XML string - * - * The XML-RPC name of this method is "locstor.getAudioClip". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • metadata : string - metadata as XML
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_getAudioClip: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::getAudioClip - */ - public function xr_getAudioClip($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->getAudioClip($r['sessid'], $r['gunid']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('metadata'=>$res))); - } - - /** - * Update existing audio clip metadata - * - * The XML-RPC name of this method is "locstor.updateAudioClipMetadata". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id of AudioCLip
    • - *
    • metadata : metadata XML string
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean - TRUE
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_updateAudioClipMetadata: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::updateAudioClipMetadata - */ - public function xr_updateAudioClipMetadata($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->updateAudioClipMetadata( - $r['sessid'], $r['gunid'], $r['metadata'] - ); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_updateAudioClip: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /** - * Search in local metadata database - * - * The XML-RPC name of this method is "locstor.searchMetadata". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • criteria : struct, with following fields:
      - *
        - *
      • filetype : string - type of searched files, - * meaningful values: 'audioclip', 'webstream', 'playlist', 'all'
      • - *
      • operator : string - type of conditions join - * (any condition matches / all conditions match), - * meaningful values: 'and', 'or', '' - * (may be empty or ommited only with less then 2 items in - * "conditions" field) - *
      • - *
      • limit : int - limit for result arrays (0 means unlimited)
      • - *
      • offset : int - starting point (0 means without offset)
      • - *
      • orderby : string - metadata category for sorting (optional) - * or array of strings for multicolumn orderby - * [default: dc:creator, dc:source, dc:title] - *
      • - *
      • desc : boolean - flag for descending order (optional) - * or array of boolean for multicolumn orderby - * (it corresponds to elements of orderby field) - * [default: all ascending] - *
      • - *
      • conditions : array of struct with fields: - *
          - *
        • cat : string - metadata category name
        • - *
        • op : string - operator, meaningful values: - * 'full', 'partial', 'prefix', '=', '<', '<=', - * '>', '>='
        • - *
        • val : string - search value
        • - *
        - *
      • - *
      - *
    • - *
    - * - * On success, returns a XML-RPC array of structs with fields: - *
      - *
    • cnt : integer - number of matching gunids - * of files have been found
    • - *
    • results : array of hashes: - *
        - *
      • gunid: string
      • - *
      • type: string - audioclip | playlist | webstream
      • - *
      • title: string - dc:title from metadata
      • - *
      • creator: string - dc:creator from metadata
      • - *
      • source: string - dc:source from metadata
      • - *
      • length: string - dcterms:extent in extent format
      • - *
      - *
    • - *
    - * (cnt value may be greater than size of result array - see limit param) - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_searchMetadata: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::searchMetadata - * @see BasicStor::localSearch - */ - public function xr_searchMetadata($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->searchMetadata($r['sessid'], $r['criteria']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_searchAudioClip: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } -# return new XML_RPC_Response(XML_RPC_encode($res)); - $xv = new XML_RPC_Value; - $xv->addStruct(array( - 'cnt' => XML_RPC_encode($res['cnt']), - 'results' => - (count($res['results'])==0 - ? new XML_RPC_Value(array(), 'array') - : XML_RPC_encode($res['results']) - ), - )); - return new XML_RPC_Response($xv); - } - - /** - * Return values of specified metadata category - * - * The XML-RPC name of this method is "locstor.browseCategory". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • category : string - metadata category name - * with or without namespace prefix (dc:title, author)
    • - *
    • criteria : hash - see searchMetadata method
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • results : array with found values
    • - *
    • cnt : integer - number of matching values
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_browseCategory: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::browseCategory - */ - public function xr_browseCategory($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->browseCategory( - $r['category'], $r['criteria'], $r['sessid'] - ); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - - ); - } - $xv = new XML_RPC_Value; - $xv->addStruct(array( - 'cnt' => XML_RPC_encode($res['cnt']), - 'results' => - (count($res['results'])==0 - ? new XML_RPC_Value(array(), 'array') - : XML_RPC_encode($res['results']) - ), - )); - return new XML_RPC_Response($xv); - } - - /* ============================================== methods for preferences */ - /** - * Load user preference value - * - * The XML-RPC name of this method is "locstor.loadPref". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • key : string - preference key
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • value : string - preference value
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_loadPref: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 849 - invalid preference key.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Pref::loadPref - */ - public function xr_loadPref($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once(dirname(__FILE__).'/../Prefs.php'); - $pr = new Prefs($this); - $res = $pr->loadPref($r['sessid'], $r['key']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == GBERR_PREF ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('value'=>$res))); - } - - /** - * Save user preference value - * - * The XML-RPC name of this method is "locstor.savePref". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • key : string - preference key
    • - *
    • value : string - preference value
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_savePref: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Pref::savePref - */ - public function xr_savePref($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once(dirname(__FILE__).'/../Prefs.php'); - $pr = new Prefs($this); - $res = $pr->savePref($r['sessid'], $r['key'], $r['value']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /** - * Delete user preference record - * - * The XML-RPC name of this method is "locstor.delPref". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • key : string - preference key
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_delPref: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 849 - invalid preference key.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Pref::delPref - */ - public function xr_delPref($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once(dirname(__FILE__).'/../Prefs.php'); - $pr = new Prefs($this); - $res = $pr->delPref($r['sessid'], $r['key']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == GBERR_PREF ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /** - * Read group preference record - * - * The XML-RPC name of this method is "locstor.loadGroupPref". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • group : string - group name
    • - *
    • key : string - preference key
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • value : string - preference value
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_loadGroupPref: - * <message from lower layer>
    • - *
    • 820 - invalid group name.
    • - *
    • 848 - invalid session id.
    • - *
    • 849 - invalid preference key.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Pref::loadGroupPref - */ - public function xr_loadGroupPref($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once(dirname(__FILE__).'/../Prefs.php'); - $pr = new Prefs($this); - $res = $pr->loadGroupPref($r['group'], $r['key']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ( - $ec0 == GBERR_SESS || $ec0 == GBERR_PREF || $ec0==ALIBERR_NOTGR - ? 800+$ec0 : 805 - ); - return new XML_RPC_Response(0, $ec, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('value'=>$res))); - } - - /** - * Save group preference record - * - * The XML-RPC name of this method is "locstor.saveGroupPref". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • group : string - group name
    • - *
    • key : string - preference key
    • - *
    • value : string - preference value
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • status : boolean
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_saveGroupPref: - * <message from lower layer>
    • - *
    • 820 - invalid group name.
    • - *
    • 848 - invalid session id.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Pref::saveGroupPref - */ - public function xr_saveGroupPref($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once(dirname(__FILE__).'/../Prefs.php'); - $pr = new Prefs($this); - $res = $pr->saveGroupPref($r['sessid'], $r['group'], $r['key'], $r['value']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0==GBERR_SESS || $ec0==ALIBERR_NOTGR ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); - } - - /* =============================== remote repository (networking) methods */ - /* ------------------------------------------------------- common methods */ - /** - * Common "check" method for transports - * - * The XML-RPC name of this method is "locstor.getTransportInfo". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtype: string - audioclip | playlist | search | file
    • - *
    • direction: string - up | down
    • - *
    • state: string - transport state
    • - *
    • expectedsize: int - expected size
    • - *
    • realsize: int - size of transported file
    • - *
    • expectedchsum: string - expected checksum
    • - *
    • realchsum: string - checksum of transported file
    • - *
    • title: string - file title
    • - *
    • errmsg: string - error message from failed transports
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_getTransportInfo: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::getTransportInfo - */ - public function xr_getTransportInfo($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->getTransportInfo($r['trtok']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getTransportInfo: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Turn transports on/off, optionaly return current state. - * - * The XML-RPC name of this method is "locstor.turnOnOffTransports". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • onOff: boolean optional - * (if not used, current state is returned)
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • state : boolean - previous state
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_turnOnOffTransports: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::turnOnOffTransports - */ - public function xr_turnOnOffTransports($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->turnOnOffTransports($r['onOff']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_turnOnOffTransports: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res))); - } - - /** - * Pause, resume or cancel transport - * - * The XML-RPC name of this method is "locstor.doTransportAction". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • trtok : string - transport token
    • - *
    • action: string - pause | resume | cancel - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • state : string - resulting transport state
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_doTransportAction: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::doTransportAction - */ - public function xr_doTransportAction($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->doTransportAction($r['trtok'], $r['action']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_doTransportAction: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res))); - } - - /* ------------------------ methods for ls-archive-format file transports */ - /** - * Open async file transfer from local storageServer to network hub, - * file should be ls-archive-format file. - * - * The XML-RPC name of this method is "locstor.uploadFile2Hub". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • filePath string - local path to uploaded file
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_uploadFile2Hub: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::uploadFile2Hub - */ - public function xr_uploadFile2Hub($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->uploadFile2Hub($r['filePath']); // local files on XML-RPC :( - // there should be something as uploadFile2storageServer - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_uploadFile2Hub: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); - } - - /** - * Get list of prepared transfers initiated by hub - * - * The XML-RPC name of this method is "locstor.getHubInitiatedTransfers". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • results : array of structs with fields: - *
        - *
      • trtok : string - transport token
      • - *
      • ... ?
      • - *
      - *
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_getHubInitiatedTransfers: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::getHubInitiatedTransfers - */ - public function xr_getHubInitiatedTransfers($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->getHubInitiatedTransfers(); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_getHubInitiatedTransfers: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /** - * Start of download initiated by hub - * - * The XML-RPC name of this method is "locstor.startHubInitiatedTransfer". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • trtok : string - transport token obtained from - * the getHubInitiatedTransfers method
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_startHubInitiatedTransfer: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::startHubInitiatedTransfer - */ - public function xr_startHubInitiatedTransfer($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->startHubInitiatedTransfer($r['trtok']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_startHubInitiatedTransfer: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); - } - - /* ------------- special methods for audioClip/webstream object transport */ - - /** - * Start upload of audioclip or playlist from local storageServer to hub - * - * The XML-RPC name of this method is "locstor.upload2Hub". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid: string - global unique id of object being transported - *
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_upload2Hub: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::upload2Hub - */ - public function xr_upload2Hub($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $res = $tr->upload2Hub($r['gunid']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_upload2Hub: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); - } - - /** - * Start download of audioclip or playlist from hub to local storageServer - * - * The XML-RPC name of this method is "locstor.downloadFromHub". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid: string - global unique id of object being transported - *
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_downloadFromHub: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::downloadFromHub - */ - public function xr_downloadFromHub($input) - { - list($ok, $par) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $par; - } - require_once('../Transport.php'); - $tr = new Transport($this); - $uid = Alib::GetSessUserId($par['sessid']); - $res = $tr->downloadFromHub($uid, $par['gunid']); - if (PEAR::isError($res)) { - $ec0 = intval($res->getCode()); - $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); - return new XML_RPC_Response(0, $ec, - "xr_downloadFromHub: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); - } - - /* ------------------------------------------------ global-search methods */ - /** - * Start search job on network hub - * - * The XML-RPC name of this method is "locstor.globalSearch". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • criteria : hash, LS criteria format - see searchMetadata method - *
    • - *
    - * - * On success, returns a XML-RPC struct with the following fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_globalSearch: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 874 - invalid hub connection configuration.
    • - *
    • 872 - invalid tranport token.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::globalSearch - */ -// public function xr_globalSearch($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// require_once('../Transport.php'); -// $tr = new Transport($this); -// $res = $tr->globalSearch($r['criteria']); -// if (PEAR::isError($res)) { -// $ec0 = intval($res->getCode()); -// $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); -// return new XML_RPC_Response(0, $ec, -// "xr_globalSearch: ".$res->getMessage()." ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); -// } - - /** - * Get results from search job on network hub. - * (returns error if not finished) - * - * The XML-RPC name of this method is "locstor.getSearchResults". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On success, returns a XML-RPC array of structs with fields: - *
      - *
    • cnt : integer - number of matching gunids - * of files have been found
    • - *
    • results : array of hashes: - *
        - *
      • gunid: string
      • - *
      • type: string - audioclip | playlist | webstream
      • - *
      • title: string - dc:title from metadata
      • - *
      • creator: string - dc:creator from metadata
      • - *
      • source: string - dc:source from metadata
      • - *
      • length: string - dcterms:extent in extent format
      • - *
      - *
    • - *
    - * (cnt value may be greater than size of result array - see limit param) - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_getSearchResults: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    • 872 - invalid tranport token.
    • - *
    • 873 - not finished.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::getSearchResults - */ -// public function xr_getSearchResults($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// require_once('../Transport.php'); -// $tr = new Transport($this); -// $res = $tr->getSearchResults($r['trtok']); -// if (PEAR::isError($res)) { -// $ec0 = intval($res->getCode()); -// $ec = ( -// $ec0 == GBERR_SESS || $ec0 == TRERR_TOK || $ec0 == TRERR_NOTFIN -// ? 800+$ec0 : 805 ); -// return new XML_RPC_Response(0, $ec, -// "xr_getSearchResults: ".$res->getMessage()." ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response(XML_RPC_encode($res)); -// } - - /** - * OBSOLETE - * Starts upload audioclip to remote archive - * - * The XML-RPC name of this method is "locstor.uploadToArchive". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_uploadToArchive: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::uploadToArchive - */ -// public function xr_uploadToArchive($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// require_once(dirname(__FILE__).'/../Transport.php'); -// $tr = new Transport($this); -// $res = $tr->uploadToArchive($r['gunid'], $r['sessid']); -// if (PEAR::isError($res)) { -// $ec0 = intval($res->getCode()); -// $ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 ); -// return new XML_RPC_Response(0, $ec, -// "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); -// } - - /** - * OBSOLETE - * Starts download audioclip from remote archive - * - * The XML-RPC name of this method is "locstor.downloadFromArchive". - * - * The input parameters are an XML-RPC struct with the following - * fields: - *
      - *
    • sessid : string - session id
    • - *
    • gunid : string - global unique id
    • - *
    - * - * On success, returns a XML-RPC struct with single field: - *
      - *
    • trtok : string - transport token
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_downloadFromArchive: - * <message from lower layer>
    • - *
    • 848 - invalid session id.
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see Transport::downloadFromArchive - */ -// public function xr_downloadFromArchive($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// require_once(dirname(__FILE__).'/../Transport.php'); -// $tr = new Transport($this); -// $res = $tr->downloadFromArchive($r['gunid'], $r['sessid']); -// if (PEAR::isError($res)) { -// $ec0 = intval($res->getCode()); -// $ec = ($ec0 == GBERR_SESS ? 800+$ec0 : 805 ); -// return new XML_RPC_Response(0, $ec, -// "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); -// } - - /* ================================================ methods for debugging */ - /** - * Reset storageServer for debugging. - * - * The XML-RPC name of this method is "locstor.resetStorage". - * - * The input parameters are an empty XML-RPC struct, - * or struct with the following optional fields: - *
      - *
    • loadSampleData : boolean - load sample data? (default: true) - *
    • - *
    • invalidateSessionIds : boolean - invalidate active session IDs? - * (default: false) - *
    • - *
    - * - * On success, returns the same result as searchMetadata with filetype - * 'all' and no conditions, ordered by filetype and dc:title - * i.e. XML-RPC array of structs with fields: - *
      - *
    • cnt : integer - number of inserted files
    • - *
    • results : array of hashes: - *
        - *
      • gunid: string
      • - *
      • type: string - audioclip | playlist | webstream
      • - *
      • title: string - dc:title from metadata
      • - *
      • creator: string - dc:creator from metadata
      • - *
      • source: string - dc:source from metadata
      • - *
      • length: string - dcterms:extent in extent format
      • - *
      - *
    • - *
    - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - *
      - *
    • 3 - Incorrect parameters passed to method: - * Wanted ... , got ... at param
    • - *
    • 801 - wrong 1st parameter, struct expected.
    • - *
    • 805 - xr_resetStorage: - * <message from lower layer>
    • - *
    - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - * @see LocStor::getAudioClip - */ -// public function xr_resetStorage($input) -// { -// list($ok, $r) = XR_LocStor::xr_getParams($input); -// if (!$ok) { -// return $r; -// } -// $res = $this->resetStorage( -// isset($r['loadSampleData']) ? $r['loadSampleData'] : TRUE, -// !(isset($r['invalidateSessionIds']) ? $r['invalidateSessionIds'] : FALSE) -// ); -// if (PEAR::isError($res)) { -// return new XML_RPC_Response(0, 805, -// "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() -// ); -// } -// return new XML_RPC_Response(XML_RPC_encode($res)); -// } - - /** - * Test XMLRPC - strupper and return given string, - * also return loginname of logged user - * - debug method only - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - public function xr_test($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'str'=>strtoupper($r['teststring']), - 'login' => Alib::GetSessLogin($r['sessid']), - 'sessid'=>$r['sessid'] - ))); - } - - /** - * Open writable URL for put method - debug method only - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - public function xr_openPut($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->bsOpenPut(); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * Close writable URL - debug method only - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - public function xr_closePut($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->bsClosePut($r['token'], $r['chsum']); - if (PEAR::isError($res)) { - return new XML_RPC_Response(0, 805, - "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'fname'=>$res['fname'], - 'owner'=>$res['owner'], - ))); - } - - /** - * Simple ping method - return string - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_ping($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = date("Ymd-H:i:s")." -- reply from remote node: {$r['par']}"; - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_uploadOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->uploadOpen($r['sessid'], $r['chsum']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_uploadOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * Check state of file upload - * - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_uploadCheck($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->uploadCheck($r['token']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_uploadCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_uploadClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->uploadClose($r['token'], $r['trtype'], $r['pars']); - if (PEAR::isError($res)) { - $code = 803; - // Special case for duplicate file - give back - // different error code so we can display nice user message. - if ($res->getCode() == GBERR_GUNID) { - $code = 888; - } - return new XML_RPC_Response(0, $code, - "xr_uploadClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_downloadOpen($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->downloadOpen($r['sessid'], $r['trtype'], $r['pars']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_downloadOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_downloadClose($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->downloadClose($r['token'], $r['trtype']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_downloadClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_prepareHubInitiatedTransfer($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - foreach (array('trtype'=>NULL, 'direction'=>'up', 'pars'=>array()) as $k => $dv) { - if (!isset($r[$k])) { - $r[$k] = $dv; - } - } - $res = $this->prepareHubInitiatedTransfer( - $r['target'], $r['trtype'], $r['direction'], $r['pars']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_prepareHubInitiatedTransfer: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_listHubInitiatedTransfers($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - foreach (array('target'=>NULL, 'direction'=>NULL, 'trtok'=>NULL) as $k=>$dv) { - if (!isset($r[$k])) { - $r[$k] = $dv; - } - } - $res = $this->listHubInitiatedTransfers( - $r['target'], $r['direction'], $r['trtok']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_listHubInitiatedTransfers: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - - /** - * @param XML_RPC_Message $input - * @return XML_RPC_Response - */ - function xr_setHubInitiatedTransfer($input) - { - list($ok, $r) = XR_LocStor::xr_getParams($input); - if (!$ok) { - return $r; - } - $res = $this->setHubInitiatedTransfer( - $r['target'], $r['trtok'], $r['state']); - if (PEAR::isError($res)) - return new XML_RPC_Response(0, 803, - "xr_setHubInitiatedTransfer: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - return new XML_RPC_Response(XML_RPC_encode($res)); - } - - /* ==================================================== "private" methods */ - /** - * Check and convert struct of parameters - * - * @param XML_RPC_Message $input - * @return array - * Array of two items: first item is boolean, indicating - * successful decode. - * On success, the second param is an array of values. - * On failure, the second param is an XML_RPC_Response object. - */ - protected static function xr_getParams($input) - { - $p = $input->getParam(0); - if (isset($p) && ($p->scalartyp()=="struct")) { - $r = XML_RPC_decode($p); - return array(TRUE, $r); - } else { - return array(FALSE, new XML_RPC_Response(0, 801, "wrong 1st parameter, struct expected." )); - } - } - -} // class XR_LocStor - -?> \ No newline at end of file diff --git a/backend/xmlrpc/index.php b/backend/xmlrpc/index.php deleted file mode 100644 index e1ee867a4..000000000 --- a/backend/xmlrpc/index.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/backend/xmlrpc/put.php b/backend/xmlrpc/put.php deleted file mode 100644 index 650a5880a..000000000 --- a/backend/xmlrpc/put.php +++ /dev/null @@ -1,99 +0,0 @@ - - *
  • token : string, put token returned by appropriate - * XMLRPC call
  • - * - * - * On success, returns HTTP return code 200. - * - * On errors, returns HTTP return code >200 - * The possible error codes are: - *
      - *
    • 400 - Incorrect parameters passed to method
    • - *
    • 403 - Access denied
    • - *
    • 500 - Application error
    • - *
    - * - * @see XR_LocStor - * @package Campcaster - * @subpackage storageServer - */ - -define('USE_FLOCK', TRUE); - -require_once(dirname(__FILE__).'/../../conf.php'); -require_once('DB.php'); -require_once(dirname(__FILE__).'/../LocStor.php'); - -PEAR::setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); -$gb = new LocStor(); - -function http_error($code, $err) -{ - header("HTTP/1.1 $code"); - header("Content-type: text/plain; charset=UTF-8"); - echo "$err\r\n"; - flush(); - exit; -} - -if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['token'])) { - $token = $_REQUEST['token']; -} else { - http_error(400, "Error on token parameter. ({$_REQUEST['token']})"); -} - -$tc = BasicStor::bsCheckToken($token, 'put'); -if (PEAR::isError($tc)) { - http_error(500, $ex->getMessage()); -} -if (!$tc) { - http_error(403, "put.php: Token not valid ($token)."); -} - -header("Content-type: text/plain"); - -$destfile = $CC_CONFIG['accessDir']."/{$token}"; - -/* PUT data comes in on the input stream */ -$putdata = @fopen("php://input", "r") or - http_error(500, "put.php: Can't read input"); - -/* Open a file for writing */ -$fp = @fopen($destfile, "ab") or - http_error(500, "put.php: Can't write to destination file (token=$token)"); - -if ( USE_FLOCK ) { - // lock the file - $lockres = flock($fp,LOCK_EX+LOCK_NB); - if ($lockres !== TRUE) { - http_error(409, "put.php: file locked (token=$token)"); - } -} - -/* Read the data 1 KB at a time and write to the file */ -while ($data = fread($putdata, 1024)){ - fwrite($fp, $data); -} - -if ( USE_FLOCK ) { - // unlock the file - flock($fp,LOCK_UN); -} - -/* Close the streams */ -fclose($fp); -fclose($putdata); - -header("HTTP/1.1 200"); -?> \ No newline at end of file diff --git a/backend/xmlrpc/schedulerPhpClient.php b/backend/xmlrpc/schedulerPhpClient.php deleted file mode 100644 index d3fce621a..000000000 --- a/backend/xmlrpc/schedulerPhpClient.php +++ /dev/null @@ -1,511 +0,0 @@ - - *
  • m
  • full method name (include optional prefix) - *
  • p
  • array of input parameter names - *
  • t
  • array of input parameter types - *
  • r
  • array of result element names (not used there at present) - *
  • e
  • array of error codes/messages (not used there at present) - * - */ -$mdefs = array( - "listMethods" => array('m'=>"system.listMethods", 'p'=>NULL, 't'=>NULL), - "AddAudioClipToPlaylistMethod" => array( - 'm'=>'addAudioClipToPlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'audioClipId'/*string*/, 'relativeOffset'/*int*/, 'clipStart'/*int*/, 'clipEnd'/*int*/, 'clipLength'/*int*/), - 't'=>array('string', 'string', 'string', 'int', 'int', 'int', 'int'), - 'r'=>array('playlistElementId'/*string*/), - 'e'=>array( - '301'=>'invalid argument format', - '302'=>'missing playlist ID argument', - '303'=>'missing audio clip ID argument', - '304'=>'missing relative offset argument', - '305'=>'playlist not found', - '306'=>'playlist has not been opened for editing', - '307'=>'audio clip does not exist', - '308'=>'two audio clips at the same relative offset', - '320'=>'missing session ID argument', - ) - ), - "CreatePlaylistMethod" => array( - 'm'=>'createPlaylist', - 'p'=>array('sessionId'/*string*/), - 't'=>array('string'), - 'r'=>array('playlist'/*string*/), - 'e'=>array( - '201'=>'invalid argument format', - '202'=>'could not create playlist', - '220'=>'missing session ID argument', - ) - ), - "DeletePlaylistMethod" => array( - 'm'=>'deletePlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array(), - 'e'=>array( - '901'=>'invalid argument format', - '902'=>'missing playlist ID argument', - '903'=>'playlist not found', - '904'=>'playlist is locked', - '905'=>'playlist could not be deleted', - '920'=>'missing session ID argument', - ) - ), - "DisplayAudioClipMethod" => array( - 'm'=>'displayAudioClip', - 'p'=>array('sessionId'/*string*/, 'audioClipId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('audioClip'/*string*/), - 'e'=>array( - '601'=>'invalid argument format', - '602'=>'argument is not an audio clip ID', - '603'=>'audio clip not found', - '620'=>'missing session ID argument', - ) - ), - "DisplayAudioClipsMethod" => array( - 'm'=>'displayAudioClips', - 'p'=>array('sessionId'/*string*/), - 't'=>array('string'), - 'r'=>array(array('audioClip'/*string*/)), - 'e'=>array( - '1801'=>'invalid argument format', - '1802'=>'XML-RPC error', - '1820'=>'missing session ID argument', - ) - ), - "DisplayPlaylistMethod" => array( - 'm'=>'displayPlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('playlist'/*string*/), - 'e'=>array( - '1001'=>'invalid argument format', - '1002'=>'argument is not a playlist ID', - '1003'=>'playlist not found', - '1020'=>'missing session ID argument', - ) - ), - "DisplayPlaylistsMethod" => array( - 'm'=>'displayPlaylists', - 'p'=>array('sessionId'/*string*/), - 't'=>array('string'), - 'r'=>array(array('playlist'/*string*/)), - 'e'=>array( - '1701'=>'invalid argument format', - '1702'=>'XML-RPC error', - '1720'=>'missing session ID argument', - ) - ), - "DisplayScheduleMethod" => array( - 'm'=>'displaySchedule', - 'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/), - 't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'), - 'r'=>array(array('id'/*int*/, 'playlistId'/*string*/, 'start'/*datetime*/, 'end'/*datetime*/)), - 'e'=>array( - '1101'=>'invalid argument format', - '1102'=>"missing or invalid 'from' argument", - '1103'=>"missing or invalid 'to' argument", - '1120'=>'missing session ID argument', - ) - ), - "GeneratePlayReportMethod" => array( - 'm'=>'generatePlayReport', - 'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/), - 't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'), - 'r'=>array(array('audioClipId'/*string*/, 'timestamp'/*datetime*/)), - 'e'=>array( - '1501'=>'invalid argument format', - '1502'=>"missing or invalid 'from' argument", - '1503'=>"missing or invalid 'to' argument", - '1520'=>'missing session ID argument', - ) - ), - "GetSchedulerTimeMethod" => array( - 'm'=>'getSchedulerTime', - 'p'=>array(), - 't'=>array(), - 'r'=>array('schedulerTime'/*datetime*/), - 'e'=>array( -) - ), - "GetVersionMethod" => array( - 'm'=>'getVersion', - 'p'=>array(), - 't'=>array(), - 'r'=>array('version'/*string*/), - 'e'=>array() - ), - "LoginMethod" => array( - 'm'=>'login', - 'p'=>array('login'/*string*/, 'password'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('sessionId'/*string*/), - 'e'=>array( - '2001'=>'invalid argument format', - '2002'=>'missing login argument', - '2003'=>'missing password argument', - '2004'=>'the authentication server reported an error', - ) - ), - "LogoutMethod" => array( - 'm'=>'logout', - 'p'=>array('sessionId'/*string*/), - 't'=>array('string'), - 'r'=>array(), - 'e'=>array( - '2101'=>'invalid argument format', - '2120'=>'missing session ID argument', - '2104'=>'the authentication server reported an error', - ) - ), - "OpenPlaylistForEditingMethod" => array( - 'm'=>'openPlaylistForEditing', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('playlist'/*string*/), - 'e'=>array( - '101'=>'invalid argument format', - '102'=>'argument is not a playlist ID', - '104'=>'could not open playlist for editing', - '120'=>'missing session ID argument', - ) - ), - "RemoveAudioClipFromPlaylistMethod" => array( - 'm'=>'removeAudioClipFromPlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/), - 't'=>array('string', 'string', 'string'), - 'r'=>array(), - 'e'=>array( - '401'=>'invalid argument format', - '402'=>'missing playlist ID argument', - '403'=>'missing relative offset argument', - '404'=>'playlist does not exist', - '405'=>'playlist has not been opened for editing', - '406'=>'no audio clip at the specified relative offset', - '420'=>'missing session ID argument', - ) - ), - "RemoveFromScheduleMethod" => array( - 'm'=>'removeFromSchedule', - 'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array(), - 'e'=>array( - '1201'=>'invalid argument format', - '1202'=>'missing schedule entry ID argument', - '1203'=>'schedule entry not found', - '1220'=>'missing session ID argument', - ) - ), - "RescheduleMethod" => array( - 'm'=>'reschedule', - 'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/, 'playtime'/*datetime*/), - 't'=>array('string', 'string', 'dateTime.iso8601'), - 'r'=>array(), - 'e'=>array( - '1301'=>'invalid argument format', - '1302'=>'missing schedule entry ID argument', - '1303'=>'missing playtime argument', - '1304'=>'schedule entry not found', - '1305'=>'could not reschedule entry', - '1320'=>'missing session ID argument', - ) - ), -// "ResetStorageMethod" => array( -// 'm'=>'resetStorage', -// 'p'=>array(), -// 't'=>array(), -// 'r'=>array(), -// 'e'=>array('3001'=>'storage client reported an error'), -// ), - "RevertEditedPlaylistMethod" => array( - 'm'=>'revertEditedPlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array(), - 'e'=>array( - '801'=>'invalid argument format', - '802'=>'argument is not a playlist ID', - '803'=>'playlist not found', - '804'=>'could not revert playlist', - '820'=>'missing session ID argument', - ) - ), - "SavePlaylistMethod" => array( - 'm'=>'savePlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array(), - 'e'=>array( - '701'=>'invalid argument format', - '702'=>'argument is not a playlist ID', - '703'=>'playlist not found', - '705'=>'could not save playlist', - '720'=>'missing session ID argument', - ) - ), - "UpdateFadeInFadeOutMethod" => array( - 'm'=>'updateFadeInFadeOut', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/, 'fadeIn'/*int*/, 'fadeOut'/*int*/), - 't'=>array('string', 'string', 'string', 'int', 'int'), - 'r'=>array(), - 'e'=>array( - '1601'=>'invalid argument format', - '1602'=>'missing playlist ID argument', - '1603'=>'missing playlist element ID argument', - '1604'=>'missing fade in argument', - '1605'=>'missing fade out argument', - '1606'=>'playlist does not exist', - '1607'=>'playlist has not been opened for editing', - '1608'=>'error executing setFadeInfo() method', - '1620'=>'missing session ID argument', - ) - ), - "UploadPlaylistMethod" => array( - 'm'=>'uploadPlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playtime'/*datetime*/), - 't'=>array('string', 'string', 'dateTime.iso8601'), - 'r'=>array('scheduleEntryId'/*string*/), - 'e'=>array( - '1401'=>'invalid argument format', - '1402'=>'missing playlist ID argument', - '1403'=>'missing playtime argument', - '1404'=>'playlist not found', - '1405'=>'timeframe not available', - '1406'=>'could not schedule playlist', - '1420'=>'missing session ID argument', - ) - ), - "ValidatePlaylistMethod" => array( - 'm'=>'validatePlaylist', - 'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('valid'/*bool*/), - 'e'=>array( - '501'=>'invalid argument format', - '502'=>'missing playlist ID argument', - '503'=>'playlist does not exist', - '504'=>'playlist has not been opened for editing', - '520'=>'missing session ID argument', - ) - ), - "LoginGB" => array( - 'm'=>'locstor.login', - 'p'=>array('login'/*string*/, 'pass'/*string*/), - 't'=>array('string', 'string'), - 'r'=>array('sessid'/*string*/), - 'e'=>array( - '2001'=>'invalid argument format', - '2002'=>'missing login argument', - '2003'=>'missing password argument', - '2004'=>'the authentication server reported an error', - ) - ), - "LogoutGB" => array( - 'm'=>'locstor.logout', - 'p'=>array('sessid'/*string*/), - 't'=>array('string'), - 'r'=>array('status'/*boolean*/), - 'e'=>array( - '2001'=>'invalid argument format', - '2002'=>'missing login argument', - '2003'=>'missing password argument', - '2004'=>'the authentication server reported an error', - ) - ), -); - -/* ======================================================== class definitions */ - -class SchedulerPhpClient { - /** - * Array with methods description - * @var array - */ - private $mdefs = array(); - - /** - * XMLRPC client object reference - */ - private $client = NULL; - - /** - * Verbosity flag - */ - private $verbose = FALSE; - - /** - * XMLRPC debug flag - */ - private $debug = 0; - - /** - * Constructor - please DON'T CALL IT, use factory method instead - * - * @param DB $dbc - * @param array $mdefs - * hash array with methods description - * @param array $config - * hash array with configuration - * @param int $debug - * XMLRPC debug flag - * @param boolean $verbose - * verbosity flag - */ - public function __construct($mdefs, $debug=0, $verbose=FALSE) - { - global $CC_DBC, $CC_CONFIG; - $this->mdefs = $mdefs; - $this->debug = $debug; - $this->verbose = $verbose; - $confPrefix = "scheduler"; - //$confPrefix = "storage"; - $serverPath = - "http://{$CC_CONFIG["{$confPrefix}UrlHost"]}:{$CC_CONFIG["{$confPrefix}UrlPort"]}". - "{$CC_CONFIG["{$confPrefix}UrlPath"]}/{$CC_CONFIG["{$confPrefix}XMLRPC"]}"; - //$serverPath = "http://localhost:80/campcasterStorageServerCVS/xmlrpc/xrLocStor.php"; - if ($this->verbose) { - echo "serverPath: $serverPath\n"; - } - $url = parse_url($serverPath); - $this->client = new XML_RPC_Client($url['path'], $url['host'], $url['port']); - } - - - /** - * Factory, create object instance - * - * In fact it doesn't create instance of SchedulerPhpClient, but - * dynamically extend this class with set of methods based on $mdefs array - * (using eval function) and instantiate resulting class - * SchedulerPhpClientCore instead. - * Each new method in this subclass accepts parameters according to $mdefs - * array, call wrapper callMethod(methodname, parameters) and return its - * result. - * - * @param array $mdefs - * hash array with methods description - * @param int $debug - * XMLRPC debug flag - * @param boolean $verbose - * verbosity flag - * @return SchedulerPhpClientCore - */ - function &factory($mdefs, $debug=0, $verbose=FALSE) - { - global $CC_DBC, $CC_CONFIG; - $f = ''; - foreach ($mdefs as $fn => $farr) { - $f .= - ' function '.$fn.'(){'."\n". - ' $pars = func_get_args();'."\n". - ' $r = $this->callMethod("'.$fn.'", $pars);'."\n". - ' return $r;'."\n". - ' }'."\n"; - } - $e = - "class SchedulerPhpClientCore extends SchedulerPhpClient{\n". - "$f\n". - "}\n"; -# echo $e; - if (FALSE === eval($e)) { - return $CC_DBC->raiseError("Eval failed"); - } - $spc = new SchedulerPhpClientCore($mdefs, $debug, $verbose); - return $spc; - } - - - /** - * XMLRPC methods wrapper - * Encode XMLRPC request message, send it, receive and decode response. - * - * @param string $method - * method name - * @param array $gettedPars - * returned by func_get_args() in called method - * @return array - * PHP hash with response - */ - function callMethod($method, $gettedPars) - { - $parr = array(); - $XML_RPC_val = new XML_RPC_Value; - foreach ($this->mdefs[$method]['p'] as $i => $p) { - $parr[$p] = new XML_RPC_Value; - $parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]); - } - $XML_RPC_val->addStruct($parr); - $fullmethod = $this->mdefs[$method]['m']; - $msg = new XML_RPC_Message($fullmethod, array($XML_RPC_val)); - if ($this->verbose) { - echo "parr:\n"; - var_dump($parr); - echo "message:\n"; - echo $msg->serialize()."\n"; - } - $this->client->setDebug($this->debug); - $res = $this->client->send($msg); - if ($res->faultCode() > 0) { - return PEAR::raiseError( - "SchedulerPhpClient::$method:".$res->faultString()." ". - $res->faultCode()."\n", $res->faultCode(), - PEAR_ERROR_RETURN - ); - } - if ($this->verbose) { - echo "result:\n"; - echo $res->serialize(); - } - $val = $res->value(); - $resp = XML_RPC_decode($res->value()); - return $resp; - } - -} // class SchedulerPhpClient - -/* ======================================================== class definitions */ - -/** - * Example of use: - * - * / - - -// db object handling: -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); -$CC_DBC->setErrorHandling(PEAR_ERROR_RETURN); - -// scheduler client instantiation: -$spc = SchedulerPhpClient::factory($mdefs); -#$spc = SchedulerPhpClient::factory($mdefs, 0, TRUE); -if(PEAR::isError($spc)){ echo $spc->getMessage."\n"; exit; } - -// call of chosen function by name according to key values in $mdefs array: -// (for testing on storageServer XMLRPC I've changes confPrefix in -// SchedulerPhpClient constructor from 'scheduler' to 'storage' value) -#$r = $spc->LoginGB('root', 'q'); var_dump($r); -#$r = $spc->LogoutGB(''); var_dump($r); - -#$r = $spc->DisplayScheduleMethod($this->Base->sessid, '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000'); var_dump($r); -#$r = $spc->DisplayScheduleMethod('dummySessionId2-1681692777', '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000'); var_dump($r); -$r = $spc->DisplayScheduleMethod($this->Base->sessid, '20040101T00:00:00', '20050401T00:00:00'); var_dump($r); -#$r = $spc->LoginMethod('root', 'q'); var_dump($r); -#$r = $spc->LogoutMethod('dummySessionId3-1714636915'); var_dump($r); -#$r = $spc->listMethods(); var_dump($r); -#$r = $spc->GetSchedulerTimeMethod(); var_dump($r); -================= */ - -?> \ No newline at end of file diff --git a/backend/xmlrpc/simpleGet.php b/backend/xmlrpc/simpleGet.php deleted file mode 100644 index ebb0cf8dc..000000000 --- a/backend/xmlrpc/simpleGet.php +++ /dev/null @@ -1,128 +0,0 @@ - - *
  • sessid : string, session ID
  • - *
  • id : string, global unique ID of requested file
  • - * - * - * On success, returns HTTP return code 200 and requested file. - * - * On errors, returns HTTP return code >200 - * The possible error codes are: - *
      - *
    • 400 - Incorrect parameters passed to method
    • - *
    • 403 - Access denied
    • - *
    • 404 - File not found
    • - *
    • 500 - Application error
    • - *
    - * - */ - -require_once(dirname(__FILE__).'/../../conf.php'); -require_once('DB.php'); -require_once(dirname(__FILE__).'/../LocStor.php'); -require_once(dirname(__FILE__).'/../MetaData.php'); - -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -$locStor = new LocStor(); - -function http_error($code, $err) -{ - header("HTTP/1.1 $code"); - header("Content-type: text/plain; charset=UTF-8"); - echo "$err\r\n"; - exit; -} - -/** - * This function encodes an filename to - * be transferred via HTTP header. - * - * @param string $p_string utf8 filename - * @return string HTTP header encoded filename - */ -function sg_2hexstring($p_string) -{ - for ($x=0; $x < strlen($p_string); $x++) { - $return .= '%' . bin2hex($p_string[$x]); - } - return $return; -} - -// parameter checking: -if (preg_match("|^[0-9a-fA-F]{32}$|", $_REQUEST['sessid'])) { - $sessid = $_REQUEST['sessid']; -} else { - http_error(400, "Error on sessid parameter. ({$_REQUEST['sessid']})"); -} -if (preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['id'])) { - $gunid = $_REQUEST['id']; -} else { - http_error(400, "Error on id parameter. ({$_REQUEST['id']})"); -} - -// stored file recall: -$ac = StoredFile::RecallByGunid($gunid); -if (PEAR::isError($ac)) { - switch ($ac->getCode()) { - case GBERR_DENY: - http_error(403, "403 ".$ac->getMessage()); - case GBERR_FILENEX: - case GBERR_FOBJNEX: - http_error(404, "404 File not found"); - default: - http_error(500, "500 ".$ac->getMessage()); - } -} -$lid = BasicStor::IdFromGunid($gunid); -if (PEAR::isError($lid)) { - http_error(500, $lid->getMessage()); -} -if (($res = BasicStor::Authorize('read', $lid, $sessid)) !== TRUE) { - http_error(403, "403 Access denied"); -} -$ftype = BasicStor::GetObjType($lid); -if (PEAR::isError($ftype)) { - http_error(500, $ftype->getMessage()); -} -switch ($ftype) { - case "audioclip": - $realFname = $ac->getRealFileName(); - $mime = $ac->getMime(); - $md = new MetaData($ac->getGunId(), null); - $fileName = $md->getMetadataValue('dc:title').'.'.$ac->getFileExtension(); - header("Content-type: $mime"); - header("Content-length: ".filesize($realFname)); - header("Content-Disposition: attachment; filename*=".sg_2hexstring($fileName).";"); - readfile($realFname); - break; - case "webstream": - $url = $locStor->bsGetMetadataValue($lid, 'ls:url'); - if (empty($url)) { - http_error(500, "Unable to get ls:url value"); - } - $txt = "Location: $url"; - header($txt); - // echo "$txt\n"; - break; - case "playlist"; - // $md = $locStor->bsGetMetadata($ac->getId(), $sessid); - $md = $locStor->getAudioClip($sessid, $gunid); - // header("Content-type: text/xml"); - header("Content-type: application/smil"); - echo $md; - break; - default: - // var_dump($ftype); - http_error(500, "500 Unknown ftype ($ftype)"); -} -?> \ No newline at end of file diff --git a/backend/xmlrpc/urldecode b/backend/xmlrpc/urldecode deleted file mode 100755 index 172c8f73c..000000000 --- a/backend/xmlrpc/urldecode +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/php -q - \ No newline at end of file diff --git a/backend/xmlrpc/xrLocStor.php b/backend/xmlrpc/xrLocStor.php deleted file mode 100644 index 5408a389e..000000000 --- a/backend/xmlrpc/xrLocStor.php +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - -faultCode -804 - - -faultString -"); -ini_set("error_append_string", " - - - - -"); -header("Content-type: text/xml"); - -/* ================================================================= includes */ -require_once(dirname(__FILE__).'/../../conf.php'); -require_once('DB.php'); -require_once("XML/RPC/Server.php"); -require_once('XR_LocStor.php'); - -/* ============================================ setting default error handler */ -function errHndl($errno, $errmsg, $filename, $linenum, $vars) -{ - switch ($errno) { - case E_WARNING: - case E_NOTICE: - case E_USER_WARNING: - case E_USER_NOTICE: - return; - break; - default: - $xr = new XML_RPC_Response(0, 805, - htmlspecialchars("ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)")); - header("Content-type: text/xml"); - echo $xr->serialize(); - exit($errno); - } -} -$old_error_handler = set_error_handler("errHndl", E_ALL); - -/* ============================================================= runable code */ -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -if (PEAR::isError($CC_DBC)) { - trigger_error("DB::connect: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo(),E_USER_ERROR); -} -$CC_DBC->setErrorHandling(PEAR_ERROR_RETURN); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -$locStor = new XR_LocStor(); - -$methods = array( - 'test' => 'Tests toupper and checks sessid, params: '. - 'teststring, sessid.', - 'getVersion' => 'Get version of Campcaster.', -// 'authenticate' => 'Checks authentication.', - 'login' => 'Login to storage.', - 'logout' => 'Logout from storage.', - 'existsAudioClip' => 'Checks if an audio clip with the specified '. - 'id is stored in local storage.', - 'storeAudioClipOpen' => 'Open channel to store a new audio clip '. - 'or replace an existing one.', - 'storeAudioClipClose' => 'Close channel to store a new audio clip'. - ' or replace an existing one.', - 'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'. - 'for audio file', - 'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file', - 'downloadMetadataOpen' => 'Create and return downloadable URL'. - 'for metadata', - 'downloadMetadataClose' => 'Discard downloadable URL for metadata', - 'openPut' => 'openPut', - 'closePut' => 'closePut', - 'deleteAudioClip' => 'Delete an existing Audio clip.', - 'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '. - 'stored in Local storage.', - 'searchMetadata' => 'Search through the metadata of stored '. - 'files, return all matching clip ids.', - 'browseCategory' =>'Return values of specified metadata category.', - 'accessRawAudioData' => 'Get access to raw audio data.', - 'releaseRawAudioData' => 'Release access to raw audio data.', - 'getAudioClip' => 'Return the contents of an Audio clip.', -// 'resetStorage' => 'Reset storageServer for debugging.', - 'storeWebstream' => 'Store audio stream identified by URL', - - 'createPlaylist' => 'Create a new Playlist metafile.', - 'editPlaylist' => 'Open a Playlist metafile for editing.', - 'savePlaylist' => 'Save a Playlist metafile.', - 'revertEditedPlaylist' => 'RollBack playlist changes to the locked state.', - 'deletePlaylist' => 'Delete a Playlist metafile.', - 'accessPlaylist' => 'Open readable URL to a Playlist metafile.', - 'releasePlaylist' => 'Release readable URL from accessPlaylist.', - 'existsPlaylist' => 'Check whether a Playlist exists.', - 'playlistIsAvailable' => 'Check whether a Playlist is available '. - 'for editing.', - 'exportPlaylistOpen' => 'Create a tarfile with playlist export.', - 'exportPlaylistClose' => 'Close playlist export.', - 'importPlaylistOpen' => 'Open writable handle for playlist import.', - 'importPlaylistClose' => 'Close import-handle and import playlist.', - - 'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)', - 'renderPlaylistToFileCheck' => 'Render playlist to ogg file (check results)', - 'renderPlaylistToFileClose' => 'Render playlist to ogg file (close handle)', - - 'renderPlaylistToStorageOpen' => 'Render playlist to storage media clip (open handle)', - 'renderPlaylistToStorageCheck' => 'Render playlist to storage media clip (check results)', - - 'renderPlaylistToRSSOpen' => 'Render playlist to RSS file (open handle)', - 'renderPlaylistToRSSCheck' => 'Render playlist to RSS file (check results)', - 'renderPlaylistToRSSClose' => 'Render playlist to RSS file (close handle)', - - 'createBackupOpen' => 'Create backup of storage (open handle)', - 'createBackupCheck' => 'Create backup of storage (check results)', - 'createBackupClose' => 'Create backup of storage (close handle)', - - 'restoreBackupOpen' => 'Restore a backup file (open handle)', - 'restoreBackupClosePut' => 'Restore a backup file (close PUT handle)', - 'restoreBackupCheck' => 'Restore a backup file (check results)', - 'restoreBackupClose' => 'Restore a backup file (close handle)', - - 'loadPref' => 'Load user preference value.', - 'savePref' => 'Save user preference value.', - 'delPref' => 'Delete user preference record.', - 'loadGroupPref' => 'Read group preference record.', - 'saveGroupPref' => 'Delete user preference record.', - - 'getTransportInfo' => 'Common "check" method and info getter for transports', - 'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state', - 'doTransportAction' => 'Pause, resume or cancel transport', - 'uploadFile2Hub' => 'Open async file transfer from local storageServer to network hub', - 'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub', - 'startHubInitiatedTransfer' => 'Start of download initiated by hub', - 'upload2Hub' => 'Start upload of audioclip or playlist from local storageServer to hub', - 'downloadFromHub' => 'Start download of audioclip or playlist from hub to local storageServer', -// 'globalSearch' => 'Start search job on network hub', -// 'getSearchResults' => 'Get results from search job on network hub', - - 'uploadOpen' => 'Open file-layer upload', - 'uploadCheck' => 'Check the checksum of uploaded file', - 'uploadClose' => 'Close file-layer upload', - 'downloadOpen' => 'Open file-layer download', -// 'downloadCheck' => 'Check the checksum of downloaded file', - 'downloadClose' => 'Close file-layer download', - 'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer', - 'listHubInitiatedTransfers' => 'List hub initiated transfers', - 'setHubInitiatedTransfer' => 'Set state of hub initiated transfers', - 'ping' => 'Echo request', -); - -$defs = array(); -foreach ($methods as $method => $description) { - $defs["locstor.$method"] = array( - "function" => array(&$locStor, "xr_$method"), - // NOTE: the way this signature is set up, every function must take at least one parameter! - "signature" => array( - array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct']) - ), - "docstring" => $description - ); -} - -$s = new XML_RPC_Server($defs); - -?> \ No newline at end of file diff --git a/backend/xmlrpc/xr_cli_test.php b/backend/xmlrpc/xr_cli_test.php deleted file mode 100644 index c282be12b..000000000 --- a/backend/xmlrpc/xr_cli_test.php +++ /dev/null @@ -1,368 +0,0 @@ -debug = 1; - echo "ServerPath: $serverPath\n"; - echo "Host: {$url['host']}, path: {$url['path']}\n"; - echo "Method: $method\n"; - echo "Parameters:\n"; - //var_dump($pars); -} - -$infos = array( - "listMethods" => array('m'=>"system.listMethods", 'p'=>NULL), - "methodHelp" => array('m'=>"system.methodHelp", 'p'=>0), - "methodSignature" => array('m'=>"system.methodSignature", 'p'=>0), - "test" => array('m'=>"locstor.test", 'p'=>array('sessid', 'teststring')), - "ping" => array('m'=>"locstor.ping", 'p'=>array("par")), - "getVersion" => array('m'=>"locstor.getVersion", 'p'=>array("str"), 'r'=>'version'), - "authenticate" => array('m'=>"locstor.authenticate", 'p'=>array('login', 'pass'), 'r'=>'authenticate'), - "login" => array('m'=>"locstor.login", 'p'=>array('login', 'pass'), 'r'=>'sessid'), - "logout" => array('m'=>"locstor.logout", 'p'=>array('sessid'), 'r'=>'status'), - "storeAudioClipOpen" => array('m'=>"locstor.storeAudioClipOpen", - 'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'chsum'), - 'r'=>array('url', 'token') - ), - "storeAudioClipClose" => array('m'=>"locstor.storeAudioClipClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - "accessRawAudioData" => array('m'=>"locstor.accessRawAudioData", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "releaseRawAudioData" => array('m'=>"locstor.releaseRawAudioData", - 'p'=>array('token'), 'r'=>'status'), - "downloadRawAudioDataOpen" => - array('m'=>"locstor.downloadRawAudioDataOpen", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "downloadRawAudioDataClose" => - array('m'=>"locstor.downloadRawAudioDataClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - "downloadMetadataOpen" => array('m'=>"locstor.downloadMetadataOpen", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "downloadMetadataClose" => array('m'=>"locstor.downloadMetadataClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - - "deleteAudioClip" => - array('m'=>"locstor.deleteAudioClip", - 'p'=>array('sessid', 'gunid', 'forced'), 'r'=>'status'), - "existsAudioClip" => array('m'=>"locstor.existsAudioClip", - 'p'=>array('sessid', 'gunid'), 'r'=>'exists'), - "getAudioClip" => array('m'=>"locstor.getAudioClip", - 'p'=>array('sessid', 'gunid'), 'r'=>'metadata'), - "updateAudioClipMetadata" => array('m'=>"locstor.updateAudioClipMetadata", - 'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'), - "searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL), - "browseCategory" => array('m'=>"locstor.browseCategory", 'p'=>NULL), -// "resetStorage" => array('m'=>"locstor.resetStorage", -// 'p'=>array()), -# 'p'=>array('loadSampleData', 'invalidateSessionIds')), - "storeWebstream" => array('m'=>"locstor.storeWebstream", - 'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'url'), - 'r'=>array('gunid') - ), - - "createPlaylist" => array('m'=>"locstor.createPlaylist", - 'p'=>array('sessid', 'plid', 'fname'), 'r'=>'plid'), - "editPlaylist" => array('m'=>"locstor.editPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')), - "savePlaylist" => array('m'=>"locstor.savePlaylist", - 'p'=>array('sessid', 'token', 'newPlaylist'), 'r'=>'plid'), - "revertEditedPlaylist" => array('m'=>"locstor.revertEditedPlaylist", - 'p'=>array('sessid', 'token'), 'r'=>'plid'), - "deletePlaylist" => array('m'=>"locstor.deletePlaylist", - 'p'=>array('sessid', 'plid', 'forced'), 'r'=>'status'), - "accessPlaylist" => array('m'=>"locstor.accessPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')), - "releasePlaylist" => array('m'=>"locstor.releasePlaylist", - 'p'=>array('token'), 'r'=>'plid'), - "existsPlaylist" => array('m'=>"locstor.existsPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>'exists'), - "playlistIsAvailable" => array('m'=>"locstor.playlistIsAvailable", - 'p'=>array('sessid', 'plid'), 'r'=>array('available', 'ownerid', 'ownerlogin')), - - "exportPlaylistOpen" => array('m'=>"locstor.exportPlaylistOpen", - 'p'=>array('sessid', 'plids', 'type', 'standalone'), - 'r'=>array('url', 'token')), - "exportPlaylistClose" => array('m'=>"locstor.exportPlaylistClose", - 'p'=>array('token'), 'r'=>array('status')), - "importPlaylistOpen" => array('m'=>"locstor.importPlaylistOpen", - 'p'=>array('sessid', 'chsum'), 'r'=>array('url', 'token')), - "importPlaylistClose" => array('m'=>"locstor.importPlaylistClose", - 'p'=>array('token'), 'r'=>array('gunid')), - - "renderPlaylistToFileOpen" => array('m'=>"locstor.renderPlaylistToFileOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToFileCheck" => array('m'=>"locstor.renderPlaylistToFileCheck", - 'p'=>array('token'), 'r'=>array('status', 'url')), - "renderPlaylistToFileClose" => array('m'=>"locstor.renderPlaylistToFileClose", - 'p'=>array('token'), 'r'=>array('status')), - "renderPlaylistToStorageOpen" => array('m'=>"locstor.renderPlaylistToStorageOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToStorageCheck" => array('m'=>"locstor.renderPlaylistToStorageCheck", - 'p'=>array('token'), 'r'=>array('status', 'gunid')), - "renderPlaylistToRSSOpen" => array('m'=>"locstor.renderPlaylistToRSSOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToRSSCheck" => array('m'=>"locstor.renderPlaylistToRSSCheck", - 'p'=>array('token'), 'r'=>array('status', 'url')), - "renderPlaylistToRSSClose" => array('m'=>"locstor.renderPlaylistToRSSClose", - 'p'=>array('token'), 'r'=>array('status')), - - "loadPref" => array('m'=>"locstor.loadPref", - 'p'=>array('sessid', 'key'), 'r'=>'value'), - "savePref" => array('m'=>"locstor.savePref", - 'p'=>array('sessid', 'key', 'value'), 'r'=>'status'), - "delPref" => array('m'=>"locstor.delPref", - 'p'=>array('sessid', 'key'), 'r'=>'status'), - "loadGroupPref" => array('m'=>"locstor.loadGroupPref", - 'p'=>array('sessid', 'group', 'key'), 'r'=>'value'), - "saveGroupPref" => array('m'=>"locstor.saveGroupPref", - 'p'=>array('sessid', 'group', 'key', 'value'), 'r'=>'status'), - - "getTransportInfo" => array('m'=>"locstor.getTransportInfo", - 'p'=>array('trtok'), - 'r'=>array('state', 'realsize', 'expectedsize', 'realsum', 'expectedsum')), - "turnOnOffTransports" => array('m'=>"locstor.turnOnOffTransports", - 'p'=>array('sessid', 'onOff'), 'r'=>array('state')), - "doTransportAction" => array('m'=>"locstor.doTransportAction", - 'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')), - "uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub", - 'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')), - "getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers", - 'p'=>array('sessid'), 'r'=>array()), - "startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer", - 'p'=>array('trtok'), 'r'=>array()), - "upload2Hub" => array('m'=>"locstor.upload2Hub", - 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), - "downloadFromHub" => array('m'=>"locstor.downloadFromHub", - 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), -// "globalSearch" => array('m'=>"locstor.globalSearch", -// 'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')), -// "getSearchResults" => array('m'=>"locstor.getSearchResults", -// 'p'=>array('trtok')), - - "createBackupOpen" => array('m'=>"locstor.createBackupOpen", - 'p'=>array('sessid', 'criteria'), 'r'=>array('token')), - "createBackupCheck" => array('m'=>"locstor.createBackupCheck", -# 'p'=>array('token'), 'r'=>array('status', 'url', 'metafile', 'faultString')), - 'p'=>array('token'), 'r'=>array('status', 'url', 'tmpfile')), - "createBackupClose" => array('m'=>"locstor.createBackupClose", - 'p'=>array('token'), 'r'=>array('status')), - "restoreBackupOpen" => array('m'=>"locstor.restoreBackupOpen", - 'p'=>array('sessid', 'chsum'), 'r'=>array('url', 'token')), - "restoreBackupClosePut" => array('m'=>"locstor.restoreBackupClosePut", - 'p'=>array('sessid', 'token'), 'r'=>array('token')), - "restoreBackupCheck" => array('m'=>"locstor.restoreBackupCheck", - 'p'=>array('token'), 'r'=>array('status', 'faultString')), - "restoreBackupClose" => array('m'=>"locstor.restoreBackupClose", - 'p'=>array('token'), 'r'=>array('status')), - -/* - "uploadToArchive" => array('m'=>"locstor.uploadToArchive", - 'p'=>array('sessid', 'gunid'), 'r'=>'trtok'), - "downloadFromArchive" => array('m'=>"locstor.downloadFromArchive", - 'p'=>array('sessid', 'gunid'), 'r'=>'trtok'), -*/ - - "openPut" => array('m'=>"locstor.openPut", 'p'=>array()), - "closePut" => array('m'=>"locstor.closePut", 'p'=>array()), -); - - -switch ($method) { - case "searchMetadata": -// case "globalSearch": - case "createBackupOpen": - $parr = array( - 'sessid'=>$pars[0], - 'criteria'=>array( - 'filetype'=>'audioclip', - 'operator'=>'and', - 'limit'=> 0, - 'offset'=> 0, - 'conditions'=>array( - array('cat'=>$pars[1], 'op'=>'partial', 'val'=>$pars[2]) - ) - ), - ); - break; - case "browseCategory": - $parr = array( - 'sessid'=>$pars[0], - 'category'=>$pars[1], - 'criteria'=>array( - 'filetype'=>'audioclip', - 'operator'=>'and', - 'limit'=> 0, - 'offset'=> 0, - 'conditions'=>array( - array('cat'=>$pars[2], 'op'=>'partial', 'val'=>$pars[3]) - ) - ), - ); - break; -// case "resetStorage": -// $parr = array( -// 'loadSampleData'=>(boolean)$pars[0], -// 'invalidateSessionIds'=>(boolean)$pars[1], -// ); -// break; - default: - $pinfo = $infos[$method]['p']; - if (is_null($pinfo)) { - $parr = NULL; - } elseif(!is_array($pinfo)) { - $parr = $pars[0]; - #echo "pinfo not null and not array.\n"; exit; - } elseif(count($pinfo) == 0) { - $parr = (object)array(); - } else { - $parr = array(); $i=0; - foreach($pinfo as $it){ - if(isset($pars[$i])) $parr[$it] = $pars[$i]; - $i++; - } - } -} // switch - -$fullmethod = $infos[$method]['m']; -if (is_array($options)) { - $msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($options))); -} else { - $msg = new XML_RPC_Message($fullmethod); -} -//$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr))); - -if ($verbose) { - echo "parr:\n"; - var_dump($parr); - echo "message:\n"; - echo $msg->serialize()."\n"; -} - -#$client->setDebug(1); -$res = $client->send($msg); -if ($res->faultCode() > 0) { - echo "xr_cli_test.php: ".$res->faultString()." ".$res->faultCode()."\n"; -# echo var_export($res); - exit(1); -} - -if ($verbose) { - echo "result:\n"; - echo $res->serialize(); -} - -$resp = XML_RPC_decode($res->value()); -if (isset($infos[$method]['r'])) { - $pom = $infos[$method]['r']; - if (is_array($pom)) { - foreach ($pom as $k => $it) { - $pom[$k] = $resp[$it]; - } - echo join(' ', $pom)."\n"; - } else { - switch ($pom) { - case "status": - case "exists": - echo ($resp[$pom]=='1' ? "TRUE" : "FALSE" )."\n"; - break; - default: - echo "{$resp[$pom]}\n"; - } - } -} else { - switch ($method) { - case "searchMetadata": -// case "getSearchResults": - $acCnt = 0; - $acGunids = array(); - $plCnt = 0; - $plGunids = array(); - $fld = (isset($options['category']) ? $options['category'] : 'gunid' ); - foreach ($resp['results'] as $k => $v) { - if ($v['type']=='audioclip') { - $acCnt++; - $acGunids[] = $v[$fld]; - } - if ($v['type']=='playlist') { - $plCnt++; - $plGunids[] = $v[$fld]; - } - } - echo "AC({$acCnt}): ". - join(", ", $acGunids). - " | PL({$plCnt}): ". - join(", ", $plGunids). - "\n"; - break; - case "browseCategory": - echo "RES({$resp['cnt']}): ". - join(", ", $resp['results']). - "\n"; - break; - default: - print_r($resp); - echo "\n"; - } -} - -?> \ No newline at end of file diff --git a/backend/xmlrpc/xr_web_test.php b/backend/xmlrpc/xr_web_test.php deleted file mode 100644 index 34537170c..000000000 --- a/backend/xmlrpc/xr_web_test.php +++ /dev/null @@ -1,373 +0,0 @@ -'.htmlspecialchars($p_printValue)."\n"; - echo $str; - return $selected; -} // fn camp_html_select_option - - -$serverPath = - "http://{$CC_CONFIG['storageUrlHost']}:{$CC_CONFIG['storageUrlPort']}". - "{$CC_CONFIG['storageUrlPath']}/{$CC_CONFIG['storageXMLRPC']}"; -$serverPath = camp_session_get("storageserver_xmlrpc_path", $serverPath); -$f_selectedMethod = camp_session_get("f_selectedMethod", "listMethods"); -$url = parse_url($serverPath); -$client = new XML_RPC_Client($url['path'], $url['host']); - -$methodDefs = array( - "listMethods" => array('m'=>"system.listMethods", 'p'=>NULL), - "methodHelp" => array('m'=>"system.methodHelp", 'p'=>0), - "methodSignature" => array('m'=>"system.methodSignature", 'p'=>0), - "test" => array('m'=>"locstor.test", 'p'=>array('sessid', 'teststring')), - "getVersion" => array('m'=>"locstor.getVersion", 'p'=>array(), 'r'=>'version'), - "authenticate" => array('m'=>"locstor.authenticate", 'p'=>array('login', 'pass'), 'r'=>'authenticate'), - "login" => array('m'=>"locstor.login", 'p'=>array('login', 'pass'), 'r'=>'sessid'), - "logout" => array('m'=>"locstor.logout", 'p'=>array('sessid'), 'r'=>'status'), - "storeAudioClipOpen" => array('m'=>"locstor.storeAudioClipOpen", - 'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'chsum'), - 'r'=>array('url', 'token') - ), - "storeAudioClipClose" => array('m'=>"locstor.storeAudioClipClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - "accessRawAudioData" => array('m'=>"locstor.accessRawAudioData", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "releaseRawAudioData" => array('m'=>"locstor.releaseRawAudioData", - 'p'=>array('token'), 'r'=>'status'), - "downloadRawAudioDataOpen" => - array('m'=>"locstor.downloadRawAudioDataOpen", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "downloadRawAudioDataClose" => - array('m'=>"locstor.downloadRawAudioDataClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - "downloadMetadataOpen" => array('m'=>"locstor.downloadMetadataOpen", - 'p'=>array('sessid', 'gunid'), 'r'=>array('url', 'token')), - "downloadMetadataClose" => array('m'=>"locstor.downloadMetadataClose", - 'p'=>array('sessid', 'token'), 'r'=>'gunid'), - - "deleteAudioClip" => - array('m'=>"locstor.deleteAudioClip", - 'p'=>array('sessid', 'gunid', 'forced'), 'r'=>'status'), - "existsAudioClip" => array('m'=>"locstor.existsAudioClip", - 'p'=>array('sessid', 'gunid'), 'r'=>'exists'), - "getAudioClip" => array('m'=>"locstor.getAudioClip", - 'p'=>array('sessid', 'gunid'), 'r'=>'metadata'), - "updateAudioClipMetadata" => array('m'=>"locstor.updateAudioClipMetadata", - 'p'=>array('sessid', 'gunid', 'metadata'), 'r'=>'status'), - "searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL), - "browseCategory" => array('m'=>"locstor.browseCategory", 'p'=>NULL), -// "resetStorage" => array('m'=>"locstor.resetStorage", -// 'p'=>array()), - "storeWebstream" => array('m'=>"locstor.storeWebstream", - 'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'url'), - 'r'=>array('gunid') - ), - - "createPlaylist" => array('m'=>"locstor.createPlaylist", - 'p'=>array('sessid', 'plid', 'fname'), 'r'=>'plid'), - "editPlaylist" => array('m'=>"locstor.editPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')), - "savePlaylist" => array('m'=>"locstor.savePlaylist", - 'p'=>array('sessid', 'token', 'newPlaylist'), 'r'=>'plid'), - "revertEditedPlaylist" => array('m'=>"locstor.revertEditedPlaylist", - 'p'=>array('sessid', 'token'), 'r'=>'plid'), - "deletePlaylist" => array('m'=>"locstor.deletePlaylist", - 'p'=>array('sessid', 'plid', 'forced'), 'r'=>'status'), - "accessPlaylist" => array('m'=>"locstor.accessPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>array('url', 'token')), - "releasePlaylist" => array('m'=>"locstor.releasePlaylist", - 'p'=>array('token'), 'r'=>'plid'), - "existsPlaylist" => array('m'=>"locstor.existsPlaylist", - 'p'=>array('sessid', 'plid'), 'r'=>'exists'), - "playlistIsAvailable" => array('m'=>"locstor.playlistIsAvailable", - 'p'=>array('sessid', 'plid'), 'r'=>array('available', 'ownerid', 'ownerlogin')), - - "exportPlaylistOpen" => array('m'=>"locstor.exportPlaylistOpen", - 'p'=>array('sessid', 'plids', 'type', 'standalone'), - 'r'=>array('url', 'token')), - "exportPlaylistClose" => array('m'=>"locstor.exportPlaylistClose", - 'p'=>array('token'), 'r'=>array('status')), - "importPlaylistOpen" => array('m'=>"locstor.importPlaylistOpen", - 'p'=>array('sessid', 'chsum'), 'r'=>array('url', 'token')), - "importPlaylistClose" => array('m'=>"locstor.importPlaylistClose", - 'p'=>array('token'), 'r'=>array('gunid')), - - "renderPlaylistToFileOpen" => array('m'=>"locstor.renderPlaylistToFileOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToFileCheck" => array('m'=>"locstor.renderPlaylistToFileCheck", - 'p'=>array('token'), 'r'=>array('status', 'url')), - "renderPlaylistToFileClose" => array('m'=>"locstor.renderPlaylistToFileClose", - 'p'=>array('token'), 'r'=>array('status')), - "renderPlaylistToStorageOpen" => array('m'=>"locstor.renderPlaylistToStorageOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToStorageCheck" => array('m'=>"locstor.renderPlaylistToStorageCheck", - 'p'=>array('token'), 'r'=>array('status', 'gunid')), - "renderPlaylistToRSSOpen" => array('m'=>"locstor.renderPlaylistToRSSOpen", - 'p'=>array('sessid', 'plid'), - 'r'=>array('token')), - "renderPlaylistToRSSCheck" => array('m'=>"locstor.renderPlaylistToRSSCheck", - 'p'=>array('token'), 'r'=>array('status', 'url')), - "renderPlaylistToRSSClose" => array('m'=>"locstor.renderPlaylistToRSSClose", - 'p'=>array('token'), 'r'=>array('status')), - - "loadPref" => array('m'=>"locstor.loadPref", - 'p'=>array('sessid', 'key'), 'r'=>'value'), - "savePref" => array('m'=>"locstor.savePref", - 'p'=>array('sessid', 'key', 'value'), 'r'=>'status'), - "delPref" => array('m'=>"locstor.delPref", - 'p'=>array('sessid', 'key'), 'r'=>'status'), - "loadGroupPref" => array('m'=>"locstor.loadGroupPref", - 'p'=>array('sessid', 'group', 'key'), 'r'=>'value'), - "saveGroupPref" => array('m'=>"locstor.saveGroupPref", - 'p'=>array('sessid', 'group', 'key', 'value'), 'r'=>'status'), - - "getTransportInfo" => array('m'=>"locstor.getTransportInfo", - 'p'=>array('trtok'), - 'r'=>array('state', 'realsize', 'expectedsize', 'realsum', 'expectedsum')), - "turnOnOffTransports" => array('m'=>"locstor.turnOnOffTransports", - 'p'=>array('sessid', 'onOff'), 'r'=>array('state')), - "doTransportAction" => array('m'=>"locstor.doTransportAction", - 'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')), - "uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub", - 'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')), - "getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers", - 'p'=>array('sessid'), 'r'=>array()), - "startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer", - 'p'=>array('trtok'), 'r'=>array()), - "upload2Hub" => array('m'=>"locstor.upload2Hub", - 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), - "downloadFromHub" => array('m'=>"locstor.downloadFromHub", - 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), -// "globalSearch" => array('m'=>"locstor.globalSearch", -// 'p'=>array('sessid', 'criteria'), 'r'=>array('trtok')), -// "getSearchResults" => array('m'=>"locstor.getSearchResults", -// 'p'=>array('trtok')), - - "createBackupOpen" => array('m'=>"locstor.createBackupOpen", - 'p'=>array('sessid', 'criteria'), 'r'=>array('token')), - "createBackupCheck" => array('m'=>"locstor.createBackupCheck", -# 'p'=>array('token'), 'r'=>array('status', 'url', 'metafile', 'faultString')), - 'p'=>array('token'), 'r'=>array('status', 'url', 'tmpfile')), - "createBackupClose" => array('m'=>"locstor.createBackupClose", - 'p'=>array('token'), 'r'=>array('status')), - "restoreBackupOpen" => array('m'=>"locstor.restoreBackupOpen", - 'p'=>array('sessid', 'chsum'), 'r'=>array('url', 'token')), - "restoreBackupClosePut" => array('m'=>"locstor.restoreBackupClosePut", - 'p'=>array('sessid', 'token'), 'r'=>array('token')), - "restoreBackupCheck" => array('m'=>"locstor.restoreBackupCheck", - 'p'=>array('token'), 'r'=>array('status', 'faultString')), - "restoreBackupClose" => array('m'=>"locstor.restoreBackupClose", - 'p'=>array('token'), 'r'=>array('status')), - "openPut" => array('m'=>"locstor.openPut", 'p'=>array()), - "closePut" => array('m'=>"locstor.closePut", 'p'=>array()), -); - -if (isset($_REQUEST['go_button'])) { - // Get the parameters - $methodParams = $methodDefs[$f_selectedMethod]['p']; - foreach ($methodParams as $methodParamName) { - $inputParamName = "param_".$methodParamName; - $xmlParameters[$methodParamName] = $_REQUEST[$inputParamName]; - $_SESSION[$inputParamName] = $_REQUEST[$inputParamName]; - } - - // Create the XML-RPC message - $actualMethod = $methodDefs[$f_selectedMethod]['m']; - $msg = new XML_RPC_Message($actualMethod, array(XML_RPC_encode($xmlParameters))); - $sentMessage = $msg->serialize(); - - // Send it - $sendResult = $client->send($msg); - if ($sendResult->faultCode() > 0) { - $errorMsg = "xr_cli_test.php: ".$sendResult->faultString()." ".$sendResult->faultCode()."\n"; - } else { - // If successful - $xmlResponse = XML_RPC_decode($sendResult->value()); - - // Special case state handling - switch ($f_selectedMethod) { - case "login": - // Remember the login session ID so we can use it to call - // other methods. - $loggedIn = true; - $_SESSION['xmlrpc_session_id'] = $xmlResponse['sessid']; - break; - case "logout": - unset($_SESSION['xmlrpc_session_id']); - break; - case "storeAudioClipOpen": - $_SESSION['xmlrpc_token'] = $xmlResponse['token']; - $_SESSION['xmlrpc_put_url'] = $xmlResponse['url']; - break; - } - - if (isset($methodDefs[$method]['r'])) { - $expectedResult = $methodDefs[$method]['r']; - if (is_array($expectedResult)) { - foreach ($expectedResult as $resultName) { - $actualResults[$resultName] = $xmlResponse[$resultName]; - } - echo join(' ', $actualResults)."\n"; - } else { - switch ($expectedResult) { - case "status": - case "exists": - echo ($xmlResponse[$expectedResult]=='1' ? "TRUE" : "FALSE" )."\n"; - break; - default: - echo "{$xmlResponse[$expectedResult]}\n"; - } - } - } else { - switch ($method) { - case "searchMetadata": -// case "getSearchResults": - $acCnt = 0; - $acGunids = array(); - $plCnt = 0; - $plGunids = array(); - $fld = (isset($options['category']) ? $options['category'] : 'gunid' ); - foreach ($xmlResponse['results'] as $k => $v) { - if ($v['type']=='audioclip') { - $acCnt++; - $acGunids[] = $v[$fld]; - } - if ($v['type']=='playlist') { - $plCnt++; - $plGunids[] = $v[$fld]; - } - } - echo "AC({$acCnt}): ". - join(", ", $acGunids). - " | PL({$plCnt}): ". - join(", ", $plGunids). - "\n"; - break; - case "browseCategory": - echo "RES({$xmlResponse['cnt']}): ". - join(", ", $xmlResponse['results']). - "\n"; - break; - default: - //print_r($xmlResponse); - } - } - } -} -?> - - -
    -StorageServer path :
    -Method: - -
    -Parameters: -"; -} else { - echo ""; - foreach ($methodParams as $methodParamName) { - $value = ""; - if ($methodParamName == "sessid" && isset($_SESSION['xmlrpc_session_id'])) { - $value = $_SESSION['xmlrpc_session_id']; - } elseif ($methodParamName == "token" && isset($_SESSION['xmlrpc_token'])) { - $value = $_SESSION['xmlrpc_token']; - } elseif (isset($_SESSION["param_".$methodParamName])) { - $value = $_SESSION["param_".$methodParamName]; - } - echo ""; - echo ""; ?> - "; -} -?> -
    - - - - -
    "; -} -if (isset($sentMessage)) { - ?> - Sent message:
    - -
    - - Error:
    - -
    - - Response:
    - -
    - - - diff --git a/pypo/api_clients/api_client.py b/pypo/api_clients/api_client.py index 59fd22e48..4f6357a74 100644 --- a/pypo/api_clients/api_client.py +++ b/pypo/api_clients/api_client.py @@ -251,7 +251,7 @@ class CampcasterApiClient(ApiClientInterface): logger = logging.getLogger() try: - src = src + "&api_key=" + self.config["api_key"] + src = src + "/api_key/" + self.config["api_key"] # check if file exists already before downloading again filename, headers = urllib.urlretrieve(src, dst) @@ -269,7 +269,7 @@ class CampcasterApiClient(ApiClientInterface): schedule_id = playlist["schedule_id"] url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] url = url.replace("%%schedule_id%%", str(schedule_id)) - url += "&api_key=" + self.config["api_key"] + url = url.replace("%%api_key%%", self.config["api_key"]) logger.debug(url) try: diff --git a/pypo/config.cfg b/pypo/config.cfg index 26ec732cd..7655854f0 100644 --- a/pypo/config.cfg +++ b/pypo/config.cfg @@ -72,24 +72,24 @@ cue_style = 'pre' api_key = 'AAA' # Path to the base of the API -api_base = 'campcaster/' +api_base = 'api/' # URL to get the version number of the server API -version_url = 'api/api_version.php?api_key=%%api_key%%' +version_url = 'version/api_key/%%api_key%%' # Schedule export path. # %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm # %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm -export_url = 'api/schedule.php?from=%%from%%&to=%%to%%&api_key=%%api_key%%' +export_url = 'schedule/api_key/%%api_key%%/from/%%from%%/to/%%to%%' # Update whether a schedule group has begun playing. -update_item_url = 'api/notify_schedule_group_play.php?schedule_id=%%schedule_id%%' +update_item_url = 'notifyScheduleGroupPlay/api_key/%%api_key%%/schedule_id/%%schedule_id%%' # Update whether an audio clip is currently playing. -update_start_playing_url = 'api/notify_media_item_start_play.php?media_id=%%media_id%%&schedule_id=%%schedule_id%%' +update_start_playing_url = 'notifyMediaItemStartPlay/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%' # ??? -generate_range_url = 'api/generate_range_dp.php' +generate_range_url = 'generate_range_dp.php' ############## diff --git a/pypo/install/pypo-daemontools-fetch.sh b/pypo/install/pypo-daemontools-fetch.sh index bf762ae89..6e7bed55d 100644 --- a/pypo/install/pypo-daemontools-fetch.sh +++ b/pypo/install/pypo-daemontools-fetch.sh @@ -2,8 +2,8 @@ pypo_user="pypo" export HOME="/home/pypo/" # Location of pypo_cli.py Python script -pypo_path="/opt/pypo/bin" -pypo_script="pypo_cli.py" +pypo_path="/opt/pypo/bin/" +pypo_script="pypo-cli.py" echo "*** Daemontools: starting daemon" cd ${pypo_path} exec 2>&1 diff --git a/pypo/install/pypo-daemontools-push.sh b/pypo/install/pypo-daemontools-push.sh index b933ea838..4c5cc9f7c 100644 --- a/pypo/install/pypo-daemontools-push.sh +++ b/pypo/install/pypo-daemontools-push.sh @@ -2,8 +2,8 @@ pypo_user="pypo" export HOME="/home/pypo/" # Location of pypo_cli.py Python script -pypo_path="/opt/pypo/bin" -pypo_script="pypo_cli.py" +pypo_path="/opt/pypo/bin/" +pypo_script="pypo-cli.py" echo "*** Daemontools: starting daemon" cd ${pypo_path} exec 2>&1 diff --git a/pypo/install/pypo-install.py b/pypo/install/pypo-install.py index adeb85619..a5a38dfbc 100644 --- a/pypo/install/pypo-install.py +++ b/pypo/install/pypo-install.py @@ -61,8 +61,17 @@ try: shutil.copy("../scripts/silence-playlist.lsp", BASE_PATH+"files/basic") shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic") shutil.copy("../pypo-cli.py", BASE_PATH+"bin") + shutil.copy("../pypo-notify.py", BASE_PATH+"bin") + shutil.copy("../logging.cfg", BASE_PATH+"bin") + shutil.copy("../config.cfg", BASE_PATH+"bin") shutil.copy("../pypo-log.sh", BASE_PATH+"bin") - + print "Copying directory util" + shutil.copytree("../util", BASE_PATH+"bin/util") + print "Copying directory api_clients" + shutil.copytree("../api_clients", BASE_PATH+"bin/api_clients") + print "Copying directory scripts" + shutil.copytree("../scripts", BASE_PATH+"bin/scripts") + print "Setting permissions" os.system("chmod -R 755 "+BASE_PATH) os.system("chown -R pypo:pypo "+BASE_PATH) @@ -95,8 +104,18 @@ try: output = p.stdout.read() if (output.find("unable to open supervise/ok: file does not exist") >= 0): print "Install has completed, but daemontools is not running, please make sure you have it installed and then reboot." + sys.exit() + print output + + p = Popen('svstat /etc/service/pypo-push', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) + output = p.stdout.read() + print output + + p = Popen('svstat /etc/service/pypo-liquidsoap', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) + output = p.stdout.read() + print output - #os.symlink(BASE_PATH+"bin/pypo-log.sh", "/usr/local/bin/") +#os.symlink(BASE_PATH+"bin/pypo-log.sh", "/usr/local/bin/") except Exception, e: diff --git a/application/models/tests/pypoTester.php b/pypo/tests/pypoTester.php similarity index 81% rename from application/models/tests/pypoTester.php rename to pypo/tests/pypoTester.php index 4443b14c1..0fa1853e9 100644 --- a/application/models/tests/pypoTester.php +++ b/pypo/tests/pypoTester.php @@ -1,12 +1,23 @@ getMessage()." ".$CC_DBC->getUserInfo()."\n"; + exit(1); +} +$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); + $playlistName = "pypo_playlist_test"; $minutesFromNow = 1; @@ -82,4 +93,4 @@ $scheduleGroup = new ScheduleGroup(); $scheduleGroup->add($playTime, null, $pl->getId()); echo " SUCCESS: Playlist scheduled at $playTime\n\n"; -?> \ No newline at end of file +?> diff --git a/tests/application/controllers/ApiControllerTest.php b/tests/application/controllers/ApiControllerTest.php new file mode 100644 index 000000000..aaf96967e --- /dev/null +++ b/tests/application/controllers/ApiControllerTest.php @@ -0,0 +1,20 @@ +" -date +\ %Y%m%d\ %H:%M:%S -echo "backup.sh: create tarball $1 to $2" -echo "backup.sh: status: #$3#" -echo "<==" -echo -n "working" > $3; -touch $2 || { echo -n "fault|error with .tar file" > $3; exit 1; } -#sleep 120 -cd $1 -tar cf $2 * || { echo -n "fault|error in tar procedure" > $3; exit 1; } -chmod 666 $2 - -echo -n "success" > $3 diff --git a/utils/campcaster-backup.php b/utils/campcaster-backup.php index 596d156b3..de0f0e405 100644 --- a/utils/campcaster-backup.php +++ b/utils/campcaster-backup.php @@ -5,9 +5,9 @@ header("Content-type: text/plain"); require_once('DB.php'); require_once("XML/Util.php"); require_once("XML/Beautifier.php"); -require_once(dirname(__FILE__)."/../conf.php"); -require_once(dirname(__FILE__)."/../backend/BasicStor.php"); -require_once(dirname(__FILE__)."/../backend/Prefs.php"); +require_once(dirname(__FILE__)."/../application/configs/conf.php"); +require_once(dirname(__FILE__)."/../application/models/BasicStor.php"); +require_once(dirname(__FILE__)."/../application/models/Prefs.php"); PEAR::setErrorHandling(PEAR_ERROR_RETURN); $CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); diff --git a/utils/campcaster-import.php b/utils/campcaster-import.php index 77f2223b0..8cb92dcf3 100644 --- a/utils/campcaster-import.php +++ b/utils/campcaster-import.php @@ -12,8 +12,8 @@ set_time_limit(0); error_reporting(E_ALL); set_error_handler("camp_import_error_handler", E_ALL & !E_NOTICE); -require_once(dirname(__FILE__)."/../conf.php"); -require_once(dirname(__FILE__)."/../backend/GreenBox.php"); +require_once(dirname(__FILE__)."/../application/configs/conf.php"); +require_once(dirname(__FILE__)."/../application/models/GreenBox.php"); require_once('DB.php'); require_once('Console/Getopt.php'); diff --git a/utils/createDatabase.sh b/utils/createDatabase.sh deleted file mode 100755 index bc58d6a65..000000000 --- a/utils/createDatabase.sh +++ /dev/null @@ -1,211 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# To report bugs, send an e-mail to bugs@campware.org -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -# This script creates the database used by Campcaster -# -# Invoke as: -# ./bin/createDatabase.sh -# -# To get usage help, try the -h option -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Determine directories, files -#------------------------------------------------------------------------------- -reldir=`dirname $0`/.. -basedir=`cd $reldir; pwd;` -bindir=$basedir/bin -etcdir=$basedir/etc -docdir=$basedir/doc -tmpdir=$basedir/tmp -usrdir=$basedir/usr - - -#------------------------------------------------------------------------------- -# Print the usage information for this script. -#------------------------------------------------------------------------------- -printUsage() -{ - echo "Campcaster scheduler database creation script."; - echo "parameters"; - echo ""; - echo " -D, --database The name of the Campcaster database."; - echo " [default: Campcaster]"; - echo " -s, --dbserver The name of the database server host."; - echo " [default: localhost]"; - echo " -u, --dbuser The name of the database user to access the" - echo " database. [default: campcaster]"; - echo " -w, --dbpassword The database user password."; - echo " [default: campcaster]"; - echo " -h, --help Print this message and exit."; - echo ""; -} - - -#------------------------------------------------------------------------------- -# Process command line parameters -#------------------------------------------------------------------------------- -CMD=${0##*/} - -opts=$(getopt -o D:hs:u:w: -l database:,dbserver:,dbuser:,dbpassword:,help, -n $CMD -- "$@") || exit 1 -eval set -- "$opts" -while true; do - case "$1" in - -D|--database) - database=$2; - shift; shift;; - -h|--help) - printUsage; - exit 0;; - -s|--dbserver) - dbserver=$2; - shift; shift;; - -u|--dbuser) - dbuser=$2; - shift; shift;; - -w|--dbpassword) - dbpassword=$2; - shift; shift;; - --) - shift; - break;; - *) - echo "Unrecognized option $1."; - printUsage; - exit 1; - esac -done - -if [ "x$dbserver" == "x" ]; then - dbserver=localhost; -fi - -if [ "x$database" == "x" ]; then - database=Campcaster; -fi - -if [ "x$dbuser" == "x" ]; then - dbuser=campcaster; -fi - -if [ "x$dbpassword" == "x" ]; then - dbpassword=campcaster; -fi - -echo "Creating database for Campcaster scheduler."; -echo ""; -echo "Using the following parameters:"; -echo ""; -echo " database server: $dbserver"; -echo " database: $database"; -echo " database user: $dbuser"; -echo " database user password: $dbpassword"; -echo "" - -#------------------------------------------------------------------------------- -# The details of installation -#------------------------------------------------------------------------------- -ls_dbserver=$dbserver -ls_dbuser=$dbuser -ls_dbpassword=$dbpassword -ls_database=$database - - -postgres_user=postgres - -#------------------------------------------------------------------------------- -# Function to check for the existence of an executable on the PATH -# -# @param $1 the name of the exectuable -# @return 0 if the executable exists on the PATH, non-0 otherwise -#------------------------------------------------------------------------------- -check_exe() { - if [ -x "`which $1 2> /dev/null`" ]; then - echo "Executable $1 found..."; - return 0; - else - echo "Executable $1 not found..."; - return 1; - fi -} - - -#------------------------------------------------------------------------------- -# Check to see if this script is being run as root -#------------------------------------------------------------------------------- -if [ `whoami` != "root" ]; then - echo "Please run this script as root."; - exit ; -fi - - -#------------------------------------------------------------------------------- -# Check for required tools -#------------------------------------------------------------------------------- -echo "Checking for required tools..." - -check_exe "su" || exit 1; -check_exe "psql" || exit 1; - - -#------------------------------------------------------------------------------- -# Create the necessary database user and database itself -#------------------------------------------------------------------------------- -echo "Creating database and database user..."; - -# FIXME: the below might not work for remote databases - -if [ "x$ls_dbserver" == "xlocalhost" ]; then - su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \ - ENCRYPTED PASSWORD '$ls_dbpassword' \ - CREATEDB NOCREATEUSER;\" \ - | psql template1" \ - || echo "Couldn't create database user $ls_dbuser."; - - su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \ - OWNER $ls_dbuser ENCODING 'utf-8';\" \ - | psql template1" \ - || echo "Couldn't create database $ls_database."; -else - echo "Unable to automatically create database user and table for"; - echo "remote database $ls_dbserver."; - echo "Make sure to create database user $ls_dbuser with password"; - echo "$ls_dbpassword on database server at $ls_dbserver."; - echo "Also create a database called $ld_database, owned by this user."; - echo ""; - echo "The easiest way to achieve this is by issuing the following SQL"; - echo "commands to PostgreSQL:"; - echo "CREATE USER $ls_dbuser"; - echo " ENCRYPTED PASSWORD '$ls_dbpassword'"; - echo " CREATEDB NOCREATEUSER;"; - echo "CREATE DATABASE \"$ls_database\""; - echo " OWNER $ls_dbuser ENCODING 'utf-8';"; -fi - - -# TODO: check for the success of these operations somehow -#------------------------------------------------------------------------------- -# Say goodbye -#------------------------------------------------------------------------------- -echo "Done." - diff --git a/utils/dumpDbSchema.php b/utils/dumpDbSchema.php deleted file mode 100644 index 2ca11f4be..000000000 --- a/utils/dumpDbSchema.php +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/utils/dumpDbSchema.sh b/utils/dumpDbSchema.sh deleted file mode 100755 index a3b3b624d..000000000 --- a/utils/dumpDbSchema.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- -# This script dumps the schema of the Campcaster database. -# -# To get usage help, try the -h option -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Determine directories, files -#------------------------------------------------------------------------------- - -reldir=`dirname $0`/.. -phpdir=ls_storageAdmin_phppart_dir -if [ "$phpdir" == "ls_storageAdmin_phppart_dir" ] -then - phpdir=`cd $reldir/var; pwd` -fi -filelistpathname=. - -#------------------------------------------------------------------------------- -# Print the usage information for this script. -#------------------------------------------------------------------------------- -printUsage() -{ - echo "This script dumps the schema of the Campcaster database."; - echo "parameters:"; - echo ""; - echo " -h, --help Print this message and exit."; - echo ""; -} - -#------------------------------------------------------------------------------- -# Process command line parameters -#------------------------------------------------------------------------------- -CMD=${0##*/} - -opts=$(getopt -o h -l help -n $CMD -- "$@") || exit 1 -eval set -- "$opts" -while true; do - case "$1" in - -h|--help) - printUsage; - exit 0;; - --) - shift; - break;; - *) - echo "Unrecognized option $1."; - printUsage; - exit 1; - esac -done - -#------------------------------------------------------------------------------- -# Do the schema dump -#------------------------------------------------------------------------------- - -cd $phpdir -php -q dumpDbSchema.php - -#------------------------------------------------------------------------------- -# Say goodbye -#------------------------------------------------------------------------------- -echo "-- End of dump." diff --git a/utils/getStorPath.php b/utils/getStorPath.php deleted file mode 100644 index 1f8cd5252..000000000 --- a/utils/getStorPath.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/utils/getUrl.sh b/utils/getUrl.sh deleted file mode 100755 index f59445521..000000000 --- a/utils/getUrl.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# To report bugs, send an e-mail to bugs@campware.org -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# This script grabs string at suplied URL -#------------------------------------------------------------------------------- - -URL=$1 -RES=`curl -sf ${URL}` || \ - { - ERN=$?; - if [ $ERN -eq 22 ] ; then - echo "ERROR: curl: 22 - wrong URL ($URL)"; - else - echo "ERROR: $ERN - unknown"; - fi; - exit $ERN; - } -echo $RES diff --git a/utils/renderer.sh b/utils/renderer.sh deleted file mode 100755 index d1d7f9cce..000000000 --- a/utils/renderer.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# To report bugs, send an e-mail to bugs@campware.org -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -# Playlist-to-file renderer caller. DUMMY VERSION. -# -# To get usage help, try the -h option -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Determine directories, files -#------------------------------------------------------------------------------- - -reldir=`dirname $0`/.. - -#------------------------------------------------------------------------------- -# Print the usage information for this script. -#------------------------------------------------------------------------------- -printUsage() -{ - echo "Playlist-to-file renderer caller. DUMMY VERSION."; - echo "parameters:"; - echo ""; - echo " -p, --playlist URL of SMIL playlist to be rendered."; - echo " -s, --statusfile Status file name."; - echo " -o, --output File name where the output will be written."; - echo " -h, --help Print this message and exit."; - echo ""; -} - -#------------------------------------------------------------------------------- -# Process command line parameters -#------------------------------------------------------------------------------- -CMD=${0##*/} - -opts=$(getopt -o hp:s:o: -l help,playlist:,statusfile:,output: -n $CMD -- "$@") || exit 1 -eval set -- "$opts" -while true; do - case "$1" in - -h|--help) - printUsage; - exit 0;; - -p|--playlist) - playlist=$2 - shift; shift;; - -s|--statusfile) - statusfile=$2 - shift; shift;; - -o|--output) - output=$2 - shift; shift;; - --) - shift; - break;; - *) - echo "Unrecognized option $1."; - printUsage; - exit 1; - esac -done - -if [ "x$playlist" == "x" ]; then - echo "Error in playlist parameter"; - printUsage; - exit 1; -fi -if [ "x$statusfile" == "x" ]; then - echo "Error in statusfile parameter"; - printUsage; - exit 1; -fi -if [ "x$output" == "x" ]; then - echo "Error in output parameter"; - printUsage; - exit 1; -fi - -#------------------------------------------------------------------------------- -# Do it -#------------------------------------------------------------------------------- -echo "renderer.sh: rendering $playlist to $output" -echo "working" > $statusfile; -touch $output || { echo "fail" > $statusfile; exit 1; } -#sleep 4 -#sleep 2 -echo -e "$playlist\n$output" >> $output || { echo "fail" > $statusfile; exit 1; } - -echo "success" > $statusfile - -#------------------------------------------------------------------------------- -# Say goodbye -#------------------------------------------------------------------------------- -echo "done" -exit 0 diff --git a/utils/restore.php b/utils/restore.php index cb2b266bb..c83c1be21 100644 --- a/utils/restore.php +++ b/utils/restore.php @@ -7,9 +7,9 @@ header("Content-type: text/plain"); require_once 'DB.php'; require_once "XML/Util.php"; require_once "XML/Beautifier.php"; -require_once dirname(__FILE__)."/../conf.php"; -require_once dirname(__FILE__)."/../backend/BasicStor.php"; -require_once dirname(__FILE__)."/../backend/Prefs.php"; +require_once dirname(__FILE__)."/../application/configs/conf.php"; +require_once dirname(__FILE__)."/../application/models/BasicStor.php"; +require_once dirname(__FILE__)."/../application/models/Prefs.php"; /* =========================================================== misc functions */ function ls_restore_processObject($el) diff --git a/utils/restore2.php b/utils/restore2.php index ef12224ae..a1bf4f38f 100755 --- a/utils/restore2.php +++ b/utils/restore2.php @@ -12,9 +12,9 @@ * */ - require_once(dirname(__FILE__).'/../conf.php'); - require_once(dirname(__FILE__).'/../backend/GreenBox.php'); - require_once(dirname(__FILE__).'/../backend/Restore.php'); + require_once(dirname(__FILE__).'/../application/configs/conf.php'); + require_once(dirname(__FILE__).'/../application/models/GreenBox.php'); + require_once(dirname(__FILE__).'/../application/models/Restore.php'); include_once('DB.php'); PEAR::setErrorHandling(PEAR_ERROR_RETURN); diff --git a/utils/setupDirs.sh b/utils/setupDirs.sh deleted file mode 100755 index 2b7d1e3c8..000000000 --- a/utils/setupDirs.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Campcaster project. -# http://campcaster.sourcefabric.org/ -# -# Campcaster is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Campcaster is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Campcaster; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# This script does httpd writeable directories setup -#------------------------------------------------------------------------------- - -WWW_ROOT=`cd var/install; php -q getWwwRoot.php` || exit $? -echo " *** StorageServer bin/setupDirs.sh BEGIN" -echo " * Root URL: $WWW_ROOT" -PHP_PWD_COMMAND=`bin/getUrl.sh $WWW_ROOT/install/getPwd.php` || \ - { - errno=$? - if [ $errno -eq 22 ] - then - echo "root URL is not accessible - configure HTTP entry point, please" - fi - exit $errno - } - -PHP_PWD=$PHP_PWD_COMMAND -# MOD_PHP may not be working, this command will tell us -if [ ${PHP_PWD_COMMAND:0:5} == ' Probably wrong setting in var/conf.php: URL configuration"; - exit $ERN; - } -echo " ** The system group that is running the http daemon: '$HTTP_GROUP'" - -for i in $* -do - echo " * chown :$HTTP_GROUP $i" - if [ -G $i ]; then - chown :$HTTP_GROUP $i || \ - { - ERN=$?; - echo "ERROR: chown :$HTTP_GROUP $i -> You should have permissions to set group owner to group '$HTTP_GROUP'"; - exit $ERN; - } - echo " * chmod g+sw $i" - chmod g+sw $i || exit $? - fi -done - -echo " *** StorageServer bin/setupDirs.sh END" -exit 0
    $methodParamName