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


PHP FileManager::deleteFile方法代码示例

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


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

示例1: extractPlugin

 /**
  * Extract and validate a plugin (prior to installation)
  * @param $filePath string Full path to plugin archive
  * @param $originalFileName string Original filename of plugin archive
  * @return string|null Extracted plugin path on success; null on error
  */
 function extractPlugin($filePath, $originalFileName, &$errorMsg)
 {
     $fileManager = new FileManager();
     // tar archive basename (less potential version number) must
     // equal plugin directory name and plugin files must be in a
     // directory named after the plug-in (potentially with version)
     $matches = array();
     PKPString::regexp_match_get('/^[a-zA-Z0-9]+/', basename($originalFileName, '.tar.gz'), $matches);
     $pluginShortName = array_pop($matches);
     if (!$pluginShortName) {
         $errorMsg = __('manager.plugins.invalidPluginArchive');
         $fileManager->deleteFile($filePath);
         return null;
     }
     // Create random dirname to avoid symlink attacks.
     $pluginExtractDir = dirname($filePath) . DIRECTORY_SEPARATOR . $pluginShortName . substr(md5(mt_rand()), 0, 10);
     mkdir($pluginExtractDir);
     // Test whether the tar binary is available for the export to work
     $tarBinary = Config::getVar('cli', 'tar');
     if (!empty($tarBinary) && file_exists($tarBinary)) {
         exec($tarBinary . ' -xzf ' . escapeshellarg($filePath) . ' -C ' . escapeshellarg($pluginExtractDir));
     } else {
         $errorMsg = __('manager.plugins.tarCommandNotFound');
     }
     $fileManager->deleteFile($filePath);
     if (empty($errorMsg)) {
         // Look for a directory named after the plug-in's short
         // (alphanumeric) name within the extracted archive.
         if (is_dir($tryDir = $pluginExtractDir . '/' . $pluginShortName)) {
             return $tryDir;
             // Success
         }
         // Failing that, look for a directory named after the
         // archive. (Typically also contains the version number
         // e.g. with github generated release archives.)
         PKPString::regexp_match_get('/^[a-zA-Z0-9.-]+/', basename($originalFileName, '.tar.gz'), $matches);
         if (is_dir($tryDir = $pluginExtractDir . '/' . array_pop($matches))) {
             // We found a directory named after the archive
             // within the extracted archive. (Typically also
             // contains the version number, e.g. github
             // generated release archives.)
             return $tryDir;
         }
         $errorMsg = __('manager.plugins.invalidPluginArchive');
     }
     $fileManager->rmtree($pluginExtractDir);
     return null;
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:54,代码来源:PluginHelper.inc.php

示例2: deleteFile

 /**
  * Delete a file by ID.
  * @param $fileId int
  * @return int number of files removed
  */
 function deleteFile($fileId)
 {
     $libraryFileDao =& DAORegistry::getDAO('LibraryFileDAO');
     $libraryFile =& $libraryFileDao->getById($fileId);
     parent::deleteFile($this->filesDir . $libraryFile->getFileName());
     $libraryFileDao->deleteById($fileId);
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:12,代码来源:LibraryFileManager.inc.php

示例3: deleteFile

 /**
  * Delete a file by ID.
  * @param $fileId int
  * @return int number of files removed
  */
 function deleteFile($fileId)
 {
     $minutesFileDao =& DAORegistry::getDAO('MinutesFileDAO');
     $file =& $minutesFileDao->getMinutesFile($fileId);
     parent::deleteFile($this->filesDir . $file->getType() . '/' . $file->getFileName());
     return $minutesFileDao->deleteMinutesFileById($fileId);
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:12,代码来源:MinutesFileManager.inc.php

示例4: deleteFile

 /**
  * Delete a file by ID.
  * @param $fileId int
  */
 function deleteFile($fileId, $userId)
 {
     $temporaryFile =& $this->getFile($fileId, $userId);
     parent::deleteFile($this->filesDir . $temporaryFile->getFileName());
     $temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
     $temporaryFileDao->deleteTemporaryFileById($fileId, $userId);
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:11,代码来源:PKPTemporaryFileManager.inc.php

示例5: deleteAboutFile

 /**
  * Delete a file by ID.
  * @param $fileId int
  */
 function deleteAboutFile($fileId)
 {
     if ($fileId != 0) {
         $aboutFile =& $this->getFile($fileId);
         parent::deleteFile($this->filesDir . $aboutFile->getFileName());
         $aboutFileDao =& DAORegistry::getDAO('AboutFileDAO');
         $aboutFileDao->deleteAboutFileById($fileId);
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:13,代码来源:AboutFileManager.inc.php

示例6: deleteFile

 /**
  * Delete an issue file by ID.
  * @param $fileId int
  * @return boolean if successful
  */
 function deleteFile($fileId)
 {
     $issueFileDao = DAORegistry::getDAO('IssueFileDAO');
     $issueFile = $issueFileDao->getById($fileId);
     if (parent::deleteFile($this->getFilesDir() . $this->contentTypeToPath($issueFile->getContentType()) . '/' . $issueFile->getFileName())) {
         $issueFileDao->deleteById($fileId);
         return true;
     }
     return false;
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:15,代码来源:IssueFileManager.inc.php

示例7: array

 function _cacheMiss(&$cache, $id)
 {
     $allCodelistItems =& Registry::get('all' . $this->getListName() . 'CodelistItems', true, null);
     if ($allCodelistItems === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getFilename($locale);
         $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $listName =& $this->getListName();
         // i.e., 'List30'
         import('lib.pkp.classes.codelist.ONIXParserDOMHandler');
         $handler = new ONIXParserDOMHandler($listName);
         import('lib.pkp.classes.xslt.XSLTransformer');
         import('lib.pkp.classes.file.FileManager');
         import('classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $fileManager = new FileManager();
         $tmpName = tempnam($temporaryFileManager->getBasePath(), 'ONX');
         $xslTransformer = new XSLTransformer();
         $xslTransformer->setParameters(array('listName' => $listName));
         $xslTransformer->setRegisterPHPFunctions(true);
         $xslFile = 'lib/pkp/xml/onixFilter.xsl';
         $filteredXml = $xslTransformer->transform($filename, XSL_TRANSFORMER_DOCTYPE_FILE, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING);
         if (!$filteredXml) {
             assert(false);
         }
         $data = null;
         if (is_writeable($tmpName)) {
             $fp = fopen($tmpName, 'wb');
             fwrite($fp, $filteredXml);
             fclose($fp);
             $data = $xmlDao->parseWithHandler($tmpName, $handler);
             $fileManager->deleteFile($tmpName);
         } else {
             fatalError('misconfigured directory permissions on: ' . $temporaryFileManager->getBasePath());
         }
         // Build array with ($charKey => array(stuff))
         if (isset($data[$listName])) {
             foreach ($data[$listName] as $code => $codelistData) {
                 $allCodelistItems[$code] = $codelistData;
             }
         }
         if (is_array($allCodelistItems)) {
             asort($allCodelistItems);
         }
         $cache->setEntireCache($allCodelistItems);
     }
     return null;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:55,代码来源:ONIXCodelistItemDAO.inc.php

示例8: deleteObject

    /**
     * Delete a submission file from the database.
     * @param $submissionFile SubmissionFile
     * @return boolean
     */
    function deleteObject($submissionFile)
    {
        if (!$this->update('DELETE FROM submission_files
			 WHERE file_id = ? AND revision = ?', array((int) $submissionFile->getFileId(), (int) $submissionFile->getRevision()))) {
            return false;
        }
        // if we've removed the last revision of this file, clean up
        // the settings for this file as well.
        $result = $this->retrieve('SELECT * FROM submission_files WHERE file_id = ?', array((int) $submissionFile->getFileId()));
        if ($result->RecordCount() == 0) {
            $this->update('DELETE FROM submission_file_settings WHERE file_id = ?', array((int) $submissionFile->getFileId()));
        }
        // Delete all dependent objects.
        $this->_deleteDependentObjects($submissionFile);
        // Delete the file on the file system, too.
        $filePath = $submissionFile->getFilePath();
        if (!(is_file($filePath) && is_readable($filePath))) {
            return false;
        }
        assert(is_writable(dirname($filePath)));
        import('lib.pkp.classes.file.FileManager');
        $fileManager = new FileManager();
        $fileManager->deleteFile($filePath);
        return !file_exists($filePath);
    }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:30,代码来源:SubmissionFileDAODelegate.inc.php

示例9: UsageStatsLoader

 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function UsageStatsLoader($args)
 {
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_plugin =& $plugin;
     $arg = current($args);
     switch ($arg) {
         case 'autoStage':
             if ($plugin->getSetting(0, 'createLogFiles')) {
                 $this->_autoStage = true;
             }
             break;
         case 'externalLogFiles':
             $this->_externalLogFiles = true;
             break;
     }
     // Define the base filesystem path.
     $args[0] = $plugin->getFilesPath();
     parent::FileLoader($args);
     if ($plugin->getEnabled()) {
         // Load the metric type constant.
         PluginRegistry::loadCategory('reports');
         $geoLocationTool =& StatisticsHelper::getGeoLocationTool();
         $this->_geoLocationTool =& $geoLocationTool;
         $plugin->import('UsageStatsTemporaryRecordDAO');
         $statsDao = new UsageStatsTemporaryRecordDAO();
         DAORegistry::registerDAO('UsageStatsTemporaryRecordDAO', $statsDao);
         $this->_counterRobotsListFile = $this->_getCounterRobotListFile();
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         /* @var $journalDao JournalDAO */
         $journalFactory =& $journalDao->getJournals();
         /* @var $journalFactory DAOResultFactory */
         $journalsByPath = array();
         while ($journal =& $journalFactory->next()) {
             /* @var $journal Journal */
             $journalsByPath[$journal->getPath()] =& $journal;
         }
         $this->_journalsByPath = $journalsByPath;
         $this->checkFolderStructure(true);
         if ($this->_autoStage) {
             // Copy all log files to stage directory, except the current day one.
             $fileMgr = new FileManager();
             $logFiles = array();
             $logsDirFiles = glob($plugin->getUsageEventLogsPath() . DIRECTORY_SEPARATOR . '*');
             // It's possible that the processing directory have files that
             // were being processed but the php process was stopped before
             // finishing the processing. Just copy them to the stage directory too.
             $processingDirFiles = glob($this->getProcessingPath() . DIRECTORY_SEPARATOR . '*');
             if (is_array($logsDirFiles)) {
                 $logFiles = array_merge($logFiles, $logsDirFiles);
             }
             if (is_array($processingDirFiles)) {
                 $logFiles = array_merge($logFiles, $processingDirFiles);
             }
             foreach ($logFiles as $filePath) {
                 // Make sure it's a file.
                 if ($fileMgr->fileExists($filePath)) {
                     // Avoid current day file.
                     $filename = pathinfo($filePath, PATHINFO_BASENAME);
                     $currentDayFilename = $plugin->getUsageEventCurrentDayLogName();
                     if ($filename == $currentDayFilename) {
                         continue;
                     }
                     if ($fileMgr->copyFile($filePath, $this->getStagePath() . DIRECTORY_SEPARATOR . $filename)) {
                         $fileMgr->deleteFile($filePath);
                     }
                 }
             }
         }
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:75,代码来源:UsageStatsLoader.inc.php

示例10: fileDelete

 function fileDelete($args)
 {
     FilesHandler::parseDirArg($args, $currentDir, $parentDir);
     $currentPath = FilesHandler::getRealFilesDir($currentDir);
     import('lib.pkp.classes.file.FileManager');
     $fileMgr = new FileManager();
     if (@is_file($currentPath)) {
         $fileMgr->deleteFile($currentPath);
     } else {
         // TODO Use recursive delete (rmtree) instead?
         @$fileMgr->rmdir($currentPath);
     }
     Request::redirect(null, null, 'files', explode('/', $parentDir));
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:14,代码来源:FilesHandler.inc.php

示例11: pathinfo

 /**
  * Copy the passed file, filtering entries
  * related to this installation.
  * @param $filePath string
  */
 function _copyFile($filePath)
 {
     $usageStatsFiles = $this->_usageStatsFiles;
     $usageStatsDir = $this->_usageStatsDir;
     $tmpDir = $this->_tmpDir;
     $fileName = pathinfo($filePath, PATHINFO_BASENAME);
     $fileMgr = new FileManager();
     $isCompressed = false;
     $uncompressedFileName = $fileName;
     if (pathinfo($filePath, PATHINFO_EXTENSION) == 'gz') {
         $isCompressed = true;
         $uncompressedFileName = substr($fileName, 0, -3);
     }
     if (in_array($uncompressedFileName, $usageStatsFiles)) {
         printf(__('admin.copyAccessLogFileTool.warning.fileAlreadyExists', array('filePath' => $filePath)) . "\n");
         return;
     }
     $tmpFilePath = $tmpDir . DIRECTORY_SEPARATOR . $fileName;
     // Copy the file to a temporary directory.
     if (!$fileMgr->copyFile($filePath, $tmpFilePath)) {
         printf(__('admin.copyAccessLogFileTool.error.copyingFile', array('filePath' => $filePath, 'tmpFilePath' => $tmpFilePath)) . "\n");
         exit(1);
     }
     // Uncompress it, if needed.
     if ($isCompressed) {
         $fileMgr = new FileManager();
         $errorMsg = null;
         if (!($tmpFilePath = $fileMgr->decompressFile($tmpFilePath, $errorMsg))) {
             printf($errorMsg . "\n");
             exit(1);
         }
     }
     // Filter only entries that contains context paths.
     $egrepPath = $this->_egrepPath;
     $destinationPath = $usageStatsDir . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_STAGING . DIRECTORY_SEPARATOR . pathinfo($tmpFilePath, PATHINFO_BASENAME);
     // Each context path is already escaped, see the constructor.
     $output = null;
     $returnValue = 0;
     exec($egrepPath . " -i '" . $this->_contextPaths . "' " . escapeshellarg($tmpFilePath) . " > " . escapeshellarg($destinationPath), $output, $returnValue);
     if ($returnValue > 1) {
         printf(__('admin.error.executingUtil', array('utilPath' => $egrepPath, 'utilVar' => 'egrep')) . "\n");
         exit(1);
     }
     if (!$fileMgr->deleteFile($tmpFilePath)) {
         printf(__('admin.copyAccessLogFileTool.error.deletingFile', array('tmpFilePath' => $tmpFilePath)) . "\n");
         exit(1);
     }
     printf(__('admin.copyAccessLogFileTool.success', array('filePath' => $filePath, 'destinationPath' => $destinationPath)) . "\n");
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:54,代码来源:copyAccessLogFileTool.php

示例12: pathinfo

 /**
  * Copy the passed file, filtering entries
  * related to this installation.
  * @param $filePath string
  */
 function _copyFile($filePath)
 {
     $usageStatsFiles = $this->_usageStatsFiles;
     $usageStatsDir = $this->_usageStatsDir;
     $tmpDir = $this->_tmpDir;
     $fileName = pathinfo($filePath, PATHINFO_BASENAME);
     $fileMgr = new FileManager();
     $isCompressed = false;
     $uncompressedFileName = $fileName;
     if (pathinfo($filePath, PATHINFO_EXTENSION) == 'gz') {
         $isCompressed = true;
         $uncompressedFileName = substr($fileName, 0, -3);
     }
     if (in_array($uncompressedFileName, $usageStatsFiles)) {
         printf(__('admin.copyAccessLogFileTool.warning.fileAlreadyExists', array('filePath' => $filePath)) . "\n");
         return;
     }
     $tmpFilePath = $tmpDir . DIRECTORY_SEPARATOR . $fileName;
     // Copy the file to a temporary directory.
     if (!$fileMgr->copyFile($filePath, $tmpFilePath)) {
         printf(__('admin.copyAccessLogFileTool.error.copyingFile', array('filePath' => $filePath, 'tmpFilePath' => $tmpFilePath)) . "\n");
         exit(1);
     }
     // Uncompress it, if needed.
     $gunzipPath = escapeshellarg(Config::getVar('cli', 'gunzip'));
     if ($isCompressed) {
         exec($gunzipPath . ' ' . $tmpFilePath);
         $tmpFilePath = substr($tmpFilePath, 0, -3);
     }
     // Filter only entries that contains journal paths.
     $egrepPath = escapeshellarg(Config::getVar('cli', 'egrep'));
     $destinationPath = $usageStatsDir . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_STAGING . DIRECTORY_SEPARATOR . pathinfo($tmpFilePath, PATHINFO_BASENAME);
     // Each journal path is already escaped, see the constructor.
     exec($egrepPath . " -i '" . $this->_journalPaths . "' " . escapeshellarg($tmpFilePath) . " > " . escapeshellarg($destinationPath));
     if (!$fileMgr->deleteFile($tmpFilePath)) {
         printf(__('admin.copyAccessLogFileTool.error.deletingFile', array('tmpFilePath' => $tmpFilePath)) . "\n");
         exit(1);
     }
     printf(__('admin.copyAccessLogFileTool.success', array('filePath' => $filePath, 'destinationPath' => $destinationPath)) . "\n");
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:45,代码来源:copyAccessLogFileTool.php

示例13: executeCLI


//.........这里部分代码省略.........
                         $submission->setSeriesId($series->getId());
                     } else {
                         echo __('plugins.importexport.csv.noSeries', array('seriesPath' => $seriesPath)) . "\n";
                     }
                     $submissionId = $submissionDao->insertObject($submission);
                     $contactEmail = $press->getContactEmail();
                     $authorString = trim($authorString, '"');
                     // remove double quotes if present.
                     $authors = preg_split('/,\\s*/', $authorString);
                     $firstAuthor = true;
                     foreach ($authors as $authorString) {
                         // Examine the author string. Best case is: First1 Last1 <email@address.com>, First2 Last2 <email@address.com>, etc
                         // But default to press email address based on press path if not present.
                         $firstName = $lastName = $emailAddress = null;
                         $authorString = trim($authorString);
                         // whitespace.
                         if (preg_match('/^(\\w+)(\\s+\\w+)?\\s*(<([^>]+)>)?$/', $authorString, $matches)) {
                             $firstName = $matches[1];
                             // Mandatory
                             if (count($matches) > 2) {
                                 $lastName = $matches[2];
                             }
                             if (count($matches) == 5) {
                                 $emailAddress = $matches[4];
                             } else {
                                 $emailAddress = $contactEmail;
                             }
                         }
                         $author = $authorDao->newDataObject();
                         $author->setSubmissionId($submissionId);
                         $author->setUserGroupId($authorGroup->getId());
                         $author->setFirstName($firstName);
                         $author->setLastName($lastName);
                         $author->setEmail($emailAddress);
                         if ($firstAuthor) {
                             $author->setPrimaryContact(1);
                             $firstAuthor = false;
                         }
                         $authorDao->insertObject($author);
                     }
                     // Authors done.
                     $submission->setTitle($title, $locale);
                     $submissionDao->updateObject($submission);
                     // Submission is done.  Create a publication format for it.
                     $publicationFormat = $publicationFormatDao->newDataObject();
                     $publicationFormat->setPhysicalFormat(false);
                     $publicationFormat->setIsApproved(true);
                     $publicationFormat->setIsAvailable(true);
                     $publicationFormat->setSubmissionId($submissionId);
                     $publicationFormat->setProductAvailabilityCode('20');
                     // ONIX code for Available.
                     $publicationFormat->setEntryKey('DA');
                     // ONIX code for Digital
                     $publicationFormat->setData('name', 'PDF', $submission->getLocale());
                     $publicationFormat->setSequence(REALLY_BIG_NUMBER);
                     $publicationFormatId = $publicationFormatDao->insertObject($publicationFormat);
                     if ($doi) {
                         $publicationFormat->setStoredPubId('doi', $doi);
                     }
                     $publicationFormatDao->updateObject($publicationFormat);
                     // Create a publication format date for this publication format.
                     $publicationDate = $publicationDateDao->newDataObject();
                     $publicationDate->setDateFormat('05');
                     // List55, YYYY
                     $publicationDate->setRole('01');
                     // List163, Publication Date
                     $publicationDate->setDate($year);
                     $publicationDate->setPublicationFormatId($publicationFormatId);
                     $publicationDateDao->insertObject($publicationDate);
                     // Submission File.
                     import('lib.pkp.classes.file.TemporaryFileManager');
                     import('lib.pkp.classes.file.FileManager');
                     $temporaryFileManager = new TemporaryFileManager();
                     $temporaryFilename = tempnam($temporaryFileManager->getBasePath(), 'remote');
                     $temporaryFileManager->copyFile($pdfUrl, $temporaryFilename);
                     $submissionFile = $submissionFileDao->newDataObjectByGenreId($genre->getId());
                     $submissionFile->setSubmissionId($submissionId);
                     $submissionFile->setGenreId($genre->getId());
                     $submissionFile->setFileStage(SUBMISSION_FILE_PROOF);
                     $submissionFile->setDateUploaded(Core::getCurrentDate());
                     $submissionFile->setDateModified(Core::getCurrentDate());
                     $submissionFile->setAssocType(ASSOC_TYPE_REPRESENTATION);
                     $submissionFile->setAssocId($publicationFormatId);
                     $submissionFile->setFileType('application/pdf');
                     // Assume open access, no price.
                     $submissionFile->setDirectSalesPrice(0);
                     $submissionFile->setSalesType('openAccess');
                     $submissionFileDao->insertObject($submissionFile, $temporaryFilename);
                     $fileManager = new FileManager();
                     $fileManager->deleteFile($temporaryFilename);
                     echo __('plugins.importexport.csv.import.submission', array('title' => $title)) . "\n";
                 } else {
                     echo __('plugins.importexport.csv.unknownLocale', array('locale' => $locale)) . "\n";
                 }
             } else {
                 echo __('plugins.importexport.csv.unknownPress', array('pressPath' => $pressPath)) . "\n";
             }
         }
     }
 }
开发者ID:NateWr,项目名称:omp,代码行数:101,代码来源:CSVImportExportPlugin.inc.php

示例14: _publishResearch

 /**
  * Internal function to write the pdf of a published researt.
  * @param $sectionEditorSubmission SectionEditorSubmission
  * @return bool
  */
 function _publishResearch($sectionEditorSubmission)
 {
     $completionReport = $sectionEditorSubmission->getLastReportFile();
     if ($completionReport->getFileType() == "application/pdf") {
         $coverPath = SectionEditorAction::_generateCover($sectionEditorSubmission);
         if ($coverPath && $coverPath != '') {
             import('classes.lib.TCPDFMerger');
             $file2merge = array($coverPath . 'tempCover.pdf', $completionReport->getFilePath());
             $pdf = new TCPDFMerger();
             $pdf->setFiles($file2merge);
             $pdf->concat();
             $fileName = $sectionEditorSubmission->getProposalId() . '-Final_Technical_Report.pdf';
             $pdf->Output($coverPath . $fileName, "F");
             FileManager::deleteFile($coverPath . 'tempCover.pdf');
             if (file_exists($coverPath . $fileName)) {
                 //import('classes.article.ArticleFile');
                 $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
                 $technicalReport = new ArticleFile();
                 $technicalReport->setArticleId($sectionEditorSubmission->getArticleId());
                 $technicalReport->setFileName($fileName);
                 $technicalReport->setFileType('application/pdf');
                 $technicalReport->setFileSize(filesize($coverPath . $fileName));
                 $technicalReport->setOriginalFileName($fileName);
                 $technicalReport->setType('public');
                 $technicalReport->setDateUploaded(Core::getCurrentDate());
                 $technicalReport->setDateModified(Core::getCurrentDate());
                 $fileId = $articleFileDao->insertArticleFile($technicalReport);
                 return $fileId;
             }
         }
     }
     return false;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:38,代码来源:SectionEditorAction.inc.php

示例15: _deleteInternally

 /**
  * Protected method to retrieve submission file revisions
  * according to the given filters.
  * @param $submissionId int
  * @param $fileStage int
  * @param $fileId int
  * @param $revision int
  * @param $assocType integer
  * @param $assocId integer
  * @param $latestOnly boolean
  * @return boolean
  */
 function _deleteInternally($submissionId = null, $fileStage = null, $fileId = null, $revision = null, $assocType = null, $assocId = null, $latestOnly = false)
 {
     // Identify all matched files.
     $deletedFiles =& $this->_getInternally($submissionId, $fileStage, $fileId, $revision, $assocType, $assocId, $latestOnly);
     if (empty($deletedFiles)) {
         return 0;
     }
     $filterClause = '';
     $conjunction = '';
     $params = array();
     foreach ($deletedFiles as $deletedFile) {
         /* @var $deletedFile SubmissionFile */
         // Delete the the matched files on the file system.
         FileManager::deleteFile($deletedFile->getFilePath());
         // Delete file in the database.
         // NB: We cannot safely bulk-delete because MySQL 3.23
         // does not support multi-column IN-clauses. Same is true
         // for multi-table access or subselects in the DELETE
         // statement. And having a long (... AND ...) OR (...)
         // clause could hit length limitations.
         $daoDelegate =& $this->_getDaoDelegateForObject($deletedFile);
         $daoDelegate->deleteObject($deletedFile);
     }
     // Return the number of deleted files.
     return count($deletedFiles);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:38,代码来源:PKPSubmissionFileDAO.inc.php


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