From 8a2d548d5c6c2b3ec95c6268086c35d3466c712f Mon Sep 17 00:00:00 2001 From: James Date: Mon, 25 Jun 2012 17:25:57 -0400 Subject: [PATCH 1/3] CC-4001: Warnings in apache error log - upgrade script for 2.1.3 --- .../upgrades/airtime-2.1.3/DbUpgrade.php | 24 +++++++++++++++++++ .../airtime-2.1.3/airtime-upgrade.php | 8 +++++++ .../upgrades/airtime-2.1.3/data/upgrade.sql | 4 ++++ 3 files changed, 36 insertions(+) create mode 100644 install_minimal/upgrades/airtime-2.1.3/DbUpgrade.php create mode 100644 install_minimal/upgrades/airtime-2.1.3/airtime-upgrade.php create mode 100644 install_minimal/upgrades/airtime-2.1.3/data/upgrade.sql diff --git a/install_minimal/upgrades/airtime-2.1.3/DbUpgrade.php b/install_minimal/upgrades/airtime-2.1.3/DbUpgrade.php new file mode 100644 index 000000000..bda71b900 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.1.3/DbUpgrade.php @@ -0,0 +1,24 @@ +&1 | grep -v \"will create implicit index\""); + } +} diff --git a/install_minimal/upgrades/airtime-2.1.3/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.1.3/airtime-upgrade.php new file mode 100644 index 000000000..042b92d05 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.1.3/airtime-upgrade.php @@ -0,0 +1,8 @@ + Date: Mon, 25 Jun 2012 18:30:33 -0400 Subject: [PATCH 2/3] add time to our version so cache is never used in dev branch --- airtime_mvc/application/models/Preference.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 81d449ee6..54168bced 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -618,7 +618,7 @@ class Application_Model_Preference if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development" && function_exists('exec')){ $version = exec("git rev-parse --short HEAD 2>/dev/null", $out, $return_code); if ($return_code == 0){ - return self::GetValue("system_version")."+".$version; + return self::GetValue("system_version")."+".$version.":".time(); } } return self::GetValue("system_version"); From a63b765621bda8b047f7ab62c37b6b1c77d31786 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 25 Jun 2012 23:40:07 -0400 Subject: [PATCH 3/3] CC-4011: System -> Media Folders: Changing page will stop removing a watched folder with lots of files (50,000) -Changed doing 50,000 database calls to 1. --- airtime_mvc/application/models/MusicDir.php | 22 +++++++------------ airtime_mvc/application/models/StoredFile.php | 3 +-- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/airtime_mvc/application/models/MusicDir.php b/airtime_mvc/application/models/MusicDir.php index 3c8b64e01..70609fad3 100644 --- a/airtime_mvc/application/models/MusicDir.php +++ b/airtime_mvc/application/models/MusicDir.php @@ -82,17 +82,9 @@ class Application_Model_MusicDir { $show_instances = $con->query($sql)->fetchAll(); // get all the files on this dir - $sql = "SELECT f.id FROM cc_music_dirs as md " - ." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id"; - $files = $con->query($sql)->fetchAll(); - - // set file_exist flag to false - foreach ($files as $file_row) { - $temp_file = Application_Model_StoredFile::Recall($file_row['id']); - if($temp_file != null){ - $temp_file->setFileExistsFlag(false); - } - } + $sql = "UPDATE cc_files SET file_exists = 'f' WHERE id IN (SELECT f.id FROM cc_music_dirs as md " + ." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id)"; + $affected = $con->exec($sql); // set RemovedFlag to true if ($userAddedWatchedDir) { @@ -399,14 +391,16 @@ class Application_Model_MusicDir { * otherwise, it will set "Exists" flag to true **/ public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){ + + //make sure that $p_dir has a trailing "/" $real_path = Application_Common_OsPath::normpath($p_dir)."/"; if($real_path != "/"){ $p_dir = $real_path; } $dir = Application_Model_MusicDir::getDirByPath($p_dir); - if($dir == NULL){ - return array("code"=>1,"error"=>"'$p_dir' doesn't exist in the watched list."); - }else{ + if (is_null($dir)) { + return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list."); + } else { $dir->remove($userAddedWatchedDir); $data = array(); $data["directory"] = $p_dir; diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index d69e28e19..ccee5525c 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -890,8 +890,7 @@ Logging::log("getting media! - 2"); exec($command, $output, $rv); if ($rv != 0 || (!empty($output) && $output[0] == 'TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.')) { $result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library."); - } - else { + } else { //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation $r = @rename($audio_file, $audio_stor);