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


PHP FileManager::rmtree方法代码示例

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


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

示例1: cleanup

 /**
  * Clean up after a deposit, i.e. removing all created files.
  */
 function cleanup()
 {
     import('file.FileManager');
     $fileManager = new FileManager();
     $fileManager->rmtree($this->outPath);
 }
开发者ID:reedstrm,项目名称:ojs,代码行数:9,代码来源:OJSSwordDeposit.inc.php

示例2: deleteSchedConf

 /**
  * Delete a scheduled conference.
  * @param $args array first parameter is the ID of the scheduled conference to delete
  */
 function deleteSchedConf($args)
 {
     $this->validate();
     $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $schedConfId = $args[0];
         $schedConf =& $schedConfDao->getSchedConf($schedConfId);
         // Look up the scheduled conference path before we delete the scheduled conference.
         import('file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $schedConfFilesPath = $publicFileManager->getSchedConfFilesPath($schedConfId);
         if ($schedConfDao->deleteSchedConfById($schedConfId)) {
             // Delete scheduled conference file tree
             // FIXME move this somewhere better.
             import('file.FileManager');
             $fileManager = new FileManager();
             $schedConfPath = Config::getVar('files', 'files_dir') . '/conferences/' . $schedConf->getConferenceId() . '/schedConfs/' . $schedConfId;
             $fileManager->rmtree($schedConfPath);
             $publicFileManager->rmtree($schedConfFilesPath);
         }
     }
     Request::redirect(null, null, null, 'schedConfs');
 }
开发者ID:jalperin,项目名称:ocs,代码行数:27,代码来源:ManagerSchedConfHandler.inc.php

示例3: upgradePlugin

 /**
  * Upgrade a plugin to a newer version from the user's filesystem
  * @param $category string
  * @param $plugin string
  * @param $path string path to plugin Directory
  * @param $category string
  * @param $plugin string
  * @return Version|null The upgraded version, on success; null on fail
  */
 function upgradePlugin($category, $plugin, $path, &$errorMsg)
 {
     $versionFile = $path . '/' . PLUGIN_VERSION_FILE;
     $pluginVersion = VersionCheck::getValidPluginVersionInfo($versionFile, $errorMsg);
     if (!$pluginVersion) {
         return null;
     }
     // Check whether the uploaded plug-in fits the original plug-in.
     if ('plugins.' . $category != $pluginVersion->getProductType()) {
         $errorMsg = __('manager.plugins.wrongCategory');
         return null;
     }
     if ($plugin != $pluginVersion->getProduct()) {
         $errorMsg = __('manager.plugins.wrongName');
         return null;
     }
     $versionDao = DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
     if (!$installedPlugin) {
         $errorMsg = __('manager.plugins.pleaseInstall');
         return null;
     }
     if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
         $errorMsg = __('manager.plugins.installedVersionNewer');
         return null;
     } else {
         $pluginDest = Core::getBaseDir() . '/plugins/' . $category . '/' . $plugin;
         $pluginLibDest = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/plugins/' . $category . '/' . $plugin;
         // Delete existing files.
         $fileManager = new FileManager();
         if (is_dir($pluginDest)) {
             $fileManager->rmtree($pluginDest);
         }
         if (is_dir($pluginLibDest)) {
             $fileManager->rmtree($pluginLibDest);
         }
         // Check whether deleting has worked.
         if (is_dir($pluginDest) || is_dir($pluginLibDest)) {
             $errorMsg = __('message', 'manager.plugins.deleteError');
             return null;
         }
         // Copy the plug-in from the temporary folder to the
         // target folder.
         // Start with the library part (if any).
         $libPath = $path . '/lib';
         if (is_dir($libPath)) {
             if (!$fileManager->copyDir($libPath, $pluginLibDest)) {
                 $errorMsg = __('manager.plugins.copyError');
                 return null;
             }
             // Remove the library part of the temporary folder.
             $fileManager->rmtree($libPath);
         }
         // Continue with the application-specific part (mandatory).
         if (!$fileManager->copyDir($path, $pluginDest)) {
             $errorMsg = __('manager.plugins.copyError');
             return null;
         }
         // Remove the temporary folder.
         $fileManager->rmtree(dirname($path));
         $upgradeFile = $pluginDest . '/' . PLUGIN_UPGRADE_FILE;
         if ($fileManager->fileExists($upgradeFile)) {
             $params = $this->_getConnectionParams();
             $installer = new Upgrade($params, $upgradeFile, true);
             if (!$installer->execute()) {
                 $errorMsg = __('manager.plugins.upgradeFailed', array('errorString' => $installer->getErrorString()));
                 return null;
             }
         }
         $installedPlugin->setCurrent(0);
         $pluginVersion->setCurrent(1);
         $versionDao->insertVersion($pluginVersion, true);
         return $pluginVersion;
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:84,代码来源:PluginHelper.inc.php

示例4: deleteConference

 /**
  * Delete a conference.
  * @param $args array first parameter is the ID of the conference to delete
  */
 function deleteConference($args, &$request)
 {
     $this->validate();
     $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $conferenceId = $args[0];
         if ($conferenceDao->deleteConferenceById($conferenceId)) {
             // Delete conference file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $conferencePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId;
             $fileManager->rmtree($conferencePath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getConferenceFilesPath($conferenceId));
         }
     }
     $request->redirect(null, null, null, 'conferences');
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:24,代码来源:AdminConferenceHandler.inc.php

示例5: deletePaperTree

 /**
  * Delete the entire tree of files belonging to a paper.
  */
 function deletePaperTree()
 {
     parent::rmtree($this->filesDir);
 }
开发者ID:sedici,项目名称:ocs,代码行数:7,代码来源:PaperFileManager.inc.php

示例6: deletePlugin

 /**
  * Delete a plugin from the system
  * @param $category string
  * @param $plugin string
  */
 function deletePlugin($category, $plugin)
 {
     $this->validate();
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('path', 'delete');
     $templateMgr->assign('deleted', false);
     $templateMgr->assign('error', false);
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     /* @var $versionDao VersionDAO */
     $installedPlugin = $versionDao->getCurrentVersion('plugins.' . $category, $plugin, true);
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         $pluginLibDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         //make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             // Delete the plugin from the file system.
             FileManager::rmtree($pluginDest);
             FileManager::rmtree($pluginLibDest);
         }
         if (is_dir($pluginDest) || is_dir($pluginLibDest)) {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.deleteError');
         } else {
             $versionDao->disableVersion('plugins.' . $category, $plugin);
             $templateMgr->assign('deleted', true);
         }
     } else {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', 'manager.plugins.doesNotExist');
     }
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category));
     $templateMgr->display('manager/plugins/managePlugins.tpl');
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:39,代码来源:PluginManagementHandler.inc.php

