Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
fbcd74f4f3
4 changed files with 66 additions and 18 deletions
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//CC-2279 Upgrade script for converting stor directory to new format
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
namespace DoctrineMigrations;
|
||||||
|
//CC-2279 Upgrade script for creating the cc_music_dirs table.
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
Doctrine\DBAL\Schema\Schema;
|
Doctrine\DBAL\Schema\Schema;
|
||||||
|
@ -21,16 +19,10 @@ class Version20110629143017 extends AbstractMigration
|
||||||
$cc_music_dirs->setPrimaryKey(array('id'));
|
$cc_music_dirs->setPrimaryKey(array('id'));
|
||||||
|
|
||||||
//end create cc_music_dirs table
|
//end create cc_music_dirs table
|
||||||
|
|
||||||
|
|
||||||
//start cc_files modifications
|
|
||||||
$cc_files = $schema->getTable('cc_files');
|
|
||||||
$cc_files->addColumn('directory', 'integer', array('default'=> -1));
|
|
||||||
|
|
||||||
//$cc_files->addNamedForeignKeyConstraint('cc_music_dirs_folder_fkey', $cc_music_dirs, array('directory'), array('id'), array('onDelete' => 'CASCADE'));
|
|
||||||
//end cc_files modifications
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema)
|
||||||
{
|
{
|
||||||
$schema->dropTable('cc_music_dirs');
|
$schema->dropTable('cc_music_dirs');
|
||||||
|
|
38
install/DoctrineMigrations/Version20110711161043.php
Normal file
38
install/DoctrineMigrations/Version20110711161043.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
/*
|
||||||
|
update cc_files table to include to "directory" column as well as add foreign key relation to
|
||||||
|
cc_music_dirs table.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
class Version20110711161043 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(Schema $schema)
|
||||||
|
{
|
||||||
|
|
||||||
|
//CREATE the default value of "/srv/airtime/stor", this can be updated later in the upgrade script.
|
||||||
|
$this->_addSql("INSERT INTO cc_music_dirs (type, directory) VALUES ('stor', '/srv/airtime/stor');");
|
||||||
|
|
||||||
|
$this->_addSql("INSERT INTO cc_music_dirs (type, directory) VALUES ('upgrade', '');");
|
||||||
|
|
||||||
|
$cc_music_dirs = $schema->getTable('cc_music_dirs');
|
||||||
|
|
||||||
|
//start cc_files modifications
|
||||||
|
$cc_files = $schema->getTable('cc_files');
|
||||||
|
$cc_files->addColumn('directory', 'integer', array('default'=> 2));
|
||||||
|
|
||||||
|
$cc_files->addNamedForeignKeyConstraint('cc_music_dirs_folder_fkey', $cc_music_dirs, array('directory'), array('id'), array('onDelete' => 'CASCADE'));
|
||||||
|
//end cc_files modifications
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,5 +102,7 @@ passthru("python ".__DIR__."/../../python_apps/media-monitor/install/media-monit
|
||||||
|
|
||||||
AirtimeIni::CreateMonitFile();
|
AirtimeIni::CreateMonitFile();
|
||||||
|
|
||||||
|
sleep(4);
|
||||||
|
passthru("airtime-check-system");
|
||||||
|
|
||||||
echo "******************************* Update Complete *******************************".PHP_EOL;
|
echo "******************************* Update Complete *******************************".PHP_EOL;
|
||||||
|
|
|
@ -15,6 +15,7 @@ AirtimeInstall::CreateZendPhpLogFile();
|
||||||
|
|
||||||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
|
||||||
function BypassMigrations($version)
|
function BypassMigrations($version)
|
||||||
{
|
{
|
||||||
|
@ -68,8 +69,9 @@ function UninstallBinaries()
|
||||||
|
|
||||||
|
|
||||||
function removeOldAirtimeImport(){
|
function removeOldAirtimeImport(){
|
||||||
exec('rm -f "/usr/lib/airtime/utils/airtime-import"');
|
exec('rm -f "/usr/bin/airtime-import"');
|
||||||
exec('rm -f "/usr/lib/airtime/utils/airtime-import.php"');
|
exec('rm -f "/usr/lib/airtime/utils/airtime-import.php"');
|
||||||
|
exec('rm -rf "/usr/lib/airtime/utils/airtime-import"');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAirtimeImportSymLink(){
|
function updateAirtimeImportSymLink(){
|
||||||
|
@ -84,8 +86,9 @@ function execSqlQuery($sql){
|
||||||
if (PEAR::isError($result)) {
|
if (PEAR::isError($result)) {
|
||||||
echo "* Failed sql query: $sql".PHP_EOL;
|
echo "* Failed sql query: $sql".PHP_EOL;
|
||||||
echo "* Message {$result->getMessage()}".PHP_EOL;
|
echo "* Message {$result->getMessage()}".PHP_EOL;
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToDatabase(){
|
function connectToDatabase(){
|
||||||
|
@ -106,7 +109,6 @@ function connectToDatabase(){
|
||||||
/* In version 1.9.0 we have have switched from daemontools to more traditional
|
/* In version 1.9.0 we have have switched from daemontools to more traditional
|
||||||
* init.d daemon system. Let's remove all the daemontools files
|
* init.d daemon system. Let's remove all the daemontools files
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exec("/usr/bin/airtime-pypo-stop");
|
exec("/usr/bin/airtime-pypo-stop");
|
||||||
exec("/usr/bin/airtime-show-recorder-stop");
|
exec("/usr/bin/airtime-show-recorder-stop");
|
||||||
|
|
||||||
|
@ -138,9 +140,9 @@ foreach ($pathnames as $pn){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update Airtime Server PHP files
|
||||||
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
|
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
|
||||||
$phpDir = $values['general']['airtime_dir'];
|
$phpDir = $values['general']['airtime_dir'];
|
||||||
|
|
||||||
InstallAirtimePhpServerCode($phpDir);
|
InstallAirtimePhpServerCode($phpDir);
|
||||||
|
|
||||||
//update utils (/usr/lib/airtime) folder
|
//update utils (/usr/lib/airtime) folder
|
||||||
|
@ -408,18 +410,34 @@ execSqlQuery($sql);
|
||||||
//create cron file for phone home stat
|
//create cron file for phone home stat
|
||||||
AirtimeInstall::CreateCronFile();
|
AirtimeInstall::CreateCronFile();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Handle Database Changes.
|
||||||
$stor_dir = realpath($values['general']['base_files_dir']."/stor")."/";
|
$stor_dir = realpath($values['general']['base_files_dir']."/stor")."/";
|
||||||
echo "* Inserting stor directory location $stor_dir into music_dirs table".PHP_EOL;
|
echo "* Inserting stor directory location $stor_dir into music_dirs table".PHP_EOL;
|
||||||
$sql = "INSERT INTO cc_music_dirs (directory, type) VALUES ('$stor_dir', 'stor')";
|
$sql = "UPDATE cc_music_dirs SET directory='$stor_dir' WHERE type='stor'";
|
||||||
echo $sql.PHP_EOL;
|
echo $sql.PHP_EOL;
|
||||||
execSqlQuery($sql);
|
execSqlQuery($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT id FROM cc_music_dirs WHERE type='stor'";
|
||||||
|
echo $sql.PHP_EOL;
|
||||||
|
$rows = execSqlQuery($sql);
|
||||||
|
|
||||||
|
//echo "STORAGE ROW ID: $rows[0]";
|
||||||
|
|
||||||
//old database had a "fullpath" column that stored the absolute path of each track. We have to
|
//old database had a "fullpath" column that stored the absolute path of each track. We have to
|
||||||
//change it so that the "fullpath" column has path relative to the "directory" column.
|
//change it so that the "fullpath" column has path relative to the "directory" column.
|
||||||
|
|
||||||
|
echo "Creating media-monitor log file";
|
||||||
mkdir("/var/log/airtime/media-monitor/", 755, true);
|
mkdir("/var/log/airtime/media-monitor/", 755, true);
|
||||||
touch("/var/log/airtime/media-monitor/media-monitor.log");
|
touch("/var/log/airtime/media-monitor/media-monitor.log");
|
||||||
|
|
||||||
|
//create media monitor config:
|
||||||
|
if (!copy(__DIR__."/../../../python_apps/media-monitor/media-monitor.cfg", CONF_FILE_MEDIAMONITOR)){
|
||||||
|
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Reorganizing files in stor directory";
|
||||||
$mediaMonitorUpgradePath = realpath(__DIR__."/../../../python_apps/media-monitor/media-monitor-upgrade.py");
|
$mediaMonitorUpgradePath = realpath(__DIR__."/../../../python_apps/media-monitor/media-monitor-upgrade.py");
|
||||||
exec("su -c \"python $mediaMonitorUpgradePath\"", $output);
|
exec("su -c \"python $mediaMonitorUpgradePath\"", $output);
|
||||||
|
|
||||||
|
@ -427,8 +445,6 @@ print_r($output);
|
||||||
|
|
||||||
$oldAndNewFileNames = json_decode($output[0]);
|
$oldAndNewFileNames = json_decode($output[0]);
|
||||||
|
|
||||||
print_r($oldAndNewFileNames);
|
|
||||||
|
|
||||||
foreach ($oldAndNewFileNames as $pair){
|
foreach ($oldAndNewFileNames as $pair){
|
||||||
$relPathNew = pg_escape_string(substr($pair[1], strlen($stor_dir)));
|
$relPathNew = pg_escape_string(substr($pair[1], strlen($stor_dir)));
|
||||||
$absPathOld = pg_escape_string($pair[0]);
|
$absPathOld = pg_escape_string($pair[0]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue