本文整理汇总了PHP中Ubirimi\Util::deleteDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::deleteDir方法的具体用法?PHP Util::deleteDir怎么用?PHP Util::deleteDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ubirimi\Util
的用法示例。
在下文中一共展示了Util::deleteDir方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$attachmentId = $request->request->get('att_id');
$attachment = $this->getRepository(IssueAttachment::class)->getById($attachmentId);
$this->getRepository(IssueAttachment::class)->deleteById($attachmentId);
$pathToAttachment = UbirimiContainer::get()['asset.root_folder'] . UbirimiContainer::get()['asset.yongo_issue_attachments'];
unlink($pathToAttachment . $attachment['issue_id'] . '/' . $attachment['id'] . '/' . $attachment['name']);
if (Util::isImage(Util::getExtension($attachment['name']))) {
unlink($pathToAttachment . $attachment['issue_id'] . '/' . $attachment['id'] . '/thumbs/' . $attachment['name']);
Util::deleteDir($pathToAttachment . $attachment['issue_id'] . '/' . $attachment['id'] . '/thumbs');
}
Util::deleteDir($pathToAttachment . $attachment['issue_id'] . '/' . $attachment['id']);
// delete the issue folder if necessary
if (2 == count(scandir($pathToAttachment . $attachment['issue_id']))) {
Util::deleteDir($pathToAttachment . $attachment['issue_id']);
}
return new Response('');
}
示例2: 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('');
}
示例3: 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('');
}
示例4: 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();
}
}
示例5: 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);
}
示例6: 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();
}
}
示例7: 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);
}
}
}
示例8: 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);
}
示例9: 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);
}
}
}
示例10: 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);
}