Removed unused code
This commit is contained in:
parent
dc91db1f46
commit
e2d69df4a6
|
@ -73,7 +73,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
|
$jsonStr = json_encode( array(
|
||||||
|
"version" => Application_Model_Preference::GetAirtimeVersion()));
|
||||||
echo $jsonStr;
|
echo $jsonStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +95,11 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->calendarInit = array(
|
$this->view->calendarInit = array(
|
||||||
"timestamp" => time(),
|
"timestamp" => time(),
|
||||||
"timezoneOffset" => date("Z"),
|
"timezoneOffset" => date("Z"),
|
||||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||||
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,101 +608,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
die( json_encode($responses) );
|
die( json_encode($responses) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reloadMetadataAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$mode = $request->getParam('mode');
|
|
||||||
$params = $request->getParams();
|
|
||||||
|
|
||||||
$md = array();
|
|
||||||
//extract all file metadata params from the request.
|
|
||||||
foreach ($params as $key => $value) {
|
|
||||||
if (preg_match('/^MDATA_KEY/', $key)) {
|
|
||||||
$md[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Logging::info( $md );
|
|
||||||
|
|
||||||
// update import timestamp
|
|
||||||
Application_Model_Preference::SetImportTimestamp();
|
|
||||||
if ($mode == "create") {
|
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
||||||
//$filepath = str_replace("\\", "", $filepath);
|
|
||||||
//$filepath = str_replace("//", "/", $filepath);
|
|
||||||
$filepath = Application_Common_OsPath::normpath($filepath);
|
|
||||||
|
|
||||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
|
||||||
if (is_null($file)) {
|
|
||||||
$file = Application_Model_StoredFile::Insert($md);
|
|
||||||
} else {
|
|
||||||
// path already exist
|
|
||||||
if ($file->getFileExistsFlag()) {
|
|
||||||
// file marked as exists
|
|
||||||
$this->view->error = "File already exists in Airtime.";
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
// file marked as not exists
|
|
||||||
$file->setFileExistsFlag(true);
|
|
||||||
$file->setMetadata($md);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($mode == "modify") {
|
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
||||||
//$filepath = str_replace("\\", "", $filepath);
|
|
||||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
|
||||||
|
|
||||||
//File is not in database anymore.
|
|
||||||
if (is_null($file)) {
|
|
||||||
$this->view->error = "File does not exist in Airtime.";
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
//Updating a metadata change.
|
|
||||||
$file->setMetadata($md);
|
|
||||||
}
|
|
||||||
} elseif ($mode == "moved") {
|
|
||||||
$md5 = $md['MDATA_KEY_MD5'];
|
|
||||||
Logging::info("Original path: {$md['MDATA_KEY_ORIGINAL_PATH']}");
|
|
||||||
$file = Application_Model_StoredFile::RecallByMd5($md5);
|
|
||||||
|
|
||||||
if (is_null($file)) {
|
|
||||||
$this->view->error = "File doesn't exist in Airtime.";
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
||||||
//$filepath = str_replace("\\", "", $filepath);
|
|
||||||
$file->setFilePath($filepath);
|
|
||||||
}
|
|
||||||
} elseif ($mode == "delete") {
|
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
||||||
//$filepath = str_replace("\\", "", $filepath);
|
|
||||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
|
||||||
|
|
||||||
if (is_null($file)) {
|
|
||||||
$this->view->error = "File doesn't exist in Airtime.";
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
$file->deleteByMediaMonitor();
|
|
||||||
}
|
|
||||||
} elseif ($mode == "delete_dir") {
|
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
||||||
//$filepath = str_replace("\\", "", $filepath);
|
|
||||||
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
|
||||||
$file->deleteByMediaMonitor();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->view->id = $file->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function listAllFilesAction()
|
public function listAllFilesAction()
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
Loading…
Reference in New Issue