Esempio n. 1
0
 public function createRequest(Application $aApp)
 {
     $aReq = new HttpRequest();
     // 访问入口
     Folder::singleton()->find('/')->setHttpUrl(dirname($aReq->urlPath()));
     return $aReq;
 }
Esempio n. 2
0
 /**
  * @return org\jecat\framework\lang\oop\Package
  */
 public function compiledPackage()
 {
     if (!$this->aCompiledPackage) {
         $sFolderPath = $this->sCompiledFolderPath . '/' . $this->strategySignature();
         $aFolder = Folder::singleton()->findFolder($sFolderPath, Folder::FIND_AUTO_CREATE);
         $this->aCompiledPackage = new Package('', $aFolder);
     }
     return $this->aCompiledPackage;
 }
Esempio n. 3
0
 public function moveToStoreFolder()
 {
     if (empty($this->aStoreFolder)) {
         throw new Exception("非法的路径属性,无法依赖此路径属性创建对应的文件夹对象");
     }
     if (!$this->aStoreFolder->exists()) {
         $this->aStoreFolder = $this->aStoreFolder->create();
     }
     // 保存文件
     $sSavedFile = $this->aAchiveStrategy->makeFilePath($this->arrUploadedFile);
     $sSavedFolderPath = $this->aStoreFolder->path() . $sSavedFile;
     // 创建保存目录
     $aFolderOfSavedFile = new Folder($sSavedFolderPath);
     if (!$aFolderOfSavedFile->exists()) {
         if (!$aFolderOfSavedFile->create()) {
             throw new Exception(__CLASS__ . "的" . __METHOD__ . "在创建路径\"%s\"时出错", array($aFolderOfSavedFile->path()));
         }
     }
     $sFileName = $this->aAchiveStrategy->makeFilename($this->arrUploadedFile);
     $sSavedFullPath = $this->aStoreFolder->path() . $sSavedFile . $sFileName;
     move_uploaded_file($this->arrUploadedFile['tmp_name'], $sSavedFullPath);
     $aSavedFile = new FsFile($sSavedFullPath);
     $aSavedFile->setHttpUrl($this->aStoreFolder->httpUrl() . $sSavedFile . $sFileName);
     $this->setValue($aSavedFile);
     return $aSavedFile;
 }
Esempio n. 4
0
 /**
  * Enter description here ...
  *
  * @return bool
  */
 public function clear()
 {
     return Folder::createInstance($this->sFolderPrefix)->delete(true, true);
 }
Esempio n. 5
0
 /**
  * @return org\jecat\framework\resrc\ResourceManager
  */
 public function publicFolders()
 {
     if (!$this->aPublicFolders) {
         $this->aPublicFolders = new ResourceManager();
         $aFolder = new Folder(\org\jecat\framework\PATH . '/public');
         $aFolder->setHttpUrl('framework/public');
         if (!$aFolder->exists()) {
             throw new Exception("目录 /framework/public 丢失,无法提供该目录下的文件");
         }
         $this->aPublicFolders->addFolder($aFolder, 'org.jecat.framework');
     }
     return $this->aPublicFolders;
 }
Esempio n. 6
0
 /**
  * @param serialized
  */
 public function unserialize($serialized)
 {
     $this->aKeyFolder = Folder::singleton()->findFolder($serialized, Folder::FIND_AUTO_CREATE);
 }
Esempio n. 7
0
 /**
  * @return use org\jecat\framework\setting\Setting;
  */
 public function createSetting()
 {
     if (!($aSettingFolder = Folder::singleton()->findFolder("/settings", Folder::FIND_AUTO_CREATE))) {
         throw new Exception("无法在目录 /setting 中建立系统配置");
     }
     return new FsSetting($aSettingFolder);
 }
Esempio n. 8
0
 public function createChildFolder($sPath, $nFlag = Folder::CREATE_DEFAULT)
 {
     if (!($nFlag & FSO::CLEAN_PATH)) {
         $sPath = $this->path() . '/' . $sPath;
         // FSO::tidyPath($sPath,true) ;
     }
     if (is_file($sPath)) {
         throw new Exception('试图创建folder,但由于存在同名file无法创建: %s', $sPath);
     } else {
         $aFolder = new Folder($sPath, self::CLEAN_PATH);
         // 如果文件不存在,且没有要求 self::CREATE_ONLY_OBJECT ,则创建之
         if (!($nFlag & self::CREATE_ONLY_OBJECT) and !$aFolder->exists()) {
             if (!$aFolder->create($nFlag)) {
                 throw new Exception('无法创建目录:%s', $sPath);
             }
         }
     }
     return $aFolder;
 }
Esempio n. 9
0
 public static function createFromPath($sFolderPath)
 {
     return new self(Folder::createFolder($sFolderPath));
 }