当前位置: 首页>>代码示例>>PHP>>正文


PHP FileSystem::delete_folder方法代码示例

本文整理汇总了PHP中Cx\Lib\FileSystem\FileSystem::delete_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem::delete_folder方法的具体用法?PHP FileSystem::delete_folder怎么用?PHP FileSystem::delete_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cx\Lib\FileSystem\FileSystem的用法示例。


在下文中一共展示了FileSystem::delete_folder方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Execute this command
  * @param array $arguments Array of commandline arguments
  */
 public function execute(array $arguments)
 {
     if (!$this->interface->yesNo('Removing workbench requires re-installing workbench to use it again. Are you sure?')) {
         return;
     }
     // Remove component from Db and FileSystem
     $component = new \Cx\Core\Core\Model\Entity\ReflectionComponent('Workbench', 'core_module');
     $component->remove();
     // Remove additional files (config, command line script)
     foreach ($this->interface->getWorkbench()->getFileList() as $file) {
         if (is_dir($file)) {
             \Cx\Lib\FileSystem\FileSystem::delete_folder(ASCMS_DOCUMENT_ROOT . $file, true);
         } else {
             \Cx\Lib\FileSystem\FileSystem::delete_file(ASCMS_DOCUMENT_ROOT . $file);
         }
     }
     $this->interface->show('Done');
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:22,代码来源:RemoveCommand.class.php

示例2: cleanTempPaths

 public function cleanTempPaths()
 {
     $dirs = array();
     if ($dh = opendir(ASCMS_TEMP_PATH)) {
         while (($file = readdir($dh)) !== false) {
             if (is_dir(ASCMS_TEMP_PATH . '/' . $file)) {
                 $dirs[] = $file;
             }
         }
         closedir($dh);
     }
     $sessionPaths = preg_grep('#^' . $this->sessionPathPrefix . '[0-9A-F]{32}$#i', $dirs);
     $sessions = array();
     $query = 'SELECT `sessionid` FROM `' . DBPREFIX . 'sessions`';
     $objResult = $this->_objDb->Execute($query);
     while (!$objResult->EOF) {
         $sessions[] = $objResult->fields['sessionid'];
         $objResult->MoveNext();
     }
     foreach ($sessionPaths as $sessionPath) {
         if (!in_array(substr($sessionPath, strlen($this->sessionPathPrefix)), $sessions)) {
             \Cx\Lib\FileSystem\FileSystem::delete_folder(ASCMS_TEMP_WEB_PATH . '/' . $sessionPath, true);
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:25,代码来源:session.class.php

示例3: cleanTempPaths

 /**
  * Clear temp path's which are not in use
  */
 public function cleanTempPaths()
 {
     $dirs = array();
     if ($dh = opendir(ASCMS_TEMP_PATH)) {
         while (($file = readdir($dh)) !== false) {
             if (is_dir(ASCMS_TEMP_PATH . '/' . $file)) {
                 $dirs[] = $file;
             }
         }
         closedir($dh);
     }
     // depending on the php setting session.hash_function and session.hash_bits_per_character
     // the length of the session-id varies between 22 and 40 characters.
     $sessionPaths = preg_grep('#^' . $this->sessionPathPrefix . '[0-9A-Z,-]{22,40}$#i', $dirs);
     $sessions = array();
     $query = 'SELECT `sessionid` FROM `' . DBPREFIX . 'sessions`';
     $objResult = \Env::get('db')->Execute($query);
     while (!$objResult->EOF) {
         $sessions[] = $objResult->fields['sessionid'];
         $objResult->MoveNext();
     }
     foreach ($sessionPaths as $sessionPath) {
         if (!in_array(substr($sessionPath, strlen($this->sessionPathPrefix)), $sessions)) {
             \Cx\Lib\FileSystem\FileSystem::delete_folder(ASCMS_TEMP_WEB_PATH . '/' . $sessionPath, true);
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:30,代码来源:session32.class.php

示例4: doFlush

 /**
  * {@inheritdoc}
  */
 protected function doFlush()
 {
     foreach (new \DirectoryIterator($this->directory) as $file) {
         if ($file->isDir() && !$file->isDot()) {
             \Cx\Lib\FileSystem\FileSystem::delete_folder(str_replace('\\', '/', $file->getPath() . '/' . $file->getFilename()), true);
         }
     }
     return true;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:12,代码来源:FileSystemCache.class.php

示例5: cleanup

 protected function cleanup()
 {
     \Cx\Lib\FileSystem\FileSystem::delete_folder($this->cx->getWebsiteTempPath() . '/workbench', true);
     \Cx\Lib\FileSystem\FileSystem::make_folder($this->cx->getWebsiteTempPath() . '/workbench');
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:5,代码来源:DbCommand.class.php

示例6: delete

 /**
  * delete the file or directory
  * 
  * @param array $params supplied arguments from JsonData-request
  * @return string
  */
 public function delete($params)
 {
     global $_ARRAYLANG, $objInit;
     $operation = isset($params['post']['reset']) && !empty($params['post']['reset']) ? 'RESET' : 'DELETE';
     $_ARRAYLANG = $objInit->loadLanguageData('ViewManager');
     if (empty($params['post']['themes']) || empty($params['post']['themesPage'])) {
         return array('status' => 'error', 'message' => $_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_EMPTY_PARAMS']);
     }
     $filePath = $params['post']['themesPage'];
     $currentThemeFolder = \Env::get('cx')->getWebsiteThemesPath() . '/' . $params['post']['themes'] . '/';
     $pathStripped = ltrim($params['post']['themesPage'], '/');
     if (empty($pathStripped)) {
         return array('status' => 'error', 'message' => $_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_EMPTY_PARAMS']);
     }
     if (!\Cx\Lib\FileSystem\FileSystem::exists($currentThemeFolder . $filePath) && \Cx\Core\ViewManager\Controller\ViewManager::isFileTypeComponent($filePath)) {
         // resolve the component file
         $componentFilePath = \Cx\Core\ViewManager\Controller\ViewManager::getComponentFilePath($filePath, false);
         if ($componentFilePath && \Cx\Lib\FileSystem\FileSystem::exists($currentThemeFolder . $componentFilePath)) {
             // file exists
             $filePath = \Cx\Core\ViewManager\Controller\ViewManager::getComponentFilePath($filePath, false);
         } else {
             // file not exists may be a folder
             $filePath = \Cx\Core\ViewManager\Controller\ViewManager::replaceComponentFolderByItsType($filePath);
         }
     }
     if (\Cx\Lib\FileSystem\FileSystem::exists($currentThemeFolder . $filePath)) {
         if (is_dir($currentThemeFolder . $filePath)) {
             $status = \Cx\Lib\FileSystem\FileSystem::delete_folder($currentThemeFolder . $filePath, true);
             $succesMessage = sprintf($_ARRAYLANG['TXT_THEME_FOLDER_' . $operation . '_SUCCESS'], contrexx_input2xhtml($pathStripped));
         } else {
             $status = \Cx\Lib\FileSystem\FileSystem::delete_file($currentThemeFolder . $filePath);
             $succesMessage = sprintf($_ARRAYLANG['TXT_THEME_FILE_' . $operation . '_SUCCESS'], contrexx_input2xhtml($pathStripped));
         }
         if (!$status) {
             return array('status' => 'error', 'reload' => false, 'message' => $_ARRAYLANG['TXT_THEME_' . $operation . '_FAILED']);
         }
         return array('status' => 'success', 'reload' => true, 'message' => $succesMessage);
     }
     return array('status' => 'error', 'reload' => false, 'message' => sprintf($_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_FILE_NOT_EXITS'], contrexx_input2xhtml($filePath)));
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:46,代码来源:JsonViewManager.class.php

示例7: applyDelta

 /**
  * Get the serialized Delta
  * 
  * This loads the serialized Delta and calls applyNext() on it 
  * until returns false.
  * 
  * @return null
  */
 public function applyDelta()
 {
     //Check if any of the update process is interrupt state, then rollback to old state
     $deltaRepository = new \Cx\Core_Modules\Update\Model\Repository\DeltaRepository();
     $deltas = $deltaRepository->findAll();
     if (empty($deltas)) {
         return;
     }
     asort($deltas);
     //set the website as Offline mode
     \Cx\Core\Setting\Controller\Setting::init('MultiSite', '', 'FileSystem');
     \Cx\Core\Setting\Controller\Setting::set('websiteState', \Cx\Core_Modules\MultiSite\Model\Entity\Website::STATE_OFFLINE);
     \Cx\Core\Setting\Controller\Setting::update('websiteState');
     $status = true;
     $yamlFile = null;
     foreach ($deltas as $delta) {
         $status = $delta->applyNext();
         $delta->setRollback($delta->getRollback() ? false : true);
         $deltaRepository->flush();
         if (!$status) {
             //Rollback to old state
             $this->rollBackDelta();
             //Rollback the codebase changes(settings.php, configuration.php and website codebase in manager and service)
             $yamlFile = $this->cx->getWebsiteTempPath() . '/Update/' . $this->pendingCodeBaseChangesYml;
             if (file_exists($yamlFile)) {
                 $pendingCodeBaseChanges = $this->getUpdateWebsiteDetailsFromYml($yamlFile);
                 $oldCodeBase = $pendingCodeBaseChanges['PendingCodeBaseChanges']['oldCodeBaseId'];
                 $latestCodeBase = $pendingCodeBaseChanges['PendingCodeBaseChanges']['latestCodeBaseId'];
                 //Register YamlSettingEventListener
                 \Cx\Core\Config\Controller\ComponentController::registerYamlSettingEventListener();
                 //Update codeBase in website
                 $this->updateCodeBase($latestCodeBase, null, $oldCodeBase);
                 //Update website codebase in manager and service
                 \Cx\Core\Setting\Controller\Setting::init('MultiSite', '', 'FileSystem');
                 $websiteName = \Cx\Core\Setting\Controller\Setting::getValue('websiteName', 'MultiSite');
                 $params = array('websiteName' => $websiteName, 'codeBase' => $oldCodeBase);
                 \Cx\Core_Modules\MultiSite\Controller\JsonMultiSiteController::executeCommandOnMyServiceServer('updateWebsiteCodeBase', $params);
             }
             break;
         }
     }
     //Remove the folder '/tmp/Update', After the completion of rollback or Non-rollback process
     $tmpUpdateFolderPath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteTempPath() . '/Update';
     if (file_exists($tmpUpdateFolderPath)) {
         \Cx\Lib\FileSystem\FileSystem::delete_folder($tmpUpdateFolderPath, true);
     }
     //set the website back to Online mode
     \Cx\Core\Setting\Controller\Setting::set('websiteState', \Cx\Core_Modules\MultiSite\Model\Entity\Website::STATE_ONLINE);
     \Cx\Core\Setting\Controller\Setting::update('websiteState');
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:58,代码来源:UpdateController.class.php

示例8: removeFile

 public function removeFile(File $file)
 {
     global $_ARRAYLANG;
     $filename = $file->getFullName();
     $strPath = $file->getPath();
     if (!empty($filename) && !empty($strPath)) {
         if (is_dir($this->getFullPath($file) . $filename)) {
             if (\Cx\Lib\FileSystem\FileSystem::delete_folder($this->getFullPath($file) . $filename, true)) {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_DIRECTORY_SUCCESSFULLY_REMOVED'], $filename);
             } else {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_DIRECTORY_UNSUCCESSFULLY_REMOVED'], $filename);
             }
         } else {
             if (\Cx\Lib\FileSystem\FileSystem::delete_file($this->getFullPath($file) . $filename)) {
                 $this->removeThumbnails($file);
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_SUCCESSFULLY_REMOVED'], $filename);
             } else {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_REMOVED'], $filename);
             }
         }
     }
     return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_REMOVED'], $filename);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:23,代码来源:LocalFileSystem.class.php

示例9: deleteDirectory

 /**
  * Delete Selected Folder and its contents recursively upload form
  *
  * @global     array    $_ARRAYLANG
  * @param      string   $dirName
  * @return     boolean  true if directory and its contents deleted successfully and false if it failed
  */
 private function deleteDirectory($dirName)
 {
     global $_ARRAYLANG;
     try {
         \Cx\Lib\FileSystem\FileSystem::delete_folder($dirName, true);
         \Message::ok($_ARRAYLANG['TXT_MEDIA_FOLDER_DELETED_SUCESSFULLY']);
     } catch (\Cx\Lib\FileSystem\FileSystemException $e) {
         \DBG::msg($e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:19,代码来源:Media.class.php

示例10: remove

 /**
  * Removes this component
  * 
  * This might not work perfectly for legacy components, since there could
  * be files outside the component's directory!
  * Be sure there is no other component relying on this one!
  */
 public function remove()
 {
     // remove from db
     $this->removeFromDb();
     // if there are no files, quit
     if (!$this->exists()) {
         return;
     }
     // remove from fs
     \Cx\Lib\FileSystem\FileSystem::delete_folder($this->getDirectory(), true);
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:18,代码来源:ReflectionComponent.class.php

示例11: notifyCallback

 /**
  * Notifies the callback. Invoked on upload completion.
  */
 public function notifyCallback()
 {
     //temporary path where files were uploaded
     $tempDir = '/upload_' . $this->uploadId;
     $tempPath = $_SESSION->getTempPath() . $tempDir;
     $tempWebPath = $_SESSION->getWebTempPath() . $tempDir;
     //we're going to call the callbck, so the data is not needed anymore
     //well... not quite sure. need it again in contact form.
     //TODO: code session cleanup properly if time.
     //$this->cleanupCallbackData();
     $classFile = $this->callbackData[0];
     //call the callback, get return code
     if ($classFile != null) {
         if (!file_exists($classFile)) {
             throw new UploaderException("Class file '{$classFile}' specified for callback does not exist!");
         }
         require_once $this->callbackData[0];
     }
     $originalFileNames = array();
     if (isset($_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'])) {
         $originalFileNames = $_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames'];
     }
     //various file infos are passed via this array
     $fileInfos = array('originalFileNames' => $originalFileNames);
     $response = null;
     //the response data.
     if (isset($_SESSION['upload']['handlers'][$this->uploadId]['response_data'])) {
         $response = UploadResponse::fromSession($_SESSION['upload']['handlers'][$this->uploadId]['response_data']);
     } else {
         $response = new UploadResponse();
     }
     $ret = call_user_func(array($this->callbackData[1], $this->callbackData[2]), $tempPath, $tempWebPath, $this->getData(), $this->uploadId, $fileInfos, $response);
     //clean up session: we do no longer need the array with the original file names
     unset($_SESSION['upload']['handlers'][$this->uploadId]['originalFileNames']);
     //same goes for the data
     //if(isset($_SESSION['upload']['handlers'][$this->uploadId]['data']))
     // TODO: unset this when closing the uploader dialog, but not before
     //            unset($_SESSION['upload']['handlers'][$this->uploadId]['data']);
     if (\Cx\Lib\FileSystem\FileSystem::exists($tempWebPath)) {
         //the callback could have returned a path where he wants the files moved to
         // check that $ret[1] is not empty is VERY important!!!
         if (!is_null($ret) && !empty($ret[1])) {
             //we need to move the files
             //gather target information
             $path = pathinfo($ret[0]);
             $pathWeb = pathinfo($ret[1]);
             //make sure the target directory is writable
             \Cx\Lib\FileSystem\FileSystem::makeWritable($pathWeb['dirname'] . '/' . $path['basename']);
             //revert $path and $pathWeb to whole path instead of pathinfo path for copying
             $path = $path['dirname'] . '/' . $path['basename'] . '/';
             $pathWeb = $pathWeb['dirname'] . '/' . $pathWeb['basename'] . '/';
             //trailing slash needed for File-class calls
             $tempPath .= '/';
             $tempWebPath .= '/';
             //move everything uploaded to target dir
             $h = opendir($tempPath);
             $im = new \ImageManager();
             while (false != ($f = readdir($h))) {
                 //skip . and ..
                 if ($f == '.' || $f == '..') {
                     continue;
                 }
                 //TODO: if return value = 'error' => react
                 \Cx\Lib\FileSystem\FileSystem::move($tempWebPath . $f, $pathWeb . $f, true);
                 if ($im->_isImage($path . $f)) {
                     $im->_createThumb($path, $pathWeb, $f);
                 }
                 $response->increaseUploadedFilesCount();
             }
             closedir($h);
         } else {
             // TODO: what now????
         }
         //delete the folder
         \Cx\Lib\FileSystem\FileSystem::delete_folder($tempWebPath, true);
     } else {
         // TODO: output error message to user that no files had been uploaded!!!
     }
     $response->uploadFinished();
     $_SESSION['upload']['handlers'][$this->uploadId]['response_data'] = $response->toSessionValue();
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:84,代码来源:Uploader.class.php

示例12: removeFile

 public function removeFile(File $file)
 {
     global $_ARRAYLANG;
     if ($file->getExtension() == '' && is_dir($this->rootPath . ltrim($file->getPath(), '.') . '/' . $file->getName())) {
         $filename = $file->getName();
     } else {
         $filename = $file->getName() . '.' . $file->getExtension();
     }
     $strPath = $file->getPath();
     if (!empty($filename) && !empty($strPath)) {
         if (is_dir($this->rootPath . ltrim($file->getPath(), '.') . '/' . $file->getName())) {
             if (\Cx\Lib\FileSystem\FileSystem::delete_folder($this->rootPath . $strPath . $filename, true)) {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_DIRECTORY_SUCCESSFULLY_REMOVED'], $filename);
             } else {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_DIRECTORY_UNSUCCESSFULLY_REMOVED'], $filename);
             }
         } else {
             if (\Cx\Lib\FileSystem\FileSystem::delete_file($this->rootPath . '/' . $strPath . '/' . $filename)) {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_SUCCESSFULLY_REMOVED'], $filename);
             } else {
                 return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_REMOVED'], $filename);
             }
         }
     }
     return sprintf($_ARRAYLANG['TXT_FILEBROWSER_FILE_UNSUCCESSFULLY_REMOVED'], $filename);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:26,代码来源:LocalFileSystem.class.php


注:本文中的Cx\Lib\FileSystem\FileSystem::delete_folder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。