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


PHP ezcBaseFile::removeRecursive方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     try {
         if (file_exists('/tmp/lucene')) {
             ezcBaseFile::removeRecursive('/tmp/lucene');
         }
         mkdir('/tmp/lucene');
         $this->backend = new ezcSearchZendLuceneHandler("/tmp/lucene");
     } catch (ezcSearchCanNotConnectException $e) {
         self::markTestSkipped('Couldn\'t open Zend Lucene.');
     }
     $this->testFilesDir = dirname(__FILE__) . '/../testfiles/';
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:13,代码来源:zend_lucene_test.php

示例2: setUp

 protected function setUp()
 {
     // truncates the ezsi_file table
     $db = eZDB::instance();
     $sql = 'TRUNCATE TABLE ' . self::SI_BLOCK_TABLE_NAME;
     if (!$db->query($sql)) {
         return false;
     }
     // removes files in the si-block directory
     if (is_dir(realpath(self::SI_BLOCK_STORAGE_DIR))) {
         try {
             ezcBaseFile::removeRecursive(self::SI_BLOCK_STORAGE_DIR);
         } catch (Exception $e) {
             echo 'Got Exception message : ' . $e->getMessage() . "\n";
             return false;
         }
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ezsiblockfunction_test.php

示例3: clearStaticCache

 /**
  * Clears all static cache for a site
  * Removers all static cache, but not the static cache directory itself.
  *
  * Currently, this function only supports 'combined_host_url'
  *
  */
 static function clearStaticCache()
 {
     $ini = eZINI::instance('staticcache.ini');
     $storageDir = $ini->variable('CacheSettings', 'StaticStorageDir');
     // Check that we have combined_host_url hostmatching
     $siteIni = eZINI::instance();
     $matchType = $siteIni->variable('SiteAccessSettings', 'MatchOrder');
     if ($matchType !== 'combined_host_url') {
         throw new Exception('combined_host_url required for this workflow');
     }
     global $eZCurrentAccess;
     $siteAccess = $eZCurrentAccess['name'];
     //Get hostname part from siteaccess name (exclude for instance _eng or _admin)
     if (strpos($siteAccess, '_') === false) {
         $hostName = $siteAccess;
     } else {
         $hostName = substr($siteAccess, 0, strpos($siteAccess, '_'));
     }
     $staticCacheDir = eZDir::path(array($storageDir, $hostName));
     // Sanity checking, make sure we don't remove everyones static cache.
     if ($staticCacheDir == $storageDir) {
         throw new Exception("Failed to find correct static cache directory : {$staticCacheDir} \n");
     }
     $dirs = scandir($staticCacheDir);
     foreach ($dirs as $dir) {
         if ($dir !== '.' && $dir !== '..') {
             $fullPath = eZDir::path(array($staticCacheDir, $dir));
             if (is_dir($fullPath)) {
                 ezcBaseFile::removeRecursive($fullPath);
             } else {
                 if (!unlink($fullPath)) {
                     throw new ezsfFileCouldNotRemoveException($fullPath);
                 }
             }
         }
     }
 }
开发者ID:netbliss,项目名称:ezstyleeditor,代码行数:44,代码来源:ezstaticcacheoperations.php

示例4: performDelete

 /**
  * Deletes everything below a path.
  *
  * Deletes the resource identified by $path recursively. Returns an
  * instance of {@link ezcWebdavErrorResponse} if the deletion failed, and
  * null on success.
  * 
  * @param string $path 
  * @return ezcWebdavErrorResponse
  */
 protected function performDelete($path)
 {
     $errors = $this->checkDeleteRecursive($this->root . $path);
     // If an error will occur return the proper status. We return
     // multistatus in any case.
     if (count($errors)) {
         return new ezcWebdavMultistatusResponse($errors);
     }
     // Just delete otherwise
     if (is_file($this->root . $path)) {
         unlink($this->root . $path);
     } else {
         ezcBaseFile::removeRecursive($this->root . $path);
     }
     // Finally empty property storage for removed node
     $storagePath = $this->getPropertyStoragePath($path);
     if (is_file($storagePath)) {
         unlink($storagePath);
     }
     return null;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:31,代码来源:file.php

示例5: reset

 /**
  * Resets the whole storage.
  *
  * Deletes all data in the storage including {@link ezcCacheStackMetaData}
  * that was stored using {@link storeMetaData()}.
  */
 public function reset()
 {
     $files = glob("{$this->properties['location']}*");
     foreach ($files as $file) {
         if (is_dir($file)) {
             ezcBaseFile::removeRecursive($file);
         } else {
             if (@unlink($file) === false) {
                 throw new ezcBaseFilePermissionException($file, ezcBaseFileException::REMOVE, 'Could not unlink cache file.');
             }
         }
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:19,代码来源:file.php

示例6: testRecursiveNotWritableParent

 public function testRecursiveNotWritableParent()
 {
     self::assertEquals(15, count(ezcBaseFile::findRecursive($this->tempDir)));
     try {
         ezcBaseFile::removeRecursive($this->tempDir . '/dir7/dir1');
     } catch (ezcBaseFilePermissionException $e) {
         self::assertEquals("The file '{$this->tempDir}/dir7' can not be opened for writing.", $e->getMessage());
     }
     self::assertEquals(15, count(ezcBaseFile::findRecursive($this->tempDir)));
 }
开发者ID:BGCX261,项目名称:zphp-svn-to-git,代码行数:10,代码来源:file_remove_recursive_test.php

示例7: mkdir

    ezcBaseFile::removeRecursive('var/tmpfiles/backupfiles');
    if (!file_exists('var/tmpfiles/backupfiles')) {
        mkdir('var/tmpfiles/backupfiles');
        mkdir('var/tmpfiles/backupfiles/design');
    }
    $zip->extractTo('var/tmpfiles/update');
    $zip->close();
    $foldersSwitch = array('doc', 'ezcomponents', 'lib', 'modules', 'pos', 'translations', 'design/backendtheme', 'design/defaulttheme');
    echo "Switching folders\n";
    foreach ($foldersSwitch as $folder) {
        rename($folder, 'var/tmpfiles/backupfiles/' . $folder . '_' . $date);
        rename('var/tmpfiles/update/livehelperchat-master/lhc_web/' . $folder, $folder);
    }
    unlink('var/tmpfiles/master.zip');
    echo "Your old folders can be found - var/tmpfiles/backupfiles\n";
    ezcBaseFile::removeRecursive('var/tmpfiles/update');
    $jsonObject = json_decode(erLhcoreClassModelChatOnlineUser::executeRequest('https://raw.githubusercontent.com/LiveHelperChat/livehelperchat/master/lhc_web/doc/update_db/structure.json'), true);
    echo "----------------\nUpdating database\n----------------\n";
    if (is_array($jsonObject)) {
        $errorMessages = erLhcoreClassUpdate::doTablesUpdate($jsonObject);
        if (empty($errorMessages)) {
            $CacheManager = erConfigClassLhCacheConfig::getInstance();
            $CacheManager->expireCache();
            echo "UPDATE DONE\n";
        } else {
            echo "ERROR:\n" . implode("\n", $errorMessages);
        }
    }
} else {
    echo "Could not download archive!!!";
}
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:31,代码来源:update_files.php

示例8: doSourcefileArchive

    public function doSourcefileArchive()
    {
        $result = new ezcMvcResult();
        $nonExistingFiles = array();
        $hash = $this->hash;

        if ( $queueItem = mmMergeOperation::fetchByHash( $hash ) )
        {
            $status = 'ok';
            $message = '';
            $removed = array();
            $command = $queueItem->commandObject;
            if ( $command->conversionType == 'tvshow' )
            {
                $files = array_merge( $command->VideoFiles, $command->SubtitleFiles );
                foreach( $files as $file )
                {
                    $extension = pathinfo( $file['pathname'], PATHINFO_EXTENSION );
                    if ( ( $extension == 'mkv' or $extension == 'avi' ) &&
                        file_exists( $file['pathname']) &&
                        filesize( $file['pathname'] ) == 0 )
                    {
                        $result->variables['status'] = 'ko';
                        $result->variables['message'] = 'already_archived';
                        return $result;
                    }
                    if ( !file_exists( $file['pathname'] ) )
                    {
                        $nonExistingFiles[] = $file;
                    }
                    else
                    {
                        if ( !isset( $dummyFile ) )
                            $dummyFile = $file['pathname'];
                        $removed[] = $file['pathname'];
                        unlink( $file['pathname'] );
                    }
                }
                touch( $dummyFile );
            }
            else
            {
                $mainFile = $command->VideoFiles[0]['pathname'];
                if ( file_exists( $mainFile ) )
                {
                    $directory = dirname( $mainFile );
                    $files[] = glob( "$directory/*" );
                    try {
                        ezcBaseFile::removeRecursive( $directory );
                        $removed = $files;
                    } catch( ezcBaseFilePermissionException $e ) {
                        $status = 'ko';
                        $message = $e->getMessage();
                    }
                }
            }

            if ( !empty( $nonExistingFiles ) )
                $result->variables['messages'] = 'Some files were not found, see [not_found_files]';
            if ( $status === 'ok' )
            {
                $queueItem->status = mmMergeOperation::STATUS_ARCHIVED;
                ezcPersistentSessionInstance::get()->update( $queueItem );
            }
            $result->variables['status'] = $status;
            $result->variables['removed_files'] = $removed;
            $result->variables['not_found_files'] = $nonExistingFiles;
            $result->variables['message'] = $message;
        }
        else
        {
            // @todo Handle with exception
            $result->variables['status'] = 'ko';
            $result->variables['message'] = "No operation with hash $hash";
        }
        return $result;
    }
开发者ID:rangulicon,项目名称:mkvmanager,代码行数:77,代码来源:ajax.php

示例9: testRecursive5

 public function testRecursive5()
 {
     self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
     try {
         ezcBaseFile::removeRecursive($this->tempDir . '/dir6');
     } catch (ezcBaseFilePermissionException $e) {
         self::assertEquals("The file '{$this->tempDir}/dir6/file1.txt' can not be removed.", $e->getMessage());
     }
     self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
 }
开发者ID:mediasadc,项目名称:alba,代码行数:10,代码来源:file_remove_recursive_test.php

示例10:

<?php

require 'tutorial_autoload.php';
ezcBaseFile::removeRecursive('/dat/dev/ezcomponents/trash');
开发者ID:corcre,项目名称:elabftw,代码行数:4,代码来源:tutorial_example_03.php

示例11: testRecursive5

 public function testRecursive5()
 {
     self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
     try {
         ezcBaseFile::removeRecursive($this->tempDir . '/dir6');
     } catch (ezcBaseFilePermissionException $e) {
         // Make no asumption on which file is tryed to be removed first
         self::assertEquals(1, preg_match("(The file '{$this->tempDir}/dir6/file[12].txt' can not be removed.)", $e->getMessage()));
     }
     self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
 }
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:11,代码来源:file_remove_recursive_test.php


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