示例7: execute

 /**
  * Process apache log files, copying and filtering them
  * to the usage stats stage directory. Can work with both
  * a specific file or a directory.
  */
 function execute()
 {
     $fileMgr = new FileManager();
     $filesDir = Config::getVar('files', 'files_dir');
     $filePath = current($this->argv);
     $usageStatsDir = $this->_usageStatsDir;
     $tmpDir = $this->_tmpDir;
     if ($fileMgr->fileExists($tmpDir, 'dir')) {
         $fileMgr->rmtree($tmpDir);
     }
     if (!$fileMgr->mkdir($tmpDir)) {
         printf(__('admin.copyAccessLogFileTool.error.creatingFolder', array('tmpDir' => $tmpDir)) . "\n");
         exit(1);
     }
     if ($fileMgr->fileExists($filePath, 'dir')) {
         // Directory.
         $filesToCopy = glob($filePath . DIRECTORY_SEPARATOR . '*');
         foreach ($filesToCopy as $file) {
             $this->_copyFile($file);
         }
     } else {
         if ($fileMgr->fileExists($filePath)) {
             // File.
             $this->_copyFile($filePath);
         } else {
             // Can't access.
             printf(__('admin.copyAccessLogFileTool.error.acessingFile', array('filePath' => $filePath)) . "\n");
         }
     }
     $fileMgr->rmtree($tmpDir);
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:36,代码来源:copyAccessLogFileTool.php

示例8: deleteContext

 /**
  * Delete a journal.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function deleteContext($args, $request)
 {
     // Identify the journal Id.
     $journalId = $request->getUserVar('rowId');
     $journalDao = DAORegistry::getDAO('JournalDAO');
     $journal = $journalDao->getById($journalId);
     if ($journal) {
         $journalDao->deleteById($journalId);
         // Delete journal file tree
         // FIXME move this somewhere better.
         import('lib.pkp.classes.file.FileManager');
         $fileManager = new FileManager($journalId);
         $journalPath = Config::getVar('files', 'files_dir') . '/journals/' . $journalId;
         $fileManager->rmtree($journalPath);
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->rmtree($publicFileManager->getJournalFilesPath($journalId));
         return DAO::getDataChangedEvent($journalId);
     }
     return new JSONMessage(false);
 }
开发者ID:mariojp,项目名称:ojs,代码行数:27,代码来源:JournalGridHandler.inc.php

示例9: deleteIssueTree

 /**
  * Delete the entire tree of files belonging to an issue.
  */
 function deleteIssueTree()
 {
     parent::rmtree($this->getFilesDir());
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:7,代码来源:IssueFileManager.inc.php

示例10: deletePlugin

 /**
  * Delete plugin.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function deletePlugin($args, $request)
 {
     $plugin = $this->getAuthorizedContextObject(ASSOC_TYPE_PLUGIN);
     $category = $plugin->getCategory();
     $productName = basename($plugin->getPluginPath());
     $versionDao = DAORegistry::getDAO('VersionDAO');
     /* @var $versionDao VersionDAO */
     $installedPlugin = $versionDao->getCurrentVersion('plugins.' . $category, $productName, true);
     $notificationMgr = new NotificationManager();
     $user = $request->getUser();
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $productName;
         $pluginLibDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . PKP_LIB_PATH . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $productName;
         // make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             // Delete the plugin from the file system.
             $fileManager = new FileManager();
             $fileManager->rmtree($pluginDest);
             $fileManager->rmtree($pluginLibDest);
         }
         if (is_dir($pluginDest) || is_dir($pluginLibDest)) {
             $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('manager.plugins.deleteError', array('pluginName' => $plugin->getDisplayName()))));
         } else {
             $versionDao->disableVersion('plugins.' . $category, $productName);
             $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.deleteSuccess', array('pluginName' => $plugin->getDisplayName()))));
         }
     } else {
         $notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('manager.plugins.doesNotExist', array('pluginName' => $plugin->getDisplayName()))));
     }
     return DAO::getDataChangedEvent($plugin->getName());
 }
