From 38090af2719ceae5307d4e40a687b3f3edd7b108 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 24 Mar 2011 02:12:31 -0400 Subject: [PATCH] CC-2058: Utilities are not in the system $PATH -cleanup --- utils/cleanStor.php | 124 -------------------------------------------- 1 file changed, 124 deletions(-) delete mode 100644 utils/cleanStor.php diff --git a/utils/cleanStor.php b/utils/cleanStor.php deleted file mode 100644 index 6f0719508..000000000 --- a/utils/cleanStor.php +++ /dev/null @@ -1,124 +0,0 @@ - 4)) { - list($dirList,$fileList) = File_Find::maptree($p_path); - - $array_mus; - foreach ($fileList as $filepath) { - - if (@substr($filepath, strlen($filepath) - 3) != "xml") { - $array_mus[] = $filepath; - } - } - - foreach ($array_mus as $audio_file) { - - if (@is_link($audio_file) && !@stat($audio_file)) { - - //filesystem clean up. - @unlink($audio_file); - echo "unlinked $audio_file\n"; - @unlink($audio_file . ".xml"); - echo "unlinked " . $audio_file . ".xml\n"; - @rmdir(@dirname($audio_file)); - echo "removed dir " . @dirname($audio_file) . "\n"; - - //database clean up. - $stored_audio_file = StoredFile::RecallByGunid(@basename($audio_file)); - $stored_audio_file->delete(); - } - } - - } -} - -function airtime_remove_files($p_path) { - - if (!empty($p_path) && (strlen($p_path) > 4)) { - list($dirList,$fileList) = File_Find::maptree($p_path); - - foreach ($fileList as $filepath) { - echo " * Removing $filepath\n"; - @unlink($filepath); - echo "done.\n"; - } - foreach ($dirList as $dirpath) { - echo " * Removing $dirpath\n"; - @rmdir($dirpath); - echo "done.\n"; - } - } -} - -function airtime_empty_db($db) { - global $CC_CONFIG; - - if (!PEAR::isError($db)) { - if (AirtimeInstall::DbTableExists($CC_CONFIG['filesTable'])) { - echo " * Deleting from database table ".$CC_CONFIG['filesTable']."\n"; - $sql = "DELETE FROM ".$CC_CONFIG['filesTable']; - AirtimeInstall::InstallQuery($sql, false); - } - else { - echo " * Skipping: database table ".$CC_CONFIG['filesTable']."\n"; - } - } -} - - -global $CC_CONFIG; - -$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); -$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); - -if ($argc != 2){ - printUsage(); - exit(1); -} - -switch($argv[1]){ - - case '-e': - case '--empty': - airtime_empty_db($CC_DBC); - airtime_remove_files($CC_CONFIG['storageDir']); - break; - case '-c': - case '--clean': - airtime_clean_files($CC_CONFIG['storageDir']); - break; - default: - printUsage(); - -} -