summaryrefslogtreecommitdiff
path: root/framework/Web/Services/TAssetService.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Services/TAssetService.php')
-rw-r--r--framework/Web/Services/TAssetService.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/framework/Web/Services/TAssetService.php b/framework/Web/Services/TAssetService.php
new file mode 100644
index 00000000..914aa1a5
--- /dev/null
+++ b/framework/Web/Services/TAssetService.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+<module id="asset" PrivateLocation="xxx" PublicLocation="xxx" BaseUrl="xxx" />
+ */
+class TAssetManager extends TComponent implements IModule
+{
+ private $_pubDir=null;
+ private $_pubUrl=null;
+
+ public function init($context)
+ {
+ if(is_null($this->_pubDir))
+ throw new TCongiruationException('cache_public_location_required');
+ if(is_null($this->_pubUrl))
+ throw new TCongiruationException('cache_public_url_required');
+ }
+
+ public function getPublicLocation()
+ {
+ return $this->_pubDir;
+ }
+
+ public function setPublicLocation($value)
+ {
+ if(is_dir($value))
+ $this->_pubDir=realpath($value);
+ else
+ throw new TInvalidDataValueException('cache_public_location_invalid');
+ }
+
+ public function getPublicUrl()
+ {
+ return $this->_pubUrl;
+ }
+
+ public function setPublicUrl($value)
+ {
+ $this->_pubUrl=rtrim($value,'/');
+ }
+
+ public function publishLocation($path,$forceOverwrite=false)
+ {
+ $name=basename($path);
+ $prefix=md5(dirname($path));
+ }
+
+ public function publishFile($path,$forceOverwrite=false)
+ {
+ if(($fullpath=realpath($path))!==false)
+ {
+ return $this->_pubUrl.'/'.$fullpath;
+ }
+ else
+ throw new TInvalidDataValueException('cachemanager_path_unpublishable');
+ }
+
+ public function unpublishPath($path)
+ {
+ }
+}
+
+class TMemcache extends TComponent
+{
+}
+
+class TSqliteCache extends TComponent
+{
+}
+?> \ No newline at end of file