public static function getFolder($folders_id = NULL, $params = NULL, $extra_params = NULL) { // check to see if this has been cached as an empty folder $mem_key = vf::getEmptyFolderKey($folders_id); $folder = mem($mem_key); if ($folder && !$_GET['refresh_empty_folders']) { return $folder; } // it's not a known empty folder (or we are refreshing) // get the folder $folder = (object) self::$client->get_folder($folders_id, $params, $extra_params); // if the folder is empty/error, cache the empty folder if ($folder->error) { mem($mem_key, $folder, '6 hours'); } return $folder; }
/** * Does the upload if there are no errors, and uploads the db_field if necessary * @return array response array */ public function doUpload() { if ($this->errors) { return $this->respond(); } $upload_opts = array('folders_path' => $this->folders_path); $re = vf::$client->upload_to_server($this->uploaded_file, $upload_opts); unlink($this->uploaded_file); // delete file from tmpdir if (!$re['success']) { $this->errors[] = 'There was an error uploading the file:'; $this->errors[] = $re['last_error']; return $this->respond($re); } // clear empty folder cache $key = vf::getEmptyFolderKey($this->folders_path); mem($key, null); if ($this->params['db_field'] && $this->params['db_row_id']) { $this->updateDBRecord($re['items_id']); } return $this->respond($re); }