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


PHP eZClusterFileHandler::cleanupEmptyDirectories方法代码示例

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


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

示例1: purge

 function purge($printCallback = false, $microsleep = false, $max = false, $expiry = false)
 {
     $file = $this->filePath;
     if ($max === false) {
         $max = 100;
     }
     $count = 0;
     $list = array();
     if (is_file($file)) {
         $list = array($file);
     } else {
         $globResult = glob($file . "/*");
         if (is_array($globResult)) {
             $list = $globResult;
         }
     }
     do {
         if ($count % $max == 0 && $microsleep) {
             usleep($microsleep);
         }
         // Sleep a bit to make the filesystem happier
         $count = 0;
         $file = array_shift($list);
         if (is_file($file)) {
             $mtime = @filemtime($file);
             if ($expiry === false || $mtime < $expiry) {
                 @unlink($file);
                 eZClusterFileHandler::cleanupEmptyDirectories($file);
             }
             ++$count;
         } else {
             if (is_dir($file)) {
                 $globResult = glob($file . "/*");
                 if (is_array($globResult)) {
                     $list = array_merge($globResult, $list);
                 }
             }
         }
         if ($printCallback) {
             call_user_func_array($printCallback, array($file, 1));
         }
     } while (count($list) > 0);
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:43,代码来源:ezfsfilehandler.php

示例2: renameOnDFS

 /**
  * Renamed DFS file $oldPath to DFS file $newPath
  *
  * @param string $oldPath
  * @param string $newPath
  * @return bool
  */
 public function renameOnDFS($oldPath, $newPath)
 {
     $this->accumulatorStart();
     $oldPath = $this->makeDFSPath($oldPath);
     $newPath = $this->makeDFSPath($newPath);
     $ret = eZFile::rename($oldPath, $newPath, true);
     if ($ret) {
         eZClusterFileHandler::cleanupEmptyDirectories($oldPath);
     }
     $this->accumulatorStop();
     return $ret;
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:19,代码来源:dfs.php

示例3: purge

    /**
     * Purge local and remote file data for current file.
     */
    function purge( $printCallback = false, $microsleep = false, $max = false, $expiry = false )
    {
        $file = $this->filePath;
        if ( $max === false )
            $max = 100;
        $count = 0;
        if ( is_file( $file ) )
            $list = array( $file );
        else
            $list = glob( $file . "/*" );
        do
        {
            if ( ( $count % $max ) == 0 && $microsleep )
                usleep( $microsleep ); // Sleep a bit to make the filesystem happier

            $count = 0;
            $file = array_shift( $list );

            if ( is_file( $file ) )
            {
                $mtime = @filemtime( $file );
                if ( $expiry === false ||
                    $mtime < $expiry ) // remove it if it is too old
                {
                    @unlink( $file );

                    eZClusterFileHandler::cleanupEmptyDirectories( $file );
                }
                ++$count;
            }
            else if ( is_dir( $file ) )
            {
                $list = array_merge( $list, glob( $file . "/*" ) );
            }

            if ( $printCallback )
                call_user_func_array( $printCallback,
                                      array( $file, 1 ) );
        } while ( count( $list ) > 0 );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:43,代码来源:ezfs2filehandler.php

示例4: purge

 /**
  * Purges local and remote file data for current file path.
  *
  * Can be given a file or a folder. In order to clear a folder, do NOT add
  * a trailing / at the end of the file's path: path/to/file instead of
  * path/to/file/.
  *
  * By default, only expired files will be removed (ezdfsfile.expired = 1).
  * If you specify an $expiry time, it will replace the expired test and
  * only purge files older than the given expiry timestamp.
  *
  * @param callback $printCallback
  *        Callback called after each delete iteration (@see $max) to print
  *        out a report of the deleted files. This callback expects two
  *        parameters, $file (delete pattern used to perform deletion) and
  *        $count (number of deleted items)
  * @param int $microsleep
  *        Wait interval before each purge batch of $max items
  * @param int $max
  *        Maximum number of items to delete in one batch (default: 100)
  * @param int $expiry
  *        If specificed, only files older than this date will be purged
  * @return void
  */
 function purge($printCallback = false, $microsleep = false, $max = false, $expiry = false)
 {
     eZDebugSetting::writeDebug('kernel-clustering', "dfs::purge( '{$this->filePath}' )");
     $file = $this->filePath;
     if ($max === false) {
         $max = 100;
     }
     $count = 0;
     /**
      * The loop starts without knowing how many files are to be deleted.
      * When _purgeByLike is called, it returns the number of affected rows.
      * If rows were affected, _purgeByLike will be called again
      */
     do {
         // @todo this won't work on windows, make a wrapper that uses
         //       either usleep or sleep depending on the OS
         if ($count > 0 && $microsleep) {
             usleep($microsleep);
             // Sleep a bit to make the database happier
         }
         $count = self::$dbbackend->_purgeByLike($file . "/%", true, $max, $expiry, 'purge');
         self::$dbbackend->_purge($file, true, $expiry, 'purge');
         if ($printCallback) {
             call_user_func_array($printCallback, array($file, $count));
         }
         // @todo Compare $count to $max. If $count < $max, no more files are to
         // be purged, and we can exit the loop
     } while ($count > 0);
     // Remove local copies
     if (is_file($file)) {
         @unlink($file);
     } elseif (is_dir($file)) {
         eZDir::recursiveDelete($file);
     }
     eZClusterFileHandler::cleanupEmptyDirectories($file);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:60,代码来源:ezdfsfilehandler.php

示例5: purge

    function purge( $printCallback = false, $microsleep = false, $max = false, $expiry = false )
    {
        $file = $this->filePath;
        if ( $max === false )
            $max = 100;
        $count = 0;
        do
        {
            if ( $count > 0 && $microsleep )
                usleep( $microsleep ); // Sleep a bit to make the database happier
            $count = self::$dbbackend->_purgeByLike( $file . "/%", true, $max, $expiry, 'purge' );
            self::$dbbackend->_purge( $file, true, $expiry, 'purge' );
            if ( $printCallback )
                call_user_func_array( $printCallback,
                                      array( $file, $count ) );
        } while ( $count > 0 );
        // Remove local copy
        if ( is_file( $file ) )
        {
            @unlink( $file );
        }
        else if ( is_dir( $file ) )
        {
            eZDir::recursiveDelete( $file );
        }

        eZClusterFileHandler::cleanupEmptyDirectories( $file );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:28,代码来源:ezdbfilehandler.php


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