CC-1927 Remove PEAR DB
* Removed all traces of PEAR functions. * Fixed AirtimeInstall::GetVersionInstalled() to return the correct answer even when it cant connect to the database. Also fixed return value to be consistent on failure. * Fixed phone_home_stat.php and soundcloud-uploader.php
This commit is contained in:
parent
c0da27b445
commit
96b010e7f0
|
@ -123,7 +123,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
||||||
{
|
{
|
||||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||||
if ( $media != null && !PEAR::isError($media))
|
if ( $media != null )
|
||||||
{
|
{
|
||||||
$filepath = $media->getFilePath();
|
$filepath = $media->getFilePath();
|
||||||
if(is_file($filepath)){
|
if(is_file($filepath)){
|
||||||
|
@ -164,13 +164,13 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the requested portion of a file and sends its contents to the client with the appropriate headers.
|
* Reads the requested portion of a file and sends its contents to the client with the appropriate headers.
|
||||||
*
|
*
|
||||||
* This HTTP_RANGE compatible read file function is necessary for allowing streaming media to be skipped around in.
|
* This HTTP_RANGE compatible read file function is necessary for allowing streaming media to be skipped around in.
|
||||||
*
|
*
|
||||||
* @param string $location
|
* @param string $location
|
||||||
* @param string $mimeType
|
* @param string $mimeType
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @link https://groups.google.com/d/msg/jplayer/nSM2UmnSKKA/Hu76jDZS4xcJ
|
* @link https://groups.google.com/d/msg/jplayer/nSM2UmnSKKA/Hu76jDZS4xcJ
|
||||||
* @link http://php.net/manual/en/function.readfile.php#86244
|
* @link http://php.net/manual/en/function.readfile.php#86244
|
||||||
*/
|
*/
|
||||||
|
@ -178,17 +178,17 @@ class ApiController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$size= filesize($location);
|
$size= filesize($location);
|
||||||
$time= date('r', filemtime($location));
|
$time= date('r', filemtime($location));
|
||||||
|
|
||||||
$fm = @fopen($location, 'rb');
|
$fm = @fopen($location, 'rb');
|
||||||
if (!$fm)
|
if (!$fm)
|
||||||
{
|
{
|
||||||
header ("HTTP/1.1 505 Internal server error");
|
header ("HTTP/1.1 505 Internal server error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$begin= 0;
|
$begin= 0;
|
||||||
$end= $size - 1;
|
$end= $size - 1;
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_RANGE']))
|
if (isset($_SERVER['HTTP_RANGE']))
|
||||||
{
|
{
|
||||||
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
|
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
|
||||||
|
@ -200,7 +200,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_RANGE']))
|
if (isset($_SERVER['HTTP_RANGE']))
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 206 Partial Content');
|
header('HTTP/1.1 206 Partial Content');
|
||||||
|
@ -209,9 +209,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
header('HTTP/1.1 200 OK');
|
header('HTTP/1.1 200 OK');
|
||||||
}
|
}
|
||||||
header("Content-Type: $mimeType");
|
header("Content-Type: $mimeType");
|
||||||
header('Cache-Control: public, must-revalidate, max-age=0');
|
header('Cache-Control: public, must-revalidate, max-age=0');
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header('Accept-Ranges: bytes');
|
header('Accept-Ranges: bytes');
|
||||||
header('Content-Length:' . (($end - $begin) + 1));
|
header('Content-Length:' . (($end - $begin) + 1));
|
||||||
if (isset($_SERVER['HTTP_RANGE']))
|
if (isset($_SERVER['HTTP_RANGE']))
|
||||||
|
@ -225,7 +225,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
//keep looping until all have been disabled!!!
|
//keep looping until all have been disabled!!!
|
||||||
//http://www.php.net/manual/en/function.ob-end-flush.php
|
//http://www.php.net/manual/en/function.ob-end-flush.php
|
||||||
while (@ob_end_flush());
|
while (@ob_end_flush());
|
||||||
|
|
||||||
$cur = $begin;
|
$cur = $begin;
|
||||||
fseek($fm, $begin, 0);
|
fseek($fm, $begin, 0);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$cur += 1024 * 16;
|
$cur += 1024 * 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the currently playing show as well as upcoming shows.
|
* Retrieve the currently playing show as well as upcoming shows.
|
||||||
* Number of shows returned and the time interval in which to
|
* Number of shows returned and the time interval in which to
|
||||||
|
@ -342,8 +342,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
|
||||||
|
|
||||||
$data = Application_Model_Schedule::GetScheduledPlaylists();
|
$data = Application_Model_Schedule::GetScheduledPlaylists();
|
||||||
echo json_encode($data, JSON_FORCE_OBJECT);
|
echo json_encode($data, JSON_FORCE_OBJECT);
|
||||||
}
|
}
|
||||||
|
@ -368,12 +366,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$schedule_group_id = $this->_getParam("schedule_id");
|
$schedule_group_id = $this->_getParam("schedule_id");
|
||||||
$media_id = $this->_getParam("media_id");
|
$media_id = $this->_getParam("media_id");
|
||||||
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
||||||
|
echo json_encode(array("status"=>1, "message"=>""));
|
||||||
if (!PEAR::isError($result)) {
|
|
||||||
echo json_encode(array("status"=>1, "message"=>""));
|
|
||||||
} else {
|
|
||||||
echo json_encode(array("status"=>0, "message"=>"DB Error:".$result->getMessage()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function recordedShowsAction()
|
public function recordedShowsAction()
|
||||||
|
@ -429,7 +422,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||||
|
|
||||||
if (!is_null($result)){
|
if (!is_null($result)){
|
||||||
die('{"jsonrpc" : "2.0", "error" : {"code": '.$result[code].', "message" : "'.$result[message].'"}}');
|
die('{"jsonrpc" : "2.0", "error" : {"code": '.$result[code].', "message" : "'.$result[message].'"}}');
|
||||||
}
|
}
|
||||||
|
@ -780,7 +773,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
print 'You are not allowed to access this resource.';
|
print 'You are not allowed to access this resource.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = Application_Model_StreamSetting::getStreamSetting();
|
$info = Application_Model_StreamSetting::getStreamSetting();
|
||||||
$this->view->msg = $info;
|
$this->view->msg = $info;
|
||||||
}
|
}
|
||||||
|
@ -836,7 +829,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
|
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateSourceStatusAction(){
|
public function updateSourceStatusAction(){
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
@ -945,13 +938,13 @@ class ApiController extends Zend_Controller_Action
|
||||||
$dir = base64_decode($request->getParam('dir'));
|
$dir = base64_decode($request->getParam('dir'));
|
||||||
Application_Model_MusicDir::removeWatchedDir($dir, false);
|
Application_Model_MusicDir::removeWatchedDir($dir, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This action is for use by our dev scripts, that make
|
/* This action is for use by our dev scripts, that make
|
||||||
* a change to the database and we want rabbitmq to send
|
* a change to the database and we want rabbitmq to send
|
||||||
* out a message to pypo that a potential change has been made. */
|
* out a message to pypo that a potential change has been made. */
|
||||||
public function rabbitmqDoPushAction(){
|
public function rabbitmqDoPushAction(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
||||||
|
@ -962,10 +955,10 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
Logging::log("Notifying RabbitMQ to send message to pypo");
|
Logging::log("Notifying RabbitMQ to send message to pypo");
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBootstrapInfoAction(){
|
public function getBootstrapInfoAction(){
|
||||||
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
||||||
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
||||||
|
@ -977,14 +970,14 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->view->stream_label = Application_Model_Preference::GetStreamLabelFormat();
|
$this->view->stream_label = Application_Model_Preference::GetStreamLabelFormat();
|
||||||
$this->view->transition_fade = Application_Model_Preference::GetDefaultTransitionFade();
|
$this->view->transition_fade = Application_Model_Preference::GetDefaultTransitionFade();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used but Liquidsoap to check authentication of live streams*/
|
/* This is used but Liquidsoap to check authentication of live streams*/
|
||||||
public function checkLiveStreamAuthAction(){
|
public function checkLiveStreamAuthAction(){
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$api_key = $request->getParam('api_key');
|
$api_key = $request->getParam('api_key');
|
||||||
|
|
||||||
$username = $request->getParam('username');
|
$username = $request->getParam('username');
|
||||||
$password = $request->getParam('password');
|
$password = $request->getParam('password');
|
||||||
$djtype = $request->getParam('djtype');
|
$djtype = $request->getParam('djtype');
|
||||||
|
@ -996,7 +989,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
print 'You are not allowed to access this resource.';
|
print 'You are not allowed to access this resource.';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($djtype == 'master'){
|
if($djtype == 'master'){
|
||||||
//check against master
|
//check against master
|
||||||
if($username == Application_Model_Preference::GetLiveSteamMasterUsername() && $password == Application_Model_Preference::GetLiveSteamMasterPassword()){
|
if($username == Application_Model_Preference::GetLiveSteamMasterUsername() && $password == Application_Model_Preference::GetLiveSteamMasterPassword()){
|
||||||
|
@ -1011,15 +1004,15 @@ class ApiController extends Zend_Controller_Action
|
||||||
if(isset($showInfo[0]['id'])){
|
if(isset($showInfo[0]['id'])){
|
||||||
$current_show_id = $showInfo[0]['id'];
|
$current_show_id = $showInfo[0]['id'];
|
||||||
$CcShow = CcShowQuery::create()->findPK($current_show_id);
|
$CcShow = CcShowQuery::create()->findPK($current_show_id);
|
||||||
|
|
||||||
// get custom pass info from the show
|
// get custom pass info from the show
|
||||||
$custom_user = $CcShow->getDbLiveStreamUser();
|
$custom_user = $CcShow->getDbLiveStreamUser();
|
||||||
$custom_pass = $CcShow->getDbLiveStreamPass();
|
$custom_pass = $CcShow->getDbLiveStreamPass();
|
||||||
|
|
||||||
// get hosts ids
|
// get hosts ids
|
||||||
$show = new Application_Model_Show($current_show_id);
|
$show = new Application_Model_Show($current_show_id);
|
||||||
$hosts_ids = $show->getHostsIds();
|
$hosts_ids = $show->getHostsIds();
|
||||||
|
|
||||||
// check against hosts auth
|
// check against hosts auth
|
||||||
if($CcShow->getDbLiveStreamUsingAirtimeAuth()){
|
if($CcShow->getDbLiveStreamUsingAirtimeAuth()){
|
||||||
foreach( $hosts_ids as $host){
|
foreach( $hosts_ids as $host){
|
||||||
|
|
|
@ -822,9 +822,6 @@ Logging::log("getting media! - 2");
|
||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
if ($duplicate) {
|
if ($duplicate) {
|
||||||
if (PEAR::isError($duplicate)) {
|
|
||||||
$result = array("code" => 105, "message" => $duplicate->getMessage());
|
|
||||||
}
|
|
||||||
if (file_exists($duplicate->getFilePath())) {
|
if (file_exists($duplicate->getFilePath())) {
|
||||||
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
|
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
|
||||||
$result = array( "code" => 106, "message" => "An identical audioclip named '$duplicateName' already exists on the server.");
|
$result = array( "code" => 106, "message" => "An identical audioclip named '$duplicateName' already exists on the server.");
|
||||||
|
|
|
@ -3,7 +3,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . $path);
|
||||||
$WHITE_SCREEN_OF_DEATH = false;
|
$WHITE_SCREEN_OF_DEATH = false;
|
||||||
|
|
||||||
require_once(dirname(__FILE__).'/../../configs/conf.php');
|
require_once(dirname(__FILE__).'/../../configs/conf.php');
|
||||||
require_once('DB.php');
|
|
||||||
require_once('PHPUnit.php');
|
require_once('PHPUnit.php');
|
||||||
require_once 'StoredFileTests.php';
|
require_once 'StoredFileTests.php';
|
||||||
require_once 'SchedulerTests.php';
|
require_once 'SchedulerTests.php';
|
||||||
|
|
|
@ -46,9 +46,6 @@ class SchedulerTests extends PHPUnit_TestCase {
|
||||||
function testAddAndRemoveAudioFile() {
|
function testAddAndRemoveAudioFile() {
|
||||||
$i = new Application_Model_ScheduleGroup();
|
$i = new Application_Model_ScheduleGroup();
|
||||||
$this->groupIdCreated = $i->add('2010-10-10 01:30:23', $this->storedFile->getId());
|
$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 Application_Model_ScheduleGroup($this->groupIdCreated);
|
$i = new Application_Model_ScheduleGroup($this->groupIdCreated);
|
||||||
$result = $i->remove();
|
$result = $i->remove();
|
||||||
|
@ -67,9 +64,6 @@ class SchedulerTests extends PHPUnit_TestCase {
|
||||||
|
|
||||||
$i = new Application_Model_ScheduleGroup();
|
$i = new Application_Model_ScheduleGroup();
|
||||||
$this->groupIdCreated = $i->add('2010-11-11 01:30:23', null, $playlist->getId());
|
$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 Application_Model_ScheduleGroup($this->groupIdCreated);
|
$group = new Application_Model_ScheduleGroup($this->groupIdCreated);
|
||||||
if ($group->count() != 3) {
|
if ($group->count() != 3) {
|
||||||
$this->fail("Wrong number of items added.");
|
$this->fail("Wrong number of items added.");
|
||||||
|
@ -90,10 +84,6 @@ class SchedulerTests extends PHPUnit_TestCase {
|
||||||
function testIsScheduleEmptyInRange() {
|
function testIsScheduleEmptyInRange() {
|
||||||
$i = new Application_Model_ScheduleGroup();
|
$i = new Application_Model_ScheduleGroup();
|
||||||
$this->groupIdCreated = $i->add('2011-10-10 01:30:23', $this->storedFile->getId());
|
$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 (Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
|
if (Application_Model_Schedule::isScheduleEmptyInRange('2011-10-10 01:30:23', '00:00:12.555')) {
|
||||||
$this->fail("Reporting empty schedule when it isnt.");
|
$this->fail("Reporting empty schedule when it isnt.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(dirname(__FILE__).'/../StoredFile.php');
|
require_once(dirname(__FILE__).'/../StoredFile.php');
|
||||||
|
|
||||||
$dsn = $CC_CONFIG['dsn'];
|
|
||||||
$CC_DBC = DB::connect($dsn, FALSE);
|
|
||||||
if (PEAR::isError($CC_DBC)) {
|
|
||||||
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
class StoredFileTest extends PHPUnit_TestCase {
|
class StoredFileTest extends PHPUnit_TestCase {
|
||||||
|
|
||||||
function __construct($name) {
|
function __construct($name) {
|
||||||
|
@ -21,10 +13,6 @@ class StoredFileTest extends PHPUnit_TestCase {
|
||||||
function testGetAudioMetadata() {
|
function testGetAudioMetadata() {
|
||||||
$filePath = dirname(__FILE__)."/ex1.mp3";
|
$filePath = dirname(__FILE__)."/ex1.mp3";
|
||||||
$metadata = Metadata::LoadFromFile($filePath);
|
$metadata = Metadata::LoadFromFile($filePath);
|
||||||
if (PEAR::isError($metadata)) {
|
|
||||||
$this->fail($metadata->getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (($metadata["dc:description"] != "Tmu sem tam videla ...")
|
if (($metadata["dc:description"] != "Tmu sem tam videla ...")
|
||||||
|| ($metadata["audio"]["dataformat"] != "mp3")
|
|| ($metadata["audio"]["dataformat"] != "mp3")
|
||||||
|| ($metadata["dc:type"] != "Speech")) {
|
|| ($metadata["dc:type"] != "Speech")) {
|
||||||
|
@ -52,10 +40,6 @@ class StoredFileTest extends PHPUnit_TestCase {
|
||||||
$values = array("filepath" => $filePath,
|
$values = array("filepath" => $filePath,
|
||||||
"dc:description" => "Unit test ".time());
|
"dc:description" => "Unit test ".time());
|
||||||
$storedFile = Application_Model_StoredFile::Insert($values, false);
|
$storedFile = Application_Model_StoredFile::Insert($values, false);
|
||||||
if (PEAR::isError($storedFile)) {
|
|
||||||
$this->fail("Failed to create StoredFile: ".$storedFile->getMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//var_dump($storedFile);
|
//var_dump($storedFile);
|
||||||
$id = $storedFile->getId();
|
$id = $storedFile->getId();
|
||||||
if (!is_numeric($id)) {
|
if (!is_numeric($id)) {
|
||||||
|
|
|
@ -38,10 +38,20 @@ class AirtimeInstall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the version of Airtime currently installed.
|
||||||
|
* If not installed, return null.
|
||||||
|
*
|
||||||
|
* @return NULL|string
|
||||||
|
*/
|
||||||
public static function GetVersionInstalled()
|
public static function GetVersionInstalled()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
try {
|
||||||
|
$con = Propel::getConnection();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists('/etc/airtime/airtime.conf')) {
|
if (file_exists('/etc/airtime/airtime.conf')) {
|
||||||
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
$values = parse_ini_file('/etc/airtime/airtime.conf', true);
|
||||||
|
@ -66,7 +76,7 @@ class AirtimeInstall
|
||||||
//echo "Airtime Version: ".$version." ".PHP_EOL;
|
//echo "Airtime Version: ".$version." ".PHP_EOL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$version = false;
|
$version = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ $version = AirtimeInstall::GetVersionInstalled();
|
||||||
// The current version is already installed.
|
// The current version is already installed.
|
||||||
echo "* Checking for existing Airtime installation...".PHP_EOL;
|
echo "* Checking for existing Airtime installation...".PHP_EOL;
|
||||||
if (isset($version)){
|
if (isset($version)){
|
||||||
if ($version === false){
|
if (is_null($version)){
|
||||||
//version of Airtime older than 1.7.0 detected
|
//version of Airtime older than 1.7.0 detected
|
||||||
exit(3);
|
exit(3);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,7 +15,6 @@ set_include_path(APPLICATION_PATH . get_include_path() . PATH_SEPARATOR . '/cont
|
||||||
|
|
||||||
|
|
||||||
require_once APPLICATION_PATH.'/configs/conf.php';
|
require_once APPLICATION_PATH.'/configs/conf.php';
|
||||||
require_once 'DB.php';
|
|
||||||
require_once(APPLICATION_PATH.'/../library/propel/runtime/lib/Propel.php');
|
require_once(APPLICATION_PATH.'/../library/propel/runtime/lib/Propel.php');
|
||||||
|
|
||||||
require_once 'Soundcloud.php';
|
require_once 'Soundcloud.php';
|
||||||
|
@ -31,17 +30,6 @@ require_once 'Preference.php';
|
||||||
// Initialize Propel with the runtime configuration
|
// Initialize Propel with the runtime configuration
|
||||||
Propel::init(__DIR__."/../../../application/configs/airtime-conf.php");
|
Propel::init(__DIR__."/../../../application/configs/airtime-conf.php");
|
||||||
|
|
||||||
|
|
||||||
$dsn = $CC_CONFIG['dsn'];
|
|
||||||
|
|
||||||
$CC_DBC = DB::connect($dsn, FALSE);
|
|
||||||
if (PEAR::isError($CC_DBC)) {
|
|
||||||
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
|
|
||||||
$playlistName = "pypo_playlist_test";
|
$playlistName = "pypo_playlist_test";
|
||||||
$secondsFromNow = 30;
|
$secondsFromNow = 30;
|
||||||
|
|
||||||
|
@ -70,10 +58,6 @@ if (is_null($mediaFile)) {
|
||||||
echo "Adding test audio clip to the database.\n";
|
echo "Adding test audio clip to the database.\n";
|
||||||
$v = array("filepath" => __DIR__."/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
|
$v = array("filepath" => __DIR__."/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
|
||||||
$mediaFile = Application_Model_StoredFile::Insert($v);
|
$mediaFile = Application_Model_StoredFile::Insert($v);
|
||||||
if (PEAR::isError($mediaFile)) {
|
|
||||||
var_dump($mediaFile);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$pl->addAudioClip($mediaFile->getId());
|
$pl->addAudioClip($mediaFile->getId());
|
||||||
echo "done.\n";
|
echo "done.\n";
|
||||||
|
|
|
@ -29,6 +29,12 @@ require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
||||||
|
|
||||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
|
||||||
|
// Ensure library/ is on include_path
|
||||||
|
set_include_path(implode(PATH_SEPARATOR, array(
|
||||||
|
get_include_path(),
|
||||||
|
realpath($CC_CONFIG['phpDir'] . '/library')
|
||||||
|
)));
|
||||||
|
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
|
||||||
|
@ -38,50 +44,39 @@ require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php');
|
||||||
|
|
||||||
require_once('DB.php');
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php");
|
||||||
if (PEAR::isError($CC_DBC)) {
|
|
||||||
/*echo $CC_DBC->getMessage().PHP_EOL;
|
|
||||||
echo $CC_DBC->getUserInfo().PHP_EOL;
|
|
||||||
echo "Database connection problem.".PHP_EOL;
|
|
||||||
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
|
||||||
" with corresponding permissions.".PHP_EOL;*/
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
//echo "* Connected to database".PHP_EOL;
|
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
||||||
$infoArray = Application_Model_Preference::GetSystemInfo(true);
|
$infoArray = Application_Model_Preference::GetSystemInfo(true);
|
||||||
|
|
||||||
$url = 'http://stat.sourcefabric.org/index.php?p=airtime';
|
$url = 'http://stat.sourcefabric.org/index.php?p=airtime';
|
||||||
//$url = 'http://stat-dev.sourcefabric.org/index.php?p=airtime';
|
//$url = 'http://stat-dev.sourcefabric.org/index.php?p=airtime';
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
|
||||||
$data = json_encode($infoArray);
|
$data = json_encode($infoArray);
|
||||||
|
|
||||||
$dataArray = array("data" => $data );
|
$dataArray = array("data" => $data );
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get latest version from stat server and store to db
|
// Get latest version from stat server and store to db
|
||||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
$url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
|
$url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
|
|
||||||
if(curl_errno($ch)) {
|
if(curl_errno($ch)) {
|
||||||
echo "curl error: " . curl_error($ch) . "\n";
|
echo "curl error: " . curl_error($ch) . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,7 +84,7 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||||
Application_Model_Preference::SetLatestVersion($resultArray[0]);
|
Application_Model_Preference::SetLatestVersion($resultArray[0]);
|
||||||
Application_Model_Preference::SetLatestLink($resultArray[1]);
|
Application_Model_Preference::SetLatestLink($resultArray[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,12 @@ require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
|
||||||
|
|
||||||
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
|
||||||
|
|
||||||
|
// Ensure library/ is on include_path
|
||||||
|
set_include_path(implode(PATH_SEPARATOR, array(
|
||||||
|
get_include_path(),
|
||||||
|
realpath($CC_CONFIG['phpDir'] . '/library')
|
||||||
|
)));
|
||||||
|
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
||||||
require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php');
|
require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php');
|
||||||
|
@ -35,21 +41,8 @@ set_include_path($CC_CONFIG['phpDir']."/application/models" . PATH_SEPARATOR . g
|
||||||
require_once($CC_CONFIG['phpDir']."/library/propel/runtime/lib/Propel.php");
|
require_once($CC_CONFIG['phpDir']."/library/propel/runtime/lib/Propel.php");
|
||||||
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf.php");
|
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf.php");
|
||||||
|
|
||||||
require_once('DB.php');
|
require_once 'propel/runtime/lib/Propel.php';
|
||||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php");
|
||||||
if (PEAR::isError($CC_DBC)) {
|
|
||||||
/*echo $CC_DBC->getMessage().PHP_EOL;
|
|
||||||
echo $CC_DBC->getUserInfo().PHP_EOL;
|
|
||||||
echo "Database connection problem.".PHP_EOL;
|
|
||||||
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
|
||||||
" with corresponding permissions.".PHP_EOL;*/
|
|
||||||
if ($p_exitOnError) {
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//echo "* Connected to database".PHP_EOL;
|
|
||||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($argv) != 2){
|
if(count($argv) != 2){
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Reference in New Issue