Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 2011e00

Browse files
committed
Making sure node metadata for file info is valid for a deleted file #1127
1 parent e8084be commit 2011e00

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

core/src/plugins/access.fs/class.fsAccessDriver.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,17 +1822,23 @@ public function delete($selectedFiles, &$logMessages)
18221822
return $mess[120];
18231823
}
18241824
$fileToDelete=$this->urlBase.$selectedFile;
1825+
18251826
if (!file_exists($fileToDelete)) {
18261827
$logMessages[]=$mess[100]." ".SystemTextEncoding::toUTF8($selectedFile);
18271828
continue;
18281829
}
1830+
1831+
$node = new AJXP_Node($fileToDelete);
1832+
$node->setLeaf(!is_dir($fileToDelete));
1833+
18291834
$this->deldir($fileToDelete, $repoData);
1830-
if (is_dir($fileToDelete)) {
1835+
1836+
if ($node->isLeaf()) {
18311837
$logMessages[]="$mess[38] ".SystemTextEncoding::toUTF8($selectedFile)." $mess[44].";
18321838
} else {
18331839
$logMessages[]="$mess[34] ".SystemTextEncoding::toUTF8($selectedFile)." $mess[44].";
18341840
}
1835-
AJXP_Controller::applyHook("node.change", array(new AJXP_Node($fileToDelete)));
1841+
AJXP_Controller::applyHook("node.change", [$node]);
18361842
}
18371843
return null;
18381844
}

core/src/plugins/core.mailer/class.AjxpMailer.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ public function mailConsumeQueue ($action, $httpVars, $fileVars) {
7676
$ajxpAction = $ajxpNotification->getAction();
7777
$ajxpAuthor = $ajxpNotification->getAuthor();
7878
$ajxpNode = new AJXP_Node($value['url']);
79+
7980
try{
8081
@$ajxpNode->loadNodeInfo();
81-
}catch(Exception $e){}
82+
} catch(Exception $e) {
83+
// do nothing
84+
}
85+
8286
if ($ajxpNode->isLeaf() && !$ajxpNode->isRoot()) {
8387
$ajxpContent = $ajxpNode->getParent()->getPath();
8488
} else {
@@ -87,20 +91,24 @@ public function mailConsumeQueue ($action, $httpVars, $fileVars) {
8791
$ajxpContent = '/';
8892
}
8993
}
90-
if($ajxpNode->getRepository() != null){
94+
if($ajxpNode->getRepository() != null) {
9195
$ajxpNodeWorkspace = $ajxpNode->getRepository()->getDisplay();
92-
}else{
96+
} else {
9397
$ajxpNodeWorkspace = "Deleted Workspace";
9498
}
99+
95100
$recipientFormats[$value['recipient']] = ($value["html"] == 1);
96101
$ajxpKey = $ajxpAction."|".$ajxpAuthor."|".$ajxpContent;
97102
$arrayResultsSQL[$value['recipient']][$ajxpNodeWorkspace][$ajxpKey][] = $ajxpNotification;
98103
}
99104
//this $body must be here because we need this css
100105
$digestTitle = ConfService::getMessages()["core.mailer.9"];
106+
101107
foreach ($arrayResultsSQL as $recipient => $arrayWorkspace) {
108+
102109
$useHtml = $recipientFormats[$recipient];
103110
$body = $useHtml ? "<div id='digest'>" : "";
111+
104112
foreach ($arrayWorkspace as $workspace => $arrayAjxpKey) {
105113
$key = key($arrayAjxpKey);
106114
$body = $body . '<h1>' . $arrayAjxpKey[$key][0]->getDescriptionLocation() . ', </h1><ul>';
@@ -120,6 +128,7 @@ public function mailConsumeQueue ($action, $httpVars, $fileVars) {
120128
}
121129
$body = $body . '</ul>';
122130
}
131+
123132
$body .= $useHtml ? "</div>" : "";
124133
try {
125134
$mailer->sendMail(array($recipient),
@@ -134,6 +143,7 @@ public function mailConsumeQueue ($action, $httpVars, $fileVars) {
134143
$output["error"][] = "Sending email to ".$recipient.": ".$e->getMessage();
135144
}
136145
}
146+
137147
try {
138148
dibi::query('DELETE FROM [ajxp_mail_queue] WHERE [date_event] <= %s', $time);
139149
} catch (DibiException $e) {

core/src/plugins/core.notifications/class.AJXP_Notification.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ public function getDescriptionLong($skipLink = false)
201201
$tpl .= "</ul>";
202202

203203
} else {
204-
205204
$tpl .= $this->replaceVars($mess["notification.tpl.long.".($this->getNode()->isLeaf()?"file":"folder").".".$this->action], $mess);
206205

207206
}

0 commit comments

Comments
 (0)