Skip to content
Snippets Groups Projects
Select Git revision
  • db06b906e50d7d1b7eca28f51db913af1fbc81f1
  • master default protected
2 results

filesystem.php

Blame
  • filesystem.php 17.84 KiB
    <?php
    /**
     * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
     * This file is licensed under the Affero General Public License version 3 or
     * later.
     * See the COPYING-README file.
     */
    
    /**
     * Class for abstraction of filesystem functions
     * This class won't call any filesystem functions for itself but but will pass them to the correct OC_Filestorage object
     * this class should also handle all the file permission related stuff
     *
     * Hooks provided:
     *   read(path)
     *   write(path, &run)
     *   post_write(path)
     *   create(path, &run) (when a file is created, both create and write will be emitted in that order)
     *   post_create(path)
     *   delete(path, &run)
     *   post_delete(path)
     *   rename(oldpath,newpath, &run)
     *   post_rename(oldpath,newpath)
     *   copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emitted in that order)
     *   post_rename(oldpath,newpath)
     *   post_initMountPoints(user, user_dir)
     *
     *   the &run parameter can be set to false to prevent the operation from occurring
     */
    
    namespace OC\Files;
    
    const FREE_SPACE_UNKNOWN = -2;
    const FREE_SPACE_UNLIMITED = -3;
    
    class Filesystem {
    	/**
    	 * @var Mount\Manager $mounts
    	 */
    	private static $mounts;
    
    	public static $loaded = false;
    	/**
    	 * @var \OC\Files\View $defaultInstance
    	 */
    	static private $defaultInstance;
    
    
    	/**
    	 * classname which used for hooks handling
    	 * used as signalclass in OC_Hooks::emit()
    	 */
    	const CLASSNAME = 'OC_Filesystem';
    
    	/**
    	 * signalname emitted before file renaming
    	 *
    	 * @param string $oldpath
    	 * @param string $newpath
    	 */
    	const signal_rename = 'rename';
    
    	/**
    	 * signal emitted after file renaming
    	 *
    	 * @param string $oldpath
    	 * @param string $newpath
    	 */
    	const signal_post_rename = 'post_rename';