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


PHP FileManager::deleteFile方法代码示例

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


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

示例1: doActionDelete

 /**
  * doActionDelete
  *
  * @return void
  * @throws
  */
 protected function doActionDelete()
 {
     if (\Includes\Utils\FileManager::isExists($this->sqldumpFile) && !\Includes\Utils\FileManager::deleteFile($this->sqldumpFile)) {
         \XLite\Core\TopMessage::addError(static::t('Unable to delete file') . ' ' . $this->sqldumpFile);
     } else {
         \XLite\Core\TopMessage::addInfo('SQL file was deleted successfully');
     }
     $this->doRedirect();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:DbBackup.php

示例2: processItem

 /**
  * Process item
  *
  * @param mixed $item Item
  *
  * @return boolean
  */
 protected function processItem($item)
 {
     $result = false;
     $path = tempnam(LC_DIR_TMP, 'migrate_file');
     file_put_contents($path, $item->getBody());
     if (\Includes\Utils\FileManager::isExists($path)) {
         $localPath = $item->isURL() ? null : $item->getStoragePath();
         $result = $item->loadFromLocalFile($path, $item->getFileName() ?: basename($item->getPath()));
         if ($result && $localPath && \Includes\Utils\FileManager::isExists($localPath)) {
             \Includes\Utils\FileManager::deleteFile($localPath);
         }
         \Includes\Utils\FileManager::deleteFile($path);
     }
     if (!$result) {
         if (!isset($this->record['s3_error_count'])) {
             $this->record['s3_error_count'] = 0;
         }
         $this->record['s3_error_count']++;
         \XLite\Logger::getInstance()->log('Couldn\'t move image ' . $item->getPath() . ' (local file system to Amazon S3)', LOG_ERR);
     }
     return true;
 }
开发者ID:kingsj,项目名称:core,代码行数:29,代码来源:MigrateToS3.php

示例3: updateCustomImages

 /**
  * Update custom images
  *
  * @return void
  */
 protected function updateCustomImages()
 {
     $dir = \XLite\Module\XC\ThemeTweaker\Main::getThemeDir() . 'images' . LC_DS;
     if ($_FILES && $_FILES['new_images'] && $_FILES['new_images']['name']) {
         if (!\Includes\Utils\FileManager::isExists($dir)) {
             \Includes\Utils\FileManager::mkdirRecursive($dir);
         }
         if (\Includes\Utils\FileManager::isDirWriteable($dir)) {
             foreach ($_FILES['new_images']['name'] as $i => $data) {
                 \Includes\Utils\FileManager::moveUploadedFileByMultiple('new_images', $i, $dir);
             }
         } else {
             \XLite\Core\TopMessage::addError('The directory {{dir}} does not exist or is not writable.', array('dir' => $dir));
         }
     }
     $delete = \XLite\Core\Request::getInstance()->delete;
     if ($delete && is_array($delete)) {
         foreach ($delete as $file => $del) {
             if ($del) {
                 \Includes\Utils\FileManager::deleteFile($dir . $file);
             }
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:29,代码来源:Images.php

示例4: setModelProperties

 /**
  * Populate model object properties by the passed data
  *
  * @param array $data Data to set
  *
  * @return void
  */
 protected function setModelProperties(array $data)
 {
     $options = $this->getOptions();
     $dir = LC_DIR_SKINS . \XLite\Core\Layout::PATH_COMMON . LC_DS;
     if ('CDev\\SimpleCMS' == $options[0]->category) {
         if ($_FILES && $_FILES['logo'] && $_FILES['logo']['name']) {
             $path = \Includes\Utils\FileManager::moveUploadedFile('logo', $dir);
             if ($path) {
                 if ($options[0]->value) {
                     \Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
                 }
                 $data['logo'] = basename($path);
             }
         } elseif (\XLite\Core\Request::getInstance()->useDefaultLogo) {
             $data['logo'] = '';
             if ($options[0]->value) {
                 \Includes\Utils\FileManager::deleteFile($dir . $options[0]->value);
             }
         } else {
             $data['logo'] = $options[0]->value;
         }
     }
     parent::setModelProperties($data);
 }
开发者ID:kingsj,项目名称:core,代码行数:31,代码来源:Settings.php

示例5: setRepositoryPath

 /**
  * Set repository path
  *
  * @param string  $path            Path to set
  * @param boolean $preventCheck    Flag OPTIONAL
  * @param boolean $preventDeletion Flag OPTIONAL
  *
  * @return void
  */
 public function setRepositoryPath($path, $preventCheck = false, $preventDeletion = false)
 {
     if (!empty($path) && !$preventCheck) {
         $path = \Includes\Utils\FileManager::getRealPath($path);
         if (empty($path) || !\Includes\Utils\FileManager::isReadable($path)) {
             $path = null;
         }
     }
     if (!$preventDeletion && !empty($this->repositoryPath) && $path !== $this->repositoryPath) {
         if ($this->isDownloaded()) {
             \Includes\Utils\FileManager::deleteFile($this->repositoryPath);
         } elseif ($this->isUnpacked()) {
             \Includes\Utils\FileManager::deleteFile($this->getCurrentVersionHashesFilePath());
             \Includes\Utils\FileManager::unlinkRecursive($this->repositoryPath);
         }
     }
     $this->repositoryPath = $path;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:27,代码来源:AEntry.php

示例6: renew

 /**
  * Renew parameters
  *
  * @return boolean
  */
 protected function renew()
 {
     $result = false;
     list($path, $isTempFile) = $this->getLocalPath();
     $result = $this->isFileExists($path, $isTempFile) && $this->renewByPath($path);
     if ($isTempFile || !$result && !$this->isURL($path)) {
         \Includes\Utils\FileManager::deleteFile($path);
     }
     return $result;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:15,代码来源:Storage.php

示例7: deleteByPrefix

 /**
  * Delete by prefix
  *
  * @param string $prefix Prefix
  *
  * @return array
  */
 public function deleteByPrefix($prefix)
 {
     $deleted = array();
     $prefix = $this->getNamespacedIdToDelete($prefix);
     $list = glob($this->path . LC_DS . $prefix);
     if ($list) {
         foreach ($list as $f) {
             if ($this->isKeyValid($f)) {
                 $id = substr(basename($f), 0, -4);
                 \Includes\Utils\FileManager::deleteFile($f);
                 $deleted[] = $id;
             }
         }
     }
     return $deleted;
 }
开发者ID:kingsj,项目名称:core,代码行数:23,代码来源:FileCache.php

示例8: deleteAllFiles

 /**
  * Delete all files
  *
  * @return void
  */
 public function deleteAllFiles()
 {
     $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->getOptions()->dir);
     if (!\Includes\Utils\FileManager::isExists($dir)) {
         \Includes\Utils\FileManager::mkdir($dir);
     }
     $list = glob($dir . LC_DS . '*');
     if ($list) {
         foreach ($list as $path) {
             if (is_file($path)) {
                 \Includes\Utils\FileManager::deleteFile($path);
             } else {
                 \Includes\Utils\FileManager::unlinkRecursive($path);
             }
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:22,代码来源:Importer.php

示例9: clearUnsafeModules

 /**
  * Remove file with active modules list
  *
  * @return void
  */
 public static function clearUnsafeModules()
 {
     \Includes\Utils\FileManager::deleteFile(static::getUnsafeModulesFilePath());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:SafeMode.php

示例10: remove

 /**
  * Remove compiled template
  *
  * @param string $original Relative file path
  *
  * @return void
  */
 public function remove($original)
 {
     $compiled = $this->compileDir . substr($original, $this->rootDirLength) . '.php';
     \Includes\Utils\FileManager::deleteFile($compiled);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:FlexyCompiler.php

示例11: saveCode

 /**
  * Save
  *
  * @param string $code Code
  *
  * @return void
  */
 protected function saveCode($code)
 {
     if ("\r\n" != PHP_EOL) {
         $code = str_replace("\r\n", PHP_EOL, $code);
     }
     $code = str_replace(chr(194) . chr(160), ' ', $code);
     $file = $this->getFileName();
     \Includes\Utils\FileManager::write($file, $code);
     if (\Includes\Utils\FileManager::isFileWriteable($file)) {
         \XLite\Core\TopMessage::addInfo('Your custom file is successfully saved');
         \Includes\Utils\FileManager::deleteFile(str_replace('custom', 'custom.min', $file));
         \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('name' => $this->getBackupName(), 'value' => $code, 'category' => 'XC\\ThemeTweaker'));
         \XLite\Core\Config::updateInstance();
         $config = \XLite\Core\Config::getInstance()->Performance;
         if ($config->aggregate_css || $config->aggregate_js) {
             \Includes\Utils\FileManager::unlinkRecursive(LC_DIR_CACHE_RESOURCES);
             \XLite\Core\TopMessage::addInfo('Aggregation cache has been cleaned');
         }
     } else {
         \XLite\Core\TopMessage::addError('The file {{file}} does not exist or is not writable.', array('file' => $file));
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:29,代码来源:ThemeTweaker.php

示例12: callApiGetArtifact

 /**
  * Call "Get Artifact" request (i.e. download PDF file)
  * To get error message you need to call "getApiCallErrors" method (if return is false)
  *
  * @param boolean $flushChanges Flag - flush changes or not
  *
  * @return boolean
  */
 public function callApiGetArtifact($flushChanges = false)
 {
     $result = false;
     if ($this->isGetArtifactCallAllowed() && $this->getStorageClass()) {
         $data = \XLite\Module\XC\CanadaPost\Core\API::getInstance()->callGetArtifactRequest($this);
         $storageClass = $this->getStorageClass();
         if (isset($data->filePath) && !empty($data->filePath)) {
             // Save PDF document to storage
             $storage = $this->getStorage();
             if (!isset($storage)) {
                 $storage = new $storageClass();
                 $storage->setLink($this);
                 $this->setStorage($storage);
             }
             $storage->loadFromLocalFile($data->filePath);
             $storage->setMime($this->getMediaType());
             \Includes\Utils\FileManager::deleteFile($data->filePath);
             $result = true;
             if ($flushChanges) {
                 \XLite\Core\Database::getEM()->flush();
             }
         }
         if (isset($data->errors)) {
             $this->apiCallErrors = $data->errors;
         }
     }
     return $result;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:36,代码来源:Link.php

示例13: clear

 /**
  * Clear log file
  *
  * @return boolean
  */
 public function clear()
 {
     return \Includes\Utils\FileManager::deleteFile($this->getLogFile());
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:9,代码来源:Logger.php

示例14: removeEntity

 /**
  * Remove entity
  *
  * @param \XLite\Model\AEntity $entity Entity
  *
  * @return boolean
  */
 protected function removeEntity(\XLite\Model\AEntity $entity)
 {
     $pathSkin = 'theme_tweaker/default';
     $localPath = $entity->getTemplate();
     $shortPath = substr($localPath, strpos($localPath, LC_DS, strlen($pathSkin . LC_DS)) + strlen(LC_DS));
     $fullPath = $this->getFullPathByShortPath($shortPath);
     \Includes\Utils\FileManager::deleteFile($fullPath);
     \XLite\Core\FlexyCompiler::getInstance()->remove($fullPath);
     parent::removeEntity($entity);
     return true;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:Template.php

示例15: doActionImport

 /**
  * Import action
  *
  * @return void
  */
 protected function doActionImport()
 {
     foreach (\XLite\Logic\Import\Importer::getImportOptionsList() as $key) {
         \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'Import', 'name' => $key, 'value' => isset(\XLite\Core\Request::getInstance()->options[$key]) ? \XLite\Core\Request::getInstance()->options[$key] : false));
     }
     \XLite\Core\Config::updateInstance();
     $dirTo = LC_DIR_VAR . \XLite\Logic\Import\Importer::getImportDir();
     if (!\Includes\Utils\FileManager::isExists($dirTo)) {
         \Includes\Utils\FileManager::mkdirRecursive($dirTo);
     }
     $filesToImport = array();
     if ($_FILES && isset($_FILES['files']) && $_FILES['files']['name'] && $_FILES['files']['name'][0] && \Includes\Utils\FileManager::isDirWriteable($dirTo)) {
         $list = glob($dirTo . LC_DS . '*');
         if ($list) {
             foreach ($list as $path) {
                 if (is_file($path)) {
                     \Includes\Utils\FileManager::deleteFile($path);
                 }
             }
         }
         $files = $_FILES['files'];
         foreach ($files['name'] as $key => $name) {
             $path = null;
             if ($name && UPLOAD_ERR_OK === $files['error'][$key]) {
                 $path = \Includes\Utils\FileManager::getUniquePath($dirTo, $name ?: $files['name'][$key]);
                 if (move_uploaded_file($files['tmp_name'][$key], $path)) {
                     if (\XLite\Core\Archive::getInstance()->isArchive($path) || 'csv' == substr(strrchr($path, '.'), 1)) {
                         $filesToImport[] = $path;
                     } else {
                         \XLite\Core\TopMessage::addError('The "{{file}}" is not CSV or archive', array('file' => $name));
                         \Includes\Utils\FileManager::deleteFile($path);
                     }
                 } else {
                     $path = null;
                 }
             }
             if (!$path) {
                 \XLite\Core\TopMessage::addError('The "{{file}}" file was not uploaded', array('file' => $name));
             }
         }
     }
     if ($filesToImport) {
         \XLite\Logic\Import\Importer::run(\XLite\Logic\Import\Importer::assembleImportOptions() + array('files' => $filesToImport));
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:50,代码来源:ImportAbstract.php


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