forked from joomla/super-powers
Update 2024-09-12 07:06:13
This commit is contained in:
parent
65a2f83ed1
commit
eb51db9f03
@ -16,9 +16,12 @@ class Manager << (F,LightGreen) >> #RoyalBlue {
|
||||
# Items $items
|
||||
# Type $type
|
||||
# Handler $handler
|
||||
# string $table
|
||||
+ __construct(Item $item, Items $items, ...)
|
||||
+ upload(string $guid, string $entity, ...) : void
|
||||
+ delete(string $guid, string $entity, ...) : void
|
||||
+ table(string $table) : self
|
||||
+ getTable() : string
|
||||
# modelFileDetails(array $details, string $guid, ...) : object
|
||||
}
|
||||
|
||||
@ -58,6 +61,20 @@ note right of Manager::delete
|
||||
string $target
|
||||
end note
|
||||
|
||||
note right of Manager::table
|
||||
Set the current active table
|
||||
|
||||
since: 5.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of Manager::getTable
|
||||
Get the current active table
|
||||
|
||||
since: 5.0.2
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Manager::modelFileDetails
|
||||
model the file details to store in the file table
|
||||
|
||||
|
@ -66,6 +66,14 @@ final class Manager
|
||||
*/
|
||||
protected Handler $handler;
|
||||
|
||||
/**
|
||||
* Table Name
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $table = 'file';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -120,7 +128,7 @@ final class Manager
|
||||
}
|
||||
|
||||
// store file in the file table
|
||||
$this->item->set(
|
||||
$this->item->table($this->getTable())->set(
|
||||
$this->modelFileDetails($details, $guid, $entity, $target)
|
||||
);
|
||||
}
|
||||
@ -140,6 +148,32 @@ final class Manager
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current active table
|
||||
*
|
||||
* @param string $table The table that should be active
|
||||
*
|
||||
* @return self
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function table(string $table): self
|
||||
{
|
||||
$this->table = $table;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* model the file details to store in the file table
|
||||
*
|
||||
@ -156,12 +190,12 @@ final class Manager
|
||||
return (object) [
|
||||
'name' => $details['name'],
|
||||
'file_type' => $guid,
|
||||
'ext' => 'me',
|
||||
'size_kb' => 45,
|
||||
'ext' => $details['extension'] ?? 'error',
|
||||
'size_kb' => $details['size'] ?? 0,
|
||||
'filepath' => $details['full_path'],
|
||||
'entity_type' => $target,
|
||||
'entity' => $entity,
|
||||
'guid' => $this->getGuid('file'),
|
||||
'guid' => $this->getGuid('guid'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,14 @@
|
||||
*/
|
||||
protected Handler $handler;
|
||||
|
||||
/**
|
||||
* Table Name
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $table = 'file';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -91,7 +99,7 @@
|
||||
}
|
||||
|
||||
// store file in the file table
|
||||
$this->item->set(
|
||||
$this->item->table($this->getTable())->set(
|
||||
$this->modelFileDetails($details, $guid, $entity, $target)
|
||||
);
|
||||
}
|
||||
@ -111,6 +119,32 @@
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current active table
|
||||
*
|
||||
* @param string $table The table that should be active
|
||||
*
|
||||
* @return self
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function table(string $table): self
|
||||
{
|
||||
$this->table = $table;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
/**
|
||||
* model the file details to store in the file table
|
||||
*
|
||||
@ -127,11 +161,11 @@
|
||||
return (object) [
|
||||
'name' => $details['name'],
|
||||
'file_type' => $guid,
|
||||
'ext' => 'me',
|
||||
'size_kb' => 45,
|
||||
'ext' => $details['extension'] ?? 'error',
|
||||
'size_kb' => $details['size'] ?? 0,
|
||||
'filepath' => $details['full_path'],
|
||||
'entity_type' => $target,
|
||||
'entity' => $entity,
|
||||
'guid' => $this->getGuid('file'),
|
||||
'guid' => $this->getGuid('guid'),
|
||||
];
|
||||
}
|
@ -240,7 +240,7 @@ abstract class UploadHelper
|
||||
$upload_path = Path::clean($upload['full_path']);
|
||||
|
||||
// Get file extension/format
|
||||
$format = MimeHelper::extension($upload_path);
|
||||
$upload['extension'] = $format = MimeHelper::extension($upload_path);
|
||||
|
||||
// Legal file formats
|
||||
$legal = [];
|
||||
|
@ -211,7 +211,7 @@
|
||||
$upload_path = Path::clean($upload['full_path']);
|
||||
|
||||
// Get file extension/format
|
||||
$format = MimeHelper::extension($upload_path);
|
||||
$upload['extension'] = $format = MimeHelper::extension($upload_path);
|
||||
|
||||
// Legal file formats
|
||||
$legal = [];
|
||||
|
Loading…
Reference in New Issue
Block a user