Skip to content

Commit 32867b1

Browse files
Move delete logic to the License class
1 parent 726e398 commit 32867b1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

config/areas/system/dialogs.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,7 @@
7474
];
7575
},
7676
'submit' => function () {
77-
$kirby = App::instance();
78-
$license = $kirby->system()->license();
79-
$file = $license->root();
80-
81-
if (F::exists($file) === true) {
82-
return F::remove($file);
83-
}
84-
77+
App::instance()->system()->license()->delete();
8578
return true;
8679
}
8780
],

src/Cms/License.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ public function date(
101101
return $this->date !== null ? Str::date(strtotime($this->date), $format, $handler) : null;
102102
}
103103

104+
/**
105+
* Deletes the license file if it exists.
106+
*/
107+
public function delete(): bool
108+
{
109+
return F::remove($this->root());
110+
}
111+
104112
/**
105113
* Returns the activation domain if available
106114
*/

0 commit comments

Comments
 (0)