Skip to content

Commit 4aabecc

Browse files
committed
use the correct namespace
1 parent 3bd5f8a commit 4aabecc

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

lib/StorageServer.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,20 @@ public static function setStorageOwner($storageId, $owner) {
3131

3232
public static function createStorage($ownerWebId) {
3333
$generatedStorageId = bin2hex(random_bytes(16));
34-
while (self::storageIdExists($generatedsStorageId)) {
34+
while (self::storageIdExists($generatedStorageId)) {
3535
$generatedStorageId = bin2hex(random_bytes(16));
3636
}
3737
Db::connect();
3838
$query = Db::$pdo->prepare(
3939
'INSERT OR REPLACE INTO storage VALUES(:storageId, :owner)'
4040
);
4141
$query->execute([
42-
':storageId' => $storageId,
42+
':storageId' => $generatedStorageId,
4343
':owner' => $ownerWebId
4444
]);
45+
return [
46+
"storageId" => $generatedStorageId
47+
];
4548
}
4649

4750
public static function storageIdExists($storageId) {
@@ -78,7 +81,7 @@ public static function getOwnerWebId() {
7881
public static function getFileSystem() {
7982
$storageId = self::getStorageId();
8083
if (!self::storageIdExists($storageId)) {
81-
throw new Exception("Storage does not exist");
84+
throw new \Exception("Storage does not exist");
8285
}
8386
// The internal adapter
8487
$adapter = new \League\Flysystem\Adapter\Local(
@@ -136,7 +139,6 @@ private static function getStorageId() {
136139
return $storageId;
137140
}
138141

139-
140142
public static function initializeStorage() {
141143
$filesystem = self::getFilesystem();
142144
if (!$filesystem->has("/.acl")) {
@@ -182,7 +184,7 @@ public static function initializeStorage() {
182184
public static function generateDefaultAcl() {
183185
$webId = self::getOwnerWebId();
184186
if (!$webId) {
185-
throw new Exception("No owner found for storage");
187+
throw new \Exception("No owner found for storage");
186188
}
187189
$acl = <<< "EOF"
188190
# Root ACL resource for the user account
@@ -216,7 +218,7 @@ public static function generateDefaultAcl() {
216218
public static function generatePublicAppendAcl() {
217219
$webId = self::getOwnerWebId();
218220
if (!$webId) {
219-
throw new Exception("No owner found for storage ID");
221+
throw new \Exception("No owner found for storage ID");
220222
}
221223
$acl = <<< "EOF"
222224
# Inbox ACL resource for the user account
@@ -248,7 +250,7 @@ public static function generatePublicAppendAcl() {
248250
public static function generatePublicReadAcl() {
249251
$webId = self::getOwnerWebId();
250252
if (!$webId) {
251-
throw new Exception("No owner found for storage ID");
253+
throw new \Exception("No owner found for storage ID");
252254
}
253255
$acl = <<< "EOF"
254256
# Inbox ACL resource for the user account

0 commit comments

Comments
 (0)