Merge branch 'master' into feature/vagrant-install

This commit is contained in:
Lucas Bickel 2017-03-10 09:38:36 +01:00
commit 7b3275b449
23 changed files with 123 additions and 163 deletions

View file

@ -1,31 +1,30 @@
<?php
define('PRODUCT_NAME' , 'Airtime');
define('PRODUCT_SITE_URL' , 'http://airtime.sourcefabric.org');
define('PRODUCT_NAME' , 'LibreTime');
define('PRODUCT_SITE_URL' , 'http://libretime.org');
define('SAAS_PRODUCT_BRANDING_NAME', 'Airtime Pro');
define('SAAS_LOGIN_REFERRER', 'https://www.airtime.pro/');
define('SAAS_PRODUCT_BRANDING_NAME', 'LibreTime');
define('SAAS_LOGIN_REFERRER', 'http://libretime.org');
define('COMPANY_NAME' , 'Sourcefabric');
define('COMPANY_SUFFIX' , 'z.ú.');
define('COMPANY_SITE' , 'Sourcefabric.org');
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
define('SUPPORT_EMAIL_ADDRESS', "help@sourcefabric.org");
define('COMPANY_NAME' , 'LibreTime Community');
define('COMPANY_SUFFIX' , '');
define('COMPANY_SITE' , 'libretime.org');
define('COMPANY_SITE_URL' , 'http://libretime.org');
define('SUPPORT_ADDRESS' , 'https://github.com/LibreTime/libretime/issues');
define("AIRTIMEPRO_API_URL", "https://account.sourcefabric.com:5001/api/");
define('HELP_URL' , 'http://help.sourcefabric.org/');
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
define('WHOS_USING_URL' , 'http://sourcefabric.org/en/airtime/whosusing');
define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
define('ABOUT_AIRTIME_URL' , 'https://www.airtime.pro/support/');
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/sourcefabric/airtime/');
define('WHMCS_PASSWORD_RESET_URL' , 'https://account.sourcefabric.com/pwreset.php');
define('SUPPORT_TICKET_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/requests/new');
define('FAQ_URL' , 'http://libretime.org/faq/');
define('WHOS_USING_URL' , 'https://github.com/orgs/LibreTime/people');
define('TERMS_AND_CONDITIONS_URL' , 'https://github.com/LibreTime/libretime/blob/master/README.md');
define('PRIVACY_POLICY_URL' , 'https://github.com/LibreTime/code-of-conduct/blob/master/CODE_OF_CONDUCT.md');
define('USER_MANUAL_URL' , 'http://libretime.org/manual/');
define('ABOUT_AIRTIME_URL' , 'http://libretime.org');
define('AIRTIME_TRANSIFEX_URL' , 'http://libretime.org/translating/');
define('SUPPORT_TICKET_URL' , 'https://github.com/LibreTime/libretime/issues');
define('UI_REVAMP_EMBED_URL' , 'https://www.youtube.com/embed/nqpNnCKGluY');
define('UI_REVAMP_YOUTUBE_URL' , 'https://www.youtube.com/watch?v=nqpNnCKGluY&feature=youtu.be');
define('LIBRETIME_WHATS_NEW_URL' , 'https://github.com/LibreTime/libretime/releases');
define('LICENSE_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
@ -106,9 +105,10 @@ define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ');
define('UI_BLOCK_SESSNAME', 'BLOCK');*/
//WHMCS integration
define("LIBRETIME_ENABLE_WHMCS", false);
define("WHMCS_API_URL", "https://account.example.org/includes/api.php");
define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain");
define('LIBRETIME_ENABLE_WHMCS', false);
define('WHMCS_PASSWORD_RESET_URL', 'https://account.example.com/pwreset.php');
define('WHMCS_API_URL' , 'https://account.example.org/includes/api.php');
define('SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME', 'Choose your domain');
//LiveChat integration
define('LIBRETIME_ENABLE_LIVECHAT', false);

View file

@ -88,7 +88,14 @@ $pages[] = array(
'module' => 'default',
'controller' => 'preference',
'action' => 'stream-setting'
)
),
array(
'label' => _('Status'),
'module' => 'default',
'controller' => 'systemstatus',
'action' => 'index',
'resource' => 'systemstatus'
),
)
);
$pages[] = array(
@ -190,7 +197,7 @@ $pages[] = array(
),
array(
'label' => _('What\'s New?'),
'uri' => UI_REVAMP_YOUTUBE_URL,
'uri' => LIBRETIME_WHATS_NEW_URL,
'target' => "_blank"
)
)

View file

