本文整理汇总了PHP中Ubirimi\Util::getAssetsFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getAssetsFolder方法的具体用法?PHP Util::getAssetsFolder怎么用?PHP Util::getAssetsFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ubirimi\Util
的用法示例。
在下文中一共展示了Util::getAssetsFolder方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$loggedInUserId = $session->get('user/id');
$name = $request->request->get('name');
$description = $request->request->get('description');
$type = $request->request->get('type');
$parentId = $request->request->get('parent_id');
$spaceId = $request->request->get('space_id');
if ($type == 'file_list') {
$pageType = EntityType::ENTITY_FILE_LIST;
} else {
$pageType = EntityType::ENTITY_BLANK_PAGE;
}
if ($parentId == -1) {
// set the parent to the home page of the space if it exists
$space = $this->getRepository(Space::class)->getById($spaceId);
$homeEntityId = $space['home_entity_id'];
if ($homeEntityId) {
$parentId = $homeEntityId;
} else {
$parentId = null;
}
}
$page = new Entity($pageType, $spaceId, $loggedInUserId, $parentId, $name, $description);
$currentDate = Util::getServerCurrentDateTime();
$pageId = $page->save($currentDate);
// if the page is a file list create the folders
$baseFilePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'filelists');
if ($pageType == EntityType::ENTITY_FILE_LIST) {
mkdir($baseFilePath . $pageId);
}
return new Response($pageId);
}
示例2: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$clientId = $session->get('client/id');
$loggedInUserId = $session->get('user/id');
$entityId = $request->get('id');
$currentDate = Util::getServerCurrentDateTime();
$pathBaseAttachments = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'filelists');
$index = 0;
if (isset($_FILES['entity_upload_file'])) {
foreach ($_FILES['entity_upload_file']['name'] as $filename) {
if (!empty($filename)) {
// check if this file already exists
$fileExists = $this->getRepository(Entity::class)->getFileByName($entityId, $filename);
if ($fileExists) {
// get the last revision and increment it by one
$fileId = $fileExists['id'];
$revisions = $this->getRepository(Entity::class)->getRevisionsByFileId($fileId);
$revisionNumber = $revisions->num_rows + 1;
// create the revision folder
if (!file_exists($pathBaseAttachments . $entityId)) {
mkdir($pathBaseAttachments . $entityId);
}
if (!file_exists($pathBaseAttachments . $entityId . '/' . $fileId)) {
mkdir($pathBaseAttachments . $entityId . '/' . $fileId);
}
if (!file_exists($pathBaseAttachments . $entityId . '/' . $fileId . '/' . $revisionNumber)) {
mkdir($pathBaseAttachments . $entityId . '/' . $fileId . '/' . $revisionNumber);
}
} else {
// add the file to the list of files
$fileId = $this->getRepository(Entity::class)->addFile($entityId, $filename, $currentDate);
$this->getLogger()->addInfo('ADD Documentador entity file ' . $filename, $this->getLoggerContext());
$revisionNumber = 1;
// create the folder for the file
mkdir($pathBaseAttachments . $entityId . '/' . $fileId);
// create the folder for the first revision
mkdir($pathBaseAttachments . $entityId . '/' . $fileId . '/' . $revisionNumber);
}
// add revision to the file
$this->getRepository(Entity::class)->addFileRevision($fileId, $loggedInUserId, $currentDate);
if ($revisionNumber > 1) {
$this->getLogger()->addInfo('ADD Documentador entity file revision to ' . $filename, $this->getLoggerContext());
}
$baseFileName = pathinfo($filename, PATHINFO_FILENAME);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
move_uploaded_file($_FILES["entity_upload_file"]["tmp_name"][$index], $pathBaseAttachments . $entityId . '/' . $fileId . '/' . $revisionNumber . '/' . $baseFileName . '.' . $extension);
$index++;
}
}
}
return new RedirectResponse('/documentador/page/view/' . $entityId);
}
示例3: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$loggedInUserId = $session->get('user/id');
$CKEditorFuncNum = $_GET['CKEditorFuncNum'];
$allowedExtensions = array("gif", "jpeg", "jpg", "png");
$extension = strtolower(pathinfo($_FILES['upload']['name'], PATHINFO_EXTENSION));
$entityId = $session->get('current_edit_entity_id');
$entity = $this->getRepository(Entity::class)->getById($entityId);
$spaceId = $entity['space_id'];
$currentDate = Util::getServerCurrentDateTime();
$attachmentsBaseFilePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'attachments');
if (($_FILES["upload"]["type"] == "image/gif" || $_FILES["upload"]["type"] == "image/jpeg" || $_FILES["upload"]["type"] == "image/jpg" || $_FILES["upload"]["type"] == "image/pjpeg" || $_FILES["upload"]["type"] == "image/x-png" || $_FILES["upload"]["type"] == "image/png") && in_array($extension, $allowedExtensions)) {
if ($_FILES["upload"]["error"] > 0) {
// error
} else {
$fileName = $_FILES["upload"]["name"];
// check if the attachment already exists
$attachment = $this->getRepository(EntityAttachment::class)->getByEntityIdAndName($entityId, $fileName);
if ($attachment) {
// get the last revision and increment it by one
$attachmentId = $attachment['id'];
$revisions = $this->getRepository(Entity::class)->getRevisionsByAttachmentId($attachmentId);
$revisionNumber = $revisions->num_rows + 1;
// create the revision folder
mkdir($attachmentsBaseFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId . '/' . $revisionNumber);
} else {
// add the attachment in the database
$currentDate = Util::getServerCurrentDateTime();
$attachmentId = $this->getRepository(EntityAttachment::class)->add($entityId, $fileName, $currentDate);
$revisionNumber = 1;
if (!file_exists($attachmentsBaseFilePath . $spaceId)) {
mkdir($attachmentsBaseFilePath . $spaceId);
}
if (!file_exists($attachmentsBaseFilePath . $spaceId . '/' . $entityId)) {
mkdir($attachmentsBaseFilePath . $spaceId . '/' . $entityId);
}
if (!file_exists($attachmentsBaseFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId)) {
mkdir($attachmentsBaseFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId);
}
mkdir($attachmentsBaseFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId . '/' . $revisionNumber);
}
$directoryName = $attachmentsBaseFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId . '/' . $revisionNumber;
move_uploaded_file($_FILES["upload"]["tmp_name"], $directoryName . '/' . $fileName);
$this->getRepository(EntityAttachment::class)->addRevision($attachmentId, $loggedInUserId, $currentDate);
$attachmentsPath = UbirimiContainer::get()['asset.documentador_entity_attachments'];
$html = '<html><body><script type="text/javascript">window.parent.CKEDITOR.tools.callFunction("' . $CKEditorFuncNum . '", "/assets/' . $attachmentsPath . $spaceId . '/' . $entityId . '/' . $attachmentId . '/' . $revisionNumber . '/' . $fileName . '");</script></body></html>';
return new Response($html);
}
} else {
return new Response('');
}
}
示例4: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$loggedInUserId = $session->get('user/id');
$filenameData = apache_request_headers();
$filename = rawurldecode($filenameData['X_FILENAME']);
$issueId = $request->request->get('issue_id');
if (!$session->has('added_attachments_in_screen')) {
$session->set('added_attachments_in_screen', array());
}
/* every attachment has its own dedicated sub-folder, so no editing on the upload filename will be done */
if ($filename) {
$ext = substr($filename, strrpos($filename, '.') + 1);
$filenameWithoutExtension = substr($filename, 0, strrpos($filename, '.'));
$attachmentId = $this->getRepository(IssueAttachment::class)->add($issueId, Util::slugify($filenameWithoutExtension) . '.' . $ext, $loggedInUserId, Util::getServerCurrentDateTime());
if ($issueId == null) {
$issueId = 'user_' . $loggedInUserId;
}
$uploadDirectory = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId;
/* subfolders */
$uploadDirSubfolder = $uploadDirectory . '/' . $attachmentId;
if (!file_exists($uploadDirectory)) {
mkdir($uploadDirectory);
}
if (!file_exists($uploadDirSubfolder)) {
mkdir($uploadDirSubfolder);
}
$newFileName = $uploadDirSubfolder . '/' . Util::slugify($filenameWithoutExtension) . '.' . $ext;
file_put_contents($newFileName, file_get_contents('php://input'));
$size = filesize($newFileName);
$temp = $session->get('added_attachments_in_screen');
$temp[] = $attachmentId;
$session->set('added_attachments_in_screen', $temp);
$this->getRepository(IssueAttachment::class)->updateSizeById($attachmentId, $size);
if (Util::isImage(Util::getExtension($filename))) {
$thumbUploaddirSubfolder = $uploadDirSubfolder . '/thumbs';
if (!file_exists($thumbUploaddirSubfolder)) {
mkdir($thumbUploaddirSubfolder);
}
$newThumbnailName = $thumbUploaddirSubfolder . '/' . Util::slugify($filenameWithoutExtension) . '.' . $ext;
$image = new ZebraImage();
$image->jpeg_quality = 100;
$image->chmod_value = 0755;
$image->source_path = $newFileName;
$image->target_path = $newThumbnailName;
$image->resize(150, 150, ZEBRA_IMAGE_CROP_CENTER);
}
return new JsonResponse($attachmentId);
}
return new Response('');
}
示例5: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$loggedInUserId = UbirimiContainer::get()['session']->get('user/id');
Util::checkUserIsLoggedInAndRedirect();
$issueId = $request->request->get('issue_id');
$attIdsSession = $session->has('added_attachments_in_screen') ? $session->get('added_attachments_in_screen') : null;
if ($attIdsSession) {
for ($i = 0; $i < count($attIdsSession); $i++) {
$attachmentId = $attIdsSession[$i];
$this->getRepository(IssueAttachment::class)->deleteById($attachmentId);
if ($issueId) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachmentId);
}
}
$session->remove('added_attachments_in_screen');
}
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId)) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId);
}
return new Response('');
}
示例6: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$clientId = $session->get('client/id');
$loggedInUserId = $session->get('user/id');
$attachmentId = $request->request->get('id');
$attachment = $this->getRepository(EntityAttachment::class)->getById($attachmentId);
$entityId = $attachment['documentator_entity_id'];
$space = $this->getRepository(Entity::class)->getById($entityId);
$spaceId = $space['space_id'];
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(EntityAttachment::class)->deleteById($spaceId, $entityId, $attachmentId);
$this->getLogger()->addInfo('DELETE Documentador entity attachment ' . $attachment['name'], $this->getLoggerContext());
$attachments = $this->getRepository(EntityAttachment::class)->getByEntityId($entityId);
if (!$attachments) {
// delete the attachment folder
$attachmentsFilePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'attachments');
Util::deleteDir($attachmentsFilePath . $spaceId . '/' . $entityId);
}
return new Response('');
}
示例7: deleteById
public function deleteById($spaceId, $entityId, $attachmentId)
{
EntityAttachment::deleteRevisionsByAttachmentId($attachmentId);
// delete folder from disk
$attachmentsFilePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'attachments');
Util::deleteDir($attachmentsFilePath . $spaceId . '/' . $entityId . '/' . $attachmentId);
// remove attachment revisions
$query = "delete from documentator_entity_attachment where id = ? limit 1";
if ($stmt = UbirimiContainer::get()['db.connection']->prepare($query)) {
$stmt->bind_param("i", $attachmentId);
$stmt->execute();
}
}
示例8: deleteById
public function deleteById($clientId)
{
$clientData = UbirimiContainer::get()['repository']->get(UbirimiClient::class)->getById($clientId);
$query = "SET FOREIGN_KEY_CHECKS = 0;";
UbirimiContainer::get()['db.connection']->query($query);
// delete Yongo Product data
$projects = UbirimiContainer::get()['repository']->get(UbirimiClient::class)->getProjects($clientId);
while ($projects && ($project = $projects->fetch_array(MYSQLI_ASSOC))) {
UbirimiContainer::get()['repository']->get(YongoProject::class)->deleteById($project['id']);
}
$workflows = UbirimiContainer::get()['repository']->get(Workflow::class)->getByClientId($clientId);
while ($workflows && ($workflow = $workflows->fetch_array(MYSQLI_ASSOC))) {
UbirimiContainer::get()['repository']->get(Workflow::class)->deleteById($workflow['id']);
}
UbirimiContainer::get()['repository']->get(NotificationScheme::class)->deleteByClientId($clientId);
$screens = UbirimiContainer::get()['repository']->get(Screen::class)->getByClientId($clientId);
while ($screens && ($screen = $screens->fetch_array(MYSQLI_ASSOC))) {
UbirimiContainer::get()['repository']->get(Screen::class)->deleteById($screen['id']);
}
UbirimiContainer::get()['repository']->get(NotificationScheme::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteYongoIssueTypes($clientId);
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteYongoIssueStatuses($clientId);
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteYongoIssueResolutions($clientId);
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteYongoIssuePriorities($clientId);
UbirimiContainer::get()['repository']->get(Field::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(FieldConfiguration::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(FieldConfigurationScheme::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(NotificationScheme::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(NotificationScheme::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(IssueTypeScheme::class)->deleteByClientId($clientId);
UbirimiContainer::get()['repository']->get(IssueTypeScreenScheme::class)->deleteByClientId($clientId);
// delete issue security schemes
$issueSecuritySchemes = UbirimiContainer::get()['repository']->get(IssueSecurityScheme::class)->getByClientId($clientId);
while ($issueSecuritySchemes && ($issueSecurityScheme = $issueSecuritySchemes->fetch_array(MYSQLI_ASSOC))) {
UbirimiContainer::get()['repository']->get(IssueSecurityScheme::class)->deleteById($issueSecurityScheme['id']);
}
$users = UbirimiContainer::get()['repository']->get(UbirimiClient::class)->getUsers($clientId);
if ($users) {
$userIdsArray = array();
while ($user = $users->fetch_array(MYSQLI_ASSOC)) {
$userIdsArray[] = $user['id'];
// delete user avatars
$spaceBasePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_GENERAL_SETTINGS, 'user_avatars');
Util::deleteDir($spaceBasePath . $user['id']);
}
$users_ids_string = implode($userIdsArray, ', ');
$query = 'delete from general_group_data where user_id IN (' . $users_ids_string . ')';
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from permission_role_data where default_user_id IN (' . $users_ids_string . ')';
UbirimiContainer::get()['db.connection']->query($query);
}
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteGroups($clientId);
$query = 'delete from permission_role where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from general_user where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from event where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from client_product where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from client_yongo_settings where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from client_documentator_settings where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from client_smtp_settings where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from client_settings where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from general_log where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
$query = 'delete from sys_permission_global_data where client_id = ' . $clientId;
UbirimiContainer::get()['db.connection']->query($query);
// delete Cheetah Product data
$agileBoards = UbirimiContainer::get()['repository']->get(Board::class)->getByClientId($clientId, 'array');
if ($agileBoards) {
for ($i = 0; $i < count($agileBoards); $i++) {
UbirimiContainer::get()['repository']->get(Board::class)->deleteById($agileBoards[$i]['id']);
}
}
// delete Events Product data
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteCalendars($clientId);
// delete SVN Product data
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteSVNRepositories($clientId);
// delete Documentador Product data
UbirimiContainer::get()['repository']->get(UbirimiClient::class)->deleteSpaces($clientId);
$query = 'delete from client where id = ' . $clientId . ' limit 1';
UbirimiContainer::get()['db.connection']->query($query);
// also delete paymill information
$client = new PaymillClient();
$client->setId($clientData['paymill_id']);
$requestPaymill = new PaymillRequest(UbirimiContainer::get()['paymill.private_key']);
$response = $requestPaymill->delete($client);
$query = "SET FOREIGN_KEY_CHECKS = 1;";
UbirimiContainer::get()['db.connection']->query($query);
}
示例9: deleteFilesByEntityId
public function deleteFilesByEntityId($entityId)
{
$files = Entity::getFilesByEntityId($entityId);
if ($files) {
while ($file = $files->fetch_array(MYSQLI_ASSOC)) {
// delete the revisions
Entity::deleteFileRevisions($file['id']);
}
}
// delete folder from disk
$filelistsPathBase = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'filelists');
Util::deleteDir($filelistsPathBase . $entityId);
// remove file from database
$query = "delete from documentator_entity_file where documentator_entity_id = ?";
if ($stmt = UbirimiContainer::get()['db.connection']->prepare($query)) {
$stmt->bind_param("i", $entityId);
$stmt->execute();
}
}
示例10: deleteByIssueId
public function deleteByIssueId($issueId)
{
$attachments = IssueAttachment::getByIssueId($issueId);
if ($attachments) {
while ($attachment = $attachments->fetch_array(MYSQLI_ASSOC)) {
$attachmentId = $attachment['id'];
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachmentId . '/' . $attachment['name']);
if (Util::isImage(Util::getExtension($attachment['name']))) {
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachmentId . '/thumbs/' . $attachment['name']);
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachmentId . '/thumbs');
}
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachmentId);
}
// also delete the folder
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId)) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId);
}
}
}
示例11: deleteById
public function deleteById($spaceId)
{
$spaceEntities = UbirimiContainer::get()['repository']->get(Entity::class)->getAllBySpaceId($spaceId);
if ($spaceEntities) {
while ($spaceEntity = $spaceEntities->fetch_array(MYSQLI_ASSOC)) {
UbirimiContainer::get()['repository']->get(EntityComment::class)->deleteCommentsByEntityId($spaceEntity['id']);
UbirimiContainer::get()['repository']->get(Entity::class)->removeAsFavouriteForUsers($spaceEntity['id']);
UbirimiContainer::get()['repository']->get(Entity::class)->deleteRevisionsByEntityId($spaceEntity['id']);
UbirimiContainer::get()['repository']->get(Entity::class)->deleteFilesByEntityId($spaceEntity['id']);
UbirimiContainer::get()['repository']->get(EntityAttachment::class)->deleteByEntityId($spaceEntity['id'], $spaceId);
UbirimiContainer::get()['repository']->get(Entity::class)->deleteById($spaceEntity['id']);
// delete any files, if any
$spaceBasePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'filelists');
Util::deleteDir($spaceBasePath . $spaceEntity['id']);
}
}
UbirimiContainer::get()['repository']->get(Space::class)->deletePermissionsBySpaceId($spaceId);
$query = "delete from documentator_space where id = ? limit 1";
if ($stmt = UbirimiContainer::get()['db.connection']->prepare($query)) {
$stmt->bind_param("i", $spaceId);
$stmt->execute();
}
$spaceBasePath = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_DOCUMENTADOR, 'attachments');
Util::deleteDir($spaceBasePath . $spaceId);
}
示例12: manageModalAttachments
public static function manageModalAttachments($issueId, $loggedInUserId, $attachIdsToBeKept)
{
if (null != UbirimiContainer::get()['session']->has('added_attachments_in_screen')) {
$attIdsSession = UbirimiContainer::get()['session']->get('added_attachments_in_screen');
$uploadDirectory = Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId;
for ($i = 0; $i < count($attIdsSession); $i++) {
$attachmentId = $attIdsSession[$i];
$attachment = UbirimiContainer::get()['repository']->get(IssueAttachment::class)->getById($attachmentId);
if (!in_array($attachmentId, $attachIdsToBeKept)) {
// the attachment must be deleted
UbirimiContainer::get()['repository']->get(IssueAttachment::class)->deleteById($attachmentId);
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'] . '/' . $attachment['name'])) {
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'] . '/' . $attachment['name']);
if (Util::isImage(Util::getExtension($attachment['name']))) {
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'] . '/thumbs/' . $attachment['name'])) {
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'] . '/thumbs/' . $attachment['name']);
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'] . '/thumbs');
}
}
}
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id'])) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $attachment['issue_id'] . '/' . $attachment['id']);
}
// deal with the user_ folders
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/' . $attachment['name'])) {
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/' . $attachment['name']);
if (Util::isImage(Util::getExtension($attachment['name']))) {
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/thumbs/' . $attachment['name'])) {
unlink(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/thumbs/' . $attachment['name']);
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/thumbs');
}
}
}
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'])) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id']);
}
} else {
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'] . '/' . $attachment['name'])) {
if (!file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId)) {
// create the moder
mkdir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId);
}
// move the attachment
rename(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId . '/' . $attachment['id'], Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issueId . '/' . $attachment['id']);
// update the attachment
UbirimiContainer::get()['repository']->get(IssueAttachment::class)->updateByIdAndIssueId($attachmentId, $issueId);
}
}
}
if (file_exists($uploadDirectory) && count(scandir($uploadDirectory)) == 2) {
Util::deleteDir($uploadDirectory);
}
if (file_exists(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId)) {
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . 'user_' . $loggedInUserId);
}
}
}
示例13: deleteIssuesByProjectId
public function deleteIssuesByProjectId($projectId)
{
$issues = UbirimiContainer::get()['repository']->get(Issue::class)->getByParameters(array('project' => $projectId));
if ($issues) {
while ($issue = $issues->fetch_array(MYSQLI_ASSOC)) {
// delete issues from disk, if any
Util::deleteDir(Util::getAssetsFolder(SystemProduct::SYS_PRODUCT_YONGO) . $issue['id']);
UbirimiContainer::get()['repository']->get(Issue::class)->deleteById($issue['id']);
}
}
$query = "DELETE IGNORE from yongo_issue WHERE project_id = " . $projectId;
UbirimiContainer::get()['db.connection']->query($query);
}