开发者ID:piero-tasso,项目名称:pkp-lib,代码行数:37,代码来源:PluginGridHandler.inc.php

示例11: deleteArticleTree

 /**
  * Delete the entire tree of files belonging to an article.
  */
 function deleteArticleTree()
 {
     parent::rmtree($this->filesDir);
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:7,代码来源:ArticleFileManager.inc.php

示例12: deletePress

 /**
  * Delete a press.
  * @param $args array first parameter is the ID of the press to delete
  */
 function deletePress($args)
 {
     $this->validate();
     $pressDao =& DAORegistry::getDAO('PressDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $pressId = $args[0];
         if ($pressDao->deletePressById($pressId)) {
             // Delete press file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $pressPath = Config::getVar('files', 'files_dir') . '/presses/' . $pressId;
             $fileManager->rmtree($pressPath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getPressFilesPath($pressId));
         }
     }
     Request::redirect(null, null, 'presses');
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:24,代码来源:AdminPressHandler.inc.php

示例13: deletePlugin

 /**
  * Delete a plugin from the system
  * @param plugin string
  */
 function deletePlugin($plugin)
 {
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('path', 'delete');
     $templateMgr->assign('deleted', false);
     $templateMgr->assign('error', false);
     $templateMgr->assign('pageHierarchy', PluginManagementHandler::setBreadcrumbs(true));
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($plugin);
     $category = $this->getPluginCategory($plugin);
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         //make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             FileManager::rmtree($pluginDest);
         }
         if (FileManager::fileExists($pluginDest, 'dir')) {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.deleteError');
         } else {
             $versionDao->disableVersion($plugin);
             $templateMgr->assign('deleted', true);
         }
     } else {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', 'manager.plugins.doesNotExist');
     }
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category));
     $templateMgr->display('manager/plugins/managePlugins.tpl');
 }
开发者ID:jalperin,项目名称:ocs,代码行数:35,代码来源:PluginManagementHandler.inc.php

示例14: deleteMeetingTree

 /**
  * Delete the entire tree of files belonging to a meeting.
  */
 function deleteMeetingTree()
 {
     parent::rmtree($this->filesDir);
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:7,代码来源:MinutesFileManager.inc.php

示例15: execute

 /**
  * Process apache log files, copying and filtering them
  * to the usage stats stage directory. Can work with both
  * a specific file or a directory.
  */
 function execute()
 {
     $fileMgr = new FileManager();
     $filesDir = Config::getVar('files', 'files_dir');
     $filePath = current($this->argv);
     $usageStatsDir = $this->_usageStatsDir;
     $tmpDir = $this->_tmpDir;
     if ($fileMgr->fileExists($tmpDir, 'dir')) {
         $fileMgr->rmtree($tmpDir);
     }
     if (!$fileMgr->mkdir($tmpDir)) {
         printf(__('admin.copyAccessLogFileTool.error.creatingFolder', array('tmpDir' => $tmpDir)) . "\n");
         exit(1);
     }
     if ($fileMgr->fileExists($filePath, 'dir')) {
         // Directory.
         $filesToCopy = glob($filePath . DIRECTORY_SEPARATOR . '*.*');
         foreach ($filesToCopy as $file) {
             // If a base filename is given as a parameter, check it.
             if (count($this->argv) == 2) {
                 $baseFilename = $this->argv[1];
                 if (strpos(pathinfo($file, PATHINFO_BASENAME), $baseFilename) !== 0) {
                     continue;
                 }
             }
             $this->_copyFile($file);
         }
     } else {
         if ($fileMgr->fileExists($filePath)) {
             // File.
             $this->_copyFile($filePath);
         } else {
             // Can't access.
             printf(__('admin.copyAccessLogFileTool.error.acessingFile', array('filePath' => $filePath)) . "\n");
         }
     }
     $fileMgr->rmtree($tmpDir);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:43,代码来源:copyAccessLogFileTool.php


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