@ -0,0 +1,22 @@
<?php
class SystemstatusController extends Zend_Controller_Action
{
private $version;
public function init()
{
$config = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/status/status.js?'.$config['airtime_version'],'text/javascript');
$this->version = $config['airtime_version'];
}
public function indexAction()
{
Zend_Layout::getMvcInstance()->assign('parent_page', 'Settings');
$partitions = Application_Model_Systemstatus::GetDiskInfo();
$this->view->status = new StdClass;
$this->view->status->partitions = $partitions;
$this->view->version = $this->version;
}
}

View file

@ -32,7 +32,7 @@ class Application_Model_Auth
$message = sprintf(_("Hi %s, \n\nPlease click this link to reset your password: "), $user->getDbLogin());
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_EMAIL_ADDRESS);
$message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_ADDRESS);
$message .= sprintf(_pro("\n\nThank you,\nThe %s Team"), SAAS_PRODUCT_BRANDING_NAME);
$str = sprintf(_('%s Password Reset'), SAAS_PRODUCT_BRANDING_NAME);

View file

@ -1,45 +0,0 @@
<?php
class Cache
{
private function createCacheKey($key, $isUserValue, $userId = null) {
$CC_CONFIG = Config::getConfig();
$a = $CC_CONFIG["apiKey"][0];
if ($isUserValue) {
$cacheKey = "{$key}{$userId}{$a}";
}
else {
$cacheKey = "{$key}{$a}";
}
return $cacheKey;
}
public function store($key, $value, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $userId);
//XXX: Disabling APC on SaaS because it turns out we have multiple webservers
// running, which means we have to use a distributed data cache like memcached.
//return apc_store($cacheKey, $value);
return false;
}
public function fetch($key, $isUserValue, $userId = null) {
$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
//XXX: Disabling APC on SaaS because it turns out we have multiple webservers
// running, which means we have to use a distributed data cache like memcached.
//return apc_fetch($cacheKey);
return false;
}
public static function clear()
{
// Disabled on SaaS
// apc_clear_cache('user');
// apc_clear_cache();
}
}

View file

