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


PHP eZDir::cleanupEmptyDirectories方法代码示例

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


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

示例1: cleanupEmptyDirectories

 /**
  * Goes trough the directory path and removes empty directories, starting at
  * the leaf and deleting down until a non empty directory is reached.
  * If the path is not a directory, nothing will happen.
  *
  * @param string $path
  */
 public static function cleanupEmptyDirectories($path)
 {
     $dirpath = eZDir::dirpath($path);
     eZDebugSetting::writeDebug('kernel-clustering', "eZClusterFileHandler::cleanupEmptyDirectories( '{$dirpath}' )");
     if (is_dir($dirpath)) {
         eZDir::cleanupEmptyDirectories($dirpath);
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezclusterfilehandler.php

示例2: setResourceContents

 /**
  * Sets the contents of a resource.
  *
  * This method replaces the content of the resource identified by $path
  * with the submitted $content.
  *
  * @param string $path
  * @param string $content
  */
 protected function setResourceContents($path, $content)
 {
     // Attempt to get file/resource sent from client/browser.
     $tempFile = $this->storeUploadedFile($path, $content);
     eZWebDAVContentBackend::appendLogEntry('SetResourceContents:' . $path . ';' . $tempFile);
     // If there was an actual file:
     if (!$tempFile) {
         return false;
         // @as self::FAILED_FORBIDDEN;
     }
     // Attempt to do something with it (copy/whatever).
     $fullPath = $path;
     $target = $this->splitFirstPathElement($path, $currentSite);
     if (!$currentSite) {
         return false;
         // @as self::FAILED_FORBIDDEN;
     }
     $result = $this->putVirtualFolderData($currentSite, $target, $tempFile);
     unlink($tempFile);
     eZDir::cleanupEmptyDirectories(dirname($tempFile));
     return $result;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:ezwebdavcontentbackend.php

示例3: foreach

        // Loop the image files and check if it is still used by a content object attribute. If not, delete it.
        foreach( $aImageFiles as $image )
        {
            $filePath = $image->attribute( 'filepath' );
            $dirpath = dirname( $filePath );
            $contentObjectAttributeID = $image->attribute( 'contentobject_attribute_id' );
            $dbResult = eZImageFile::fetchImageAttributesByFilepath( $filePath, $contentObjectAttributeID );
            if( count( $dbResult ) == 0 )
            {
                $file = eZClusterFileHandler::instance( $filePath );
                if ( $file->exists() ) // Delete the file physically
                {
                    $file->delete();
                    eZImageFile::removeFilepath( $contentObjectAttributeID, $filePath );
                    eZDir::cleanupEmptyDirectories( $dirpath );
                }

                // Delete the obsolete reference in the database
                $image->remove();
            }

            $progressBar->advance();
        }

        $progressBar->finish();
        $output->outputLine();
    }
    else
    {
        $output->outputText( 'No image file found !' );
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:fixorphanimages.php

示例4: processClientRequest

 function processClientRequest()
 {
     $this->appendLogEntry("WebDAV server started...", 'processClientRequest');
     $this->XMLBodyRead = false;
     // Dump some custom header/info.
     $this->headers();
     // Clear file status cache (just in case).
     clearstatcache();
     // Convert the requested URI string to non-bogus format.
     $target = urldecode($_SERVER["REQUEST_URI"]);
     $target = $this->processURL($target);
     $this->appendLogEntry("----------------------------------------");
     $this->appendLogEntry("Client says: " . $_SERVER["REQUEST_METHOD"], 'processClientRequest');
     $this->appendLogEntry("Target: " . $_SERVER["REQUEST_URI"], 'processClientRequest');
     $this->appendLogEntry("----------------------------------------");
     $status = eZWebDAVServer::FAILED_NOT_FOUND;
     switch ($_SERVER["REQUEST_METHOD"]) {
         // OPTIONS  (Server ID reply.)
         case "OPTIONS":
             $this->appendLogEntry("OPTIONS was issued from client.", 'processClientRequest');
             $options = $this->options($target);
             $status = $this->outputOptions($options);
             break;
             // PROPFIND (Show dir/collection content.)
         // PROPFIND (Show dir/collection content.)
         case "PROPFIND":
             $this->appendLogEntry("PROPFIND was issued from client.", 'processClientRequest');
             $depth = $_SERVER['HTTP_DEPTH'];
             if ($depth != 0 and $depth != 1 and $depth != "infinity") {
                 $depth = "infinity";
             }
             $this->appendLogEntry("Depth: {$depth}.", 'processClientRequest');
             $xmlBody = $this->xmlBody();
             // Find which properties were requested
             // $this->appendLogEntry( $xmlBody, 'xmlbody' );
             $dom = new DOMDocument('1.0', 'utf-8');
             $dom->preserveWhiteSpace = false;
             $ok = $dom->loadXML($xmlBody);
             $requestedProperties = array();
             if ($ok) {
                 $propfindNode = $dom->documentElement;
                 $propNode = $propfindNode->getElementsByTagName('prop')->item(0);
                 if ($propNode) {
                     $propList = $propNode->childNodes;
                     foreach ($propList as $node) {
                         $name = $node->localName;
                         $requestedProperties[] = $name;
                     }
                 } else {
                     $allpropNode = $propfindNode->getElementsByTagName('allprop')->item(0);
                     if ($allpropNode) {
                         // The server must return all possible properties
                         $requestedProperties = true;
                     } else {
                         $propnameNode = $propfindNode->getElementsByTagName('propname')->item(0);
                         if ($propnameNode) {
                             // The server must return only the names of all properties
                             $requestedProperties = false;
                         }
                     }
                 }
             }
             $collection = $this->getCollectionContent($target, $depth, $requestedProperties);
             if (is_array($collection)) {
                 $status = $this->outputCollectionContent($collection, $requestedProperties);
             } else {
                 $status = $collection;
             }
             break;
             // HEAD (Check if file/resource exists.)
         // HEAD (Check if file/resource exists.)
         case "HEAD":
             $this->appendLogEntry("HEAD was issued from client.", 'processClientRequest');
             $data = $this->get($target);
             $status = $this->outputSendDataToClient($data, true);
             break;
             // GET (Download a file/resource from server to client.)
         // GET (Download a file/resource from server to client.)
         case "GET":
             $this->appendLogEntry("GET was issued from client.", 'processClientRequest');
             $data = $this->get($target);
             $status = $this->outputSendDataToClient($data);
             break;
             // PUT (Upload a file/resource from client to server.)
         // PUT (Upload a file/resource from client to server.)
         case "PUT":
             $this->appendLogEntry("PUT was issued from client.", 'processClientRequest');
             $status = eZWebDAVServer::OK_CREATED;
             // Attempt to get file/resource sent from client/browser.
             $tempFile = $this->storeUploadedFile($target);
             // If there was an actual file:
             if ($tempFile) {
                 // Attempt to do something with it (copy/whatever).
                 $status = $this->put($target, $tempFile);
                 unlink($tempFile);
                 eZDir::cleanupEmptyDirectories(dirname($tempFile));
             } else {
                 $status = eZWebDAVServer::FAILED_FORBIDDEN;
             }
             break;
//.........这里部分代码省略.........
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:101,代码来源:ezwebdavserver.php

示例5: removeByAttribute

 /**
  * Attempt to remove content object 'image' attribute image variations by content object attribute
  *
  * @param object $contentClassImageAttribute object of objects of class eZContentObjectAttribute
  * @param array $class Array of object class identifiers to remove aliases for only these classes. Optional. Defaults to false
  * @param array $attributes Array of object image attribute identifiers to remove aliases from. Optional. Defaults to false
  * @param array $aliases Array of object image attribute image aliases to remove. Optional. Defaults to false
  *
  * @return bool true if successful, false otherwise
  * @static
  */
 static function removeByAttribute($contentObjectAttribute = false, $classes = false, $attributes = false, $aliases = false)
 {
     if (!is_object($contentObjectAttribute)) {
         return false;
     }
     // Test that content object class attribute identifier matches provided classes
     if ($classes != false && is_array($classes) && !in_array($contentObjectAttribute->attribute('object')->attribute('class_identifier'), $classes)) {
         return false;
     }
     // Test that content object class attribute identifier matches provided classes
     if ($attributes != false && is_array($attributes) && !in_array($contentObjectAttribute->attribute('contentclass_attribute_identifier'), $attributes)) {
         return false;
     }
     // Default datatypes to create image alias variations
     $imageDataTypeStrings = eZINI::instance('bcimagealias.ini')->variable('BCImageAliasSettings', 'ImageDataTypeStringList');
     // Check that content object attribute data type string matches allowed datatype settings
     if (!in_array($contentObjectAttribute->attribute('data_type_string'), $imageDataTypeStrings) || !$contentObjectAttribute->attribute('has_content')) {
         return false;
     }
     $filePaths = array();
     $results = array();
     $executionOptions = self::executionOptions();
     $messageCount = 0;
     $imageHandler = $contentObjectAttribute->attribute('content');
     $aliasList = $imageHandler->aliasList(false);
     // Do not process the orginal image alias
     unset($aliasList['original']);
     if (count($aliasList) == 0) {
         return false;
     }
     // Optional debug output
     if ($executionOptions['troubleshoot'] && $executionOptions['verboseLevel'] >= 2) {
         if ($executionOptions['verboseLevel'] >= 3) {
             self::displayMessage('All attribute image aliases stored in content data text field:', false);
             self::displayMessage($contentObjectAttribute->attribute('data_text'), "\n");
         }
         if ($executionOptions['verboseLevel'] >= 4) {
             self::displayMessage('All attribute image aliases stored in content alias list:', false);
             print_r($aliasList);
             self::displayMessage('', "\n\n");
         } elseif ($executionOptions['verboseLevel'] >= 3) {
             self::displayMessage('All attribute image aliases stored in content alias list:', false);
             print_r(array_keys($aliasList));
             self::displayMessage('', "\n");
         }
     }
     $contentObjectID = $contentObjectAttribute->attribute('contentobject_id');
     $contentObjectAttributeID = $contentObjectAttribute->attribute('id');
     $contentObjectAttributeVersion = $contentObjectAttribute->attribute('version');
     if ($contentObjectAttributeVersion === null) {
         $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID, true);
         $dirs = array();
         $count = 0;
         // Iterate over files
         foreach ($files as $filepath) {
             // Test $filepath from $files is in contains one of the $aliases items
             if ($aliases != false && is_array($aliases)) {
                 foreach ($aliases as $alias) {
                     if (!stristr('_' . $alias, $filepath)) {
                         continue 1;
                     }
                 }
             }
             $file = eZClusterFileHandler::instance($filepath);
             if ($file->exists()) {
                 $filePaths[] = $filepath;
                 if (!$executionOptions['dry']) {
                     $file->fileDelete($filepath);
                     $dirs[] = eZDir::dirpath($filepath);
                 }
                 $count++;
             }
         }
         if (!$executionOptions['dry']) {
             $dirs = array_unique($dirs);
             foreach ($dirs as $dirpath) {
                 eZDir::cleanupEmptyDirectories($dirpath);
             }
             eZImageFile::removeForContentObjectAttribute($contentObjectAttributeID);
             $message = "Removed datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
         } else {
             $message = "Dry run: Remove datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
         }
         while ($messageCount < $count) {
             self::scriptIterate($message);
             $messageCount++;
             $result = true;
         }
     } else {
//.........这里部分代码省略.........
开发者ID:philandteds,项目名称:bcimagealias,代码行数:101,代码来源:bcimagealias.php

示例6: tearDown

 public function tearDown()
 {
     eZUser::purgeUserCacheByUserId($this->userId);
     eZDir::cleanupEmptyDirectories(eZUser::getCacheDir($this->userId));
     parent::tearDown();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:6,代码来源:ezusercache_test.php


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