function oneTask($task) { if ($task['type'] == 0) { $this_path = ProdsDir::fromURI($task['src'], false); $new_path = ProdsDir::fromURI($task['dest'], false); } else { $this_path = ProdsFile::fromURI($task['src'], false); $new_path = ProdsFile::fromURI($task['dest'], false); } if (empty($parent->account->pass)) { $acct = $_SESSION['acct_manager']->findAcct($this_path->account); if (empty($acct)) { $response = array('success' => false, 'errmsg' => 'Authentication Required'); echo json_encode($response); exit(0); } $this_path->account = $acct; } if (empty($this_path->account->zone)) { $this_path->account->getUserInfo(); } $this_path->rename($new_path->path_str); }
/** * opendir() handler. * * @access private */ public function dir_opendir($path, $options) { try { $this->dir = ProdsDir::fromURI($path, true); $this->metadata = $this->dir->getMeta(); return true; } catch (Exception $e) { trigger_error("Got an exception:{$e}", E_USER_WARNING); return false; } }
$account = $acct; $mservices = array(); $input_params = array("*desc_resc" => $resc); $num_files = 0; foreach ($files as $fileuri) { if (strlen($fileuri) > 0) { $myfile = ProdsFile::fromURI($fileuri); $mservices[] = "msiDataObjRepl(*desc_file{$num_files},*desc_resc,*outbuf)"; $input_params["*desc_file{$num_files}"] = $myfile->getPath(); $num_files++; } } $num_dirs = 0; foreach ($dirs as $diruri) { if (strlen($diruri) > 0) { $mydir = ProdsDir::fromURI($diruri); $mservices[] = "msiReplColl(*desc_dir{$num_dirs},*desc_resc,backupMode,*outbuf)"; $input_params["*desc_dir{$num_dirs}"] = $mydir->getPath(); $num_dirs++; } } $rule_body = 'myTestRule||' . 'delayExec(<PLUSET>0m</PLUSET>,' . implode("##", $mservices) . ',nop)|nop'; /* --debug code here in case when delayed exec not working */ //$rule_body='myTestRule||'.implode("##", $mservices).'|nop'; $rule = new ProdsRule($account, $rule_body, $input_params); $results = $rule->execute(); $response = array('success' => true, 'log' => "{$num_files} files and {$num_dirs} scheduled for replication!"); echo json_encode($response); } catch (Exception $e) { $response = array('success' => false, 'errmsg' => $e->getMessage(), 'errcode' => $e->getCode()); echo json_encode($response);
<?php require_once "../config.inc.php"; require_once PRODS_INC_PATH; session_start(); if (!isset($_SESSION['acct_manager'])) { $_SESSION['acct_manager'] = new RODSAcctManager(); } $ruri = isset($_REQUEST['node']) ? $_REQUEST['node'] : '/'; $ruri = "rods:/" . $ruri; $collection = ProdsDir::fromURI($ruri, false); if (empty($collection->account->pass)) { $acct = $_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { $arr = array(); $arr['success'] = false; $arr['errmsg'] = "You don't have permission for this directory! Please sign-on"; $arr['errcode'] = -99; $str = json_encode($arr); echo "({$str})"; exit(0); } $collection->account = $acct; } $recursive = isset($_REQUEST['recursive']) && $_REQUEST['recursive'] == '1' ? true : false; try { listChildDirJson($collection); } catch (RODSException $e) { $arr = array(); $arr['success'] = false; $arr['errmsg'] = $e->getMessage();
$mod_batch = json_decode(urldecode($_REQUEST['batch']), true); if (!is_array($mod_batch)) { $response = array('success' => false, 'errmsg' => "Mal-formated Mod batch"); echo json_encode($response); exit(0); } } } if ($action == NULL) { $response = array('success' => false, 'errmsg' => 'Expected type not specified'); echo json_encode($response); exit(0); } try { if ($type == 0) { $this_path = ProdsDir::fromURI($ruri, false); } else { $this_path = ProdsFile::fromURI($ruri, false); } if (empty($parent->account->pass)) { $acct = $_SESSION['acct_manager']->findAcct($this_path->account); if (empty($acct)) { $response = array('success' => false, 'errmsg' => 'Authentication Required'); echo json_encode($response); exit(0); } $this_path->account = $acct; } if (empty($this_path->account->zone)) { $this_path->account->getUserInfo(); }
} else { $response = array('success' => false, 'log' => 'Expected RODS URI not found'); echo json_encode($response); exit(0); } $name = ''; if (isset($_REQUEST['name'])) { $name = $_REQUEST['name']; } if (empty($name)) { $response = array('success' => false, 'log' => 'New collection name not specified'); echo json_encode($response); exit(0); } try { $parent = ProdsDir::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct = $_SESSION['acct_manager']->findAcct($parent->account); if (empty($acct)) { $response = array('success' => false, 'log' => 'Authentication Required'); echo json_encode($response); exit(0); } $parent->account = $acct; } if (empty($parent->account->zone)) { $parent->account->getUserInfo(); } $parent->mkdir($name); $response = array('success' => true, 'log' => 'new collection created!'); echo json_encode($response);