@ -23,7 +23,6 @@ class Application_Model_Preference
*/
private static function setValue($key, $value, $isUserValue = false)
{
$cache = new Cache();
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
//We are using row-level locking in Postgres via "FOR UPDATE" instead of a transaction here
@ -109,8 +108,6 @@ class Application_Model_Preference
Logging::info("Database error: ".$e->getMessage());
exit;
}
$cache->store($key, $value, $isUserValue, $userId);
}
/**
@ -143,8 +140,6 @@ class Application_Model_Preference
*/
private static function getValue($key, $isUserValue = false, $forceDefault = false)
{
$cache = new Cache();
try {
$userId = null;
@ -156,10 +151,6 @@ class Application_Model_Preference
}
}
// If the value is already cached, return it
$res = $cache->fetch($key, $isUserValue, $userId);
if ($res !== false) return $res;
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
." WHERE keystr = :key";
@ -198,7 +189,6 @@ class Application_Model_Preference
$res = ($result !== false) ? $result : "";
}
$cache->store($key, $res, $isUserValue, $userId);
return $res;
}
catch (Exception $e) {

View file

@ -214,27 +214,20 @@ class Application_Model_Systemstatus
public static function GetDiskInfo()
{
$partitions = array();
//connect to DB and find how much total space user has allocated.
$totalSpace = Application_Model_Preference::GetDiskQuota();
$usedSpace = Application_Model_Preference::getDiskUsage();
if (empty($usedSpace)) {
$usedSpace = 0;
/* First lets get all the watched directories. Then we can group them
* into the same partitions by comparing the partition sizes. */
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
$musicDirs[] = Application_Model_MusicDir::getStorDir();
foreach ($musicDirs as $md) {
$totalSpace = disk_total_space($md->getDirectory());
if (!isset($partitions[$totalSpace])) {
$partitions[$totalSpace] = new StdClass;
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
$partitions[$totalSpace]->usedSpace = $totalSpace - $partitions[$totalSpace]->totalFreeSpace;
}
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
}
/* $path = $_SERVER['AIRTIME_BASE']."etc/airtime/num_bytes.ini";
$arr = parse_ini_file($path);
$usedSpace = 0;
if ($arr !== false) {
$usedSpace = $arr['num_bytes'];
} */
$partitions[$totalSpace] = new stdClass();
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
//Logging::info($partitions[$totalSpace]->totalFreeSpace);
return array_values($partitions);
}

View file

@ -187,18 +187,15 @@ abstract class AirtimeUpgrader
* allowing child classes to overwrite _runUpgrade to reduce duplication
*/
public function upgrade() {
Cache::clear();
assert($this->checkIfUpgradeSupported());
try {
// $this->toggleMaintenanceScreen(true);
Cache::clear();
$this->_getDbValues();
$this->_runUpgrade();
Application_Model_Preference::SetSchemaVersion($this->getNewVersion());
Cache::clear();
// $this->toggleMaintenanceScreen(false);
} catch(Exception $e) {
@ -215,7 +212,6 @@ abstract class AirtimeUpgrader
* allowing child classes to overwrite _runDowngrade to reduce duplication
*/
public function downgrade() {
Cache::clear();
try {
$this->_getDbValues();
@ -232,7 +228,6 @@ abstract class AirtimeUpgrader
// Set the schema version to the highest supported version so we don't skip versions when downgrading
Application_Model_Preference::SetSchemaVersion($highestSupportedVersion);
Cache::clear();
} catch(Exception $e) {
return false;
}

View file

@ -3,7 +3,6 @@
</head>
<?php
/* Airtime Pro
$phpDependencies = checkPhpDependencies();
$externalServices = checkExternalServices();
$postgres = $phpDependencies["postgres"];
@ -13,23 +12,19 @@
$pypo = $externalServices["pypo"];
$liquidsoap = $externalServices["liquidsoap"];
$mediamonitor = $externalServices["media-monitor"];
$analyzer = $externalServices["analyzer"];
$r1 = array_reduce($phpDependencies, "booleanReduce", true);
$r2 = array_reduce($externalServices, "booleanReduce", true);
$result = $r1 && $r2;
*/
// Disk information. We only use the [0]th index
// because we don't have Watched/Media Folders
$disk = $this->status->partitions[0];
$used = $disk->totalSpace-$disk->totalFreeSpace;
$total = $disk->totalSpace;
?>
<table width="60%" cellpadding="0" cellspacing="0" border="0" class="statustable">
<?php /* Disabling most of the status page for Airtime Pro
<thead>
<tr>
<td class="strong"><?php echo sprintf(_("%s Version"), PRODUCT_NAME) ?></td>
<td colspan=2><?php echo $this->version; ?></td>
</tr>
<tr class="ui-state-default strong">
<td><?php echo _("Service") ?></td>
<td><?php echo _("Description") ?></td>
@ -37,13 +32,6 @@
</tr>
</thead>
<tbody>
<!--
<tr class="odd">
<td><?php echo sprintf(_("%s Version"), PRODUCT_NAME) ?></td>
<td>1.9.3</td>
<td>&nbsp;</td>
</tr>
-->
<tr>
<td class="component">
Postgres
@ -54,7 +42,7 @@
<td class="solution <?php if ($postgres) {echo 'check';?>">
<?php
} else {
?>"
?>">
Try running <code>sudo apt-get install php5-pgsql</code>
<?php
}
@ -66,15 +54,15 @@
Database
</td>
<td class="description">
Database configuration for Airtime
Database configuration for LibreTime
</td>
<td class="solution <?php if ($database) {echo 'check';?>">
<?php
} else {
?>"
?>">
Make sure you aren't missing any of the Postgres dependencies in the table above.
If your dependencies check out, make sure your database configuration settings in
<code>/etc/airtime.conf</code> are correct and the Airtime database was installed correctly.
<code>/etc/airtime.conf</code> are correct and the LibreTime database was installed correctly.
<?php
}
?>
@ -85,12 +73,12 @@
RabbitMQ
</td>
<td class="description">
RabbitMQ configuration for Airtime
RabbitMQ configuration for LibreTime
</td>
<td class="solution <?php if ($rabbitmq) {echo 'check';?>">
<?php
} else {
?>"
?>">
Make sure RabbitMQ is installed correctly, and that your settings in /etc/airtime/airtime.conf
are correct. Try using <code>sudo rabbitmqctl list_users</code> and <code>sudo rabbitmqctl list_vhosts</code>
to see if the airtime user (or your custom RabbitMQ user) exists, then checking that
@ -103,19 +91,19 @@
</tr>
<tr>
<td class="component">
Media Monitor
Media Analzyer
</td>
<td class="description">
Airtime media-monitor service
LibreTime media analyzer service
</td>
<td class="solution <?php if ($mediamonitor) {echo 'check';?>">
<td class="solution <?php if ($analyzer) {echo 'check';?>">
<?php
} else {
?>"
Check that the airtime-media-monitor service is installed correctly in <code>/etc/init</code>,
?>">
Check that the airtime_analyzer service is installed correctly in <code>/etc/init</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-media-monitor</code><br/>
If not, try <br/><code>sudo service airtime-media-monitor start</code>
<br/><code>initctl list | grep airtime_analyzer</code><br/>
If not, try <br/><code>sudo service airtime_analyzer start</code>
<?php
}
?>
@ -126,12 +114,12 @@
Pypo
</td>
<td class="description">
Airtime playout service
LibreTime playout service
</td>
<td class="solution <?php if ($pypo) {echo 'check';?>">
<?php
} else {
?>"
?>">
Check that the airtime-playout service is installed correctly in <code>/etc/init</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-playout</code><br/>
@ -146,12 +134,12 @@
Liquidsoap
</td>
<td class="description">
Airtime liquidsoap service
LibreTime liquidsoap service
</td>
<td class="solution <?php if ($liquidsoap) {echo 'check';?>">
<td class="solution <?php if ($liquidsoap) {echo 'check';?>" >
<?php
} else {
?>"
?>">
Check that the airtime-liquidsoap service is installed correctly in <code>/etc/init</code>,
and ensure that it's running with
<br/><code>initctl list | grep airtime-liquidsoap</code><br/>
@ -162,26 +150,7 @@
</td>
</tr>
</tbody>
*/?>
<tr id="partitions" class="even">
<th colspan="5"><?php echo _("Disk Space") ?></th>
</tr>
<tr class="partition-info">
<td><span class="strong"><?php echo _("Disk") ?></span>
<ul id="watched-dir-list">
</ul>
</td>
<td>
<?php
echo sprintf("%01.1fGB of %01.1fGB", $used/pow(2, 30), $total/pow(2, 30))
?>
</td>
<td colspan="3">
<div class="big">
<div class="diskspace" style="width:<?php echo sprintf("%01.1f%%", $used/$total*100) ?>;">
</div>
</div>
<div><?php echo sprintf("%01.1f%% ", $used/$total*100) . _("in use") ?></div>
</td>
</tr>
</table>

View file

@ -0,0 +1,7 @@
[rabbitmq]
host = 127.0.0.1
port = 5672
user = airtime
password = airtime
vhost = /airtime

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 568 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 568 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 691 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 568 B

Before After
Before After

View file

@ -1,5 +1,27 @@
#!/bin/bash -e
composer install
git rev-parse HEAD > VERSION
git_build=""
if [ -d .git ]; then
echo " * Building from Git"
git_build="y"
fi
if [ "${git_build}" = "y" ]; then
git_version=`git tag --points-at HEAD`
echo " * Version from tag: ${git_version}"
if [ "${git_version}" = "" ]; then
git_version=`git rev-parse --short HEAD`
echo " * Overriding empty version with sha1 commit-ish: ${git_version}"
fi
echo ${git_version} > VERSION
else
# if no file was in tarball we create one letting the user know
# travis should release tarballs with a pre-written VERSION file
# at some stage
if [ ! -f VERSION ]; then
folder_name=$(basename `pwd`)
echo "tarball install from folder ${folder_name}" > VERSION
fi
fi

View file

@ -1,7 +1,7 @@
On the **System** menu, the **Status** page provides an overview of the health and resource usage of the various services that make up an Airtime system. If all is well, you will only see green check mark icons in the **Status** column. This page also shows how much **Disk Space** you have used on the disk partition containing the main Import folder, as well as any disks or partitions with watched folders.
On the **Settings** menu, the **Status** page provides an overview of the health and resource usage of the various services that make up a LibreTime system. If all is well, you will only see green check mark icons in the **Status** column. This page also shows how much **Disk Space** you have used on the disk partition containing the main Import folder, as well as any disks or partitions with watched folders.
![](static/Screenshot521-System_status_240.png)
If any of the check mark icons in the **Status** column have changed to a red warning sign, contact your system administrator for assistance. (The chapter *Troubleshooting* contains some tips). Airtime will do its best to restart any failing services, but sometimes manual intervention may be required; for example, in the case of hardware failure.
If any of the check mark icons in the **Status** column have changed to a red warning sign, contact your system administrator for assistance. (The chapter [Troubleshooting](../troubleshooting/index.md) contains some tips). LibreTime will do its best to restart any failing services, but sometimes manual intervention may be required; for example, in the case of hardware failure.
If you have run out of storage space, an Airtime user with *admin* privileges could log in and delete media files that are no longer required from the **Library**. Alternatively, you could move some files to a watched folder on another disk, or ask your system administrator to install additional storage capacity.
If you have run out of storage space, a LibreTime user with *admin* privileges could log in and delete media files that are no longer required from the **Library**. Alternatively, you could move some files to a watched folder on another disk, or ask your system administrator to install additional storage capacity.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 263 KiB

Before After